RE: Changing Login Error Messages

5025146, modified 14 Years ago. Junior Member Posts: 53 Join Date: 5/28/10 Recent Posts
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
4640595, modified 14 Years ago. Regular Member Posts: 177 Join Date: 2/23/10 Recent Posts
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
5025146, modified 14 Years ago. Junior Member Posts: 53 Join Date: 5/28/10 Recent Posts
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
4096596, modified 14 Years ago. Junior Member Posts: 38 Join Date: 10/6/09 Recent Posts
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, modified 13 Years ago. New Member Posts: 15 Join Date: 1/20/11 Recent Posts
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, modified 13 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
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, modified 13 Years ago. New Member Posts: 15 Join Date: 1/20/11 Recent Posts
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, modified 2 Years ago. Junior Member Posts: 72 Join Date: 2/17/14 Recent Posts

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 ?

Srinivas P, modified 2 Years ago. Junior Member Posts: 72 Join Date: 2/17/14 Recent Posts

Hi All,

 

Can any one help me out.