Fórumok

Changing Login Error Messages

Aaron Bryenton, módosítva 13 év-val korábban

Changing Login Error Messages

Junior Member Bejegyzések: 53 Csatlakozás dátuma: 2010.05.28. Legújabb bejegyzések
Hi,

I was wondering how to go about changing the login errors you receive if logging in incorrectly.

Currently you receive:

"You have entered invalid data. Please try again"

and

"Authentication failed. Please try again"

I would like to have that changed to one generic error message:

"Login failed; Please try again"

Thanks for the help!
Aaron
thumbnail
Pranay R Patadiya, módosítva 13 év-val korábban

RE: Changing Login Error Messages

Regular Member Bejegyzések: 177 Csatlakozás dátuma: 2010.02.23. Legújabb bejegyzések
Hi,

Login error message is just a message written in language property files.

For authentication fail the language key is authentication-failed.

For English language you need to over ride Language_en_EN.properties, make a hook for that.

Other messages you can find in the same file of portal source.

Thanks,
Pranay Patadiya
Aaron Bryenton, módosítva 13 év-val korábban

RE: Changing Login Error Messages

Junior Member Bejegyzések: 53 Csatlakozás dátuma: 2010.05.28. Legújabb bejegyzések
Thanks for the response.

So I can change the name of the messages in the language file. Where do I go to delete one of the messages?

Both the messages are still showing, I only need on to be displayed.

Thanks,
Aaron
Sarika Nair, módosítva 13 év-val korábban

RE: Changing Login Error Messages

Junior Member Bejegyzések: 38 Csatlakozás dátuma: 2009.10.06. Legújabb bejegyzések
Hi Aaron,

Go into login.jsp in Login portlet,u will find the following code there:

<liferay-ui:error exception="<%= AuthException.class %>" message="authentication-failed" />
<liferay-ui:error exception="<%= CookieNotSupportedException.class %>" message="authentication-failed-please-enable-browser-cookies" />
<liferay-ui:error exception="<%= NoSuchUserException.class %>" message="please-enter-a-valid-login" />
<liferay-ui:error exception="<%= PasswordExpiredException.class %>" message="your-password-has-expired" />
<liferay-ui:error exception="<%= UserEmailAddressException.class %>" message="please-enter-a-valid-login" />
<liferay-ui:error exception="<%= UserLockoutException.class %>" message="this-account-has-been-locked" />
<liferay-ui:error exception="<%= UserPasswordException.class %>" message="please-enter-a-valid-password" />
<liferay-ui:error exception="<%= UserScreenNameException.class %>" message="please-enter-a-valid-screen-name" />


inorder to change the error message follow the example given below.

Eg: Suppose you want to change the error message for "please-enter-a-valid-login"
Go to Language.properties, find the message assigned to it
Eg: please-enter-a-valid-login=Please enter a valid login.

Paste your customized message in the following files
language-ext.properties and language-ext_en.properties
please-enter-a-valid-login=Login failed,Please try again.

deploy the changes and restart the server.

I hope this works for you.
thumbnail
Michael Charles, módosítva 12 év-val korábban

RE: Changing Login Error Messages

New Member Bejegyzések: 15 Csatlakozás dátuma: 2011.01.20. Legújabb bejegyzések
Is there a way to change this dynamically form a class that implements Authenticator()?

..for example I'd like to change the value for "authentication-failed" based on a return status.
thumbnail
David H Nebinger, módosítva 12 év-val korábban

RE: Changing Login Error Messages

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Nope, it all relies upon the language bundle for the rendering.

You can change the language bundle to use parameters, then set those parameters in your custom authenticator to get the same result.
thumbnail
Michael Charles, módosítva 12 év-val korábban

RE: Changing Login Error Messages

New Member Bejegyzések: 15 Csatlakozás dátuma: 2011.01.20. Legújabb bejegyzések
David H Nebinger:
Nope, it all relies upon the language bundle for the rendering.

You can change the language bundle to use parameters, then set those parameters in your custom authenticator to get the same result.


Thanks.
Chanakya P, módosítva 1 év-val korábban

RE: Changing Login Error Messages

Junior Member Bejegyzések: 72 Csatlakozás dátuma: 2014.02.17. Legújabb bejegyzések

Hi ,

Can you please help me out, How to do in Liferay DXP.

How to set parameters in custom authenticator ?

How to get those parameter related exception message in login.jsp ?

Chanakya P, módosítva 1 év-val korábban

RE: Changing Login Error Messages

Junior Member Bejegyzések: 72 Csatlakozás dátuma: 2014.02.17. Legújabb bejegyzések

Hi All,

 

Can any one help me out.