Foros de discusión

Changing Login Error Messages

Aaron Bryenton, modificado hace 13 años.

Changing Login Error Messages

Junior Member Mensajes: 53 Fecha de incorporación: 28/05/10 Mensajes recientes
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, modificado hace 13 años.

RE: Changing Login Error Messages

Regular Member Mensajes: 177 Fecha de incorporación: 23/02/10 Mensajes recientes
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, modificado hace 13 años.

RE: Changing Login Error Messages

Junior Member Mensajes: 53 Fecha de incorporación: 28/05/10 Mensajes recientes
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, modificado hace 13 años.

RE: Changing Login Error Messages

Junior Member Mensajes: 38 Fecha de incorporación: 6/10/09 Mensajes recientes
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, modificado hace 11 años.

RE: Changing Login Error Messages

New Member Mensajes: 15 Fecha de incorporación: 20/01/11 Mensajes recientes
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, modificado hace 11 años.

RE: Changing Login Error Messages

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
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, modificado hace 11 años.

RE: Changing Login Error Messages

New Member Mensajes: 15 Fecha de incorporación: 20/01/11 Mensajes recientes
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, modificado hace 1 año.

RE: Changing Login Error Messages

Junior Member Mensajes: 72 Fecha de incorporación: 17/02/14 Mensajes recientes

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, modificado hace 1 año.

RE: Changing Login Error Messages

Junior Member Mensajes: 72 Fecha de incorporación: 17/02/14 Mensajes recientes

Hi All,

 

Can any one help me out.