留言板

Changing Login Error Messages

Aaron Bryenton,修改在13 年前。

Changing Login Error Messages

Junior Member 帖子: 53 加入日期: 10-5-28 最近的帖子
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,修改在13 年前。

RE: Changing Login Error Messages

Regular Member 帖子: 177 加入日期: 10-2-23 最近的帖子
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,修改在13 年前。

RE: Changing Login Error Messages

Junior Member 帖子: 53 加入日期: 10-5-28 最近的帖子
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,修改在13 年前。

RE: Changing Login Error Messages

Junior Member 帖子: 38 加入日期: 09-10-6 最近的帖子
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,修改在12 年前。

RE: Changing Login Error Messages

New Member 帖子: 15 加入日期: 11-1-20 最近的帖子
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,修改在12 年前。

RE: Changing Login Error Messages

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
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,修改在12 年前。

RE: Changing Login Error Messages

New Member 帖子: 15 加入日期: 11-1-20 最近的帖子
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,修改在1 年前。

RE: Changing Login Error Messages

Junior Member 帖子: 72 加入日期: 14-2-17 最近的帖子

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,修改在1 年前。

RE: Changing Login Error Messages

Junior Member 帖子: 72 加入日期: 14-2-17 最近的帖子

Hi All,

 

Can any one help me out.