Fórum

How to Customize the login portlet ​error messages using hook

thumbnail
Shilpa B, modificado 7 Anos atrás.

How to Customize the login portlet ​error messages using hook

Junior Member Postagens: 61 Data de Entrada: 02/08/12 Postagens Recentes
I'm using Liferay 6.2

In login.jsp in Login portlet, i can see the below error messages.

<liferay-ui:error exception="<%= AuthException.class %>" message="authentication-failed" />
<liferay-ui:error exception="<%= CompanyMaxUsersException.class %>" message="unable-to-login-because-the-maximum-number-of-users-has-been-reached" />
<liferay-ui:error exception="<%= CookieNotSupportedException.class %>" message="authentication-failed-please-enable-browser-cookies" />
<liferay-ui:error exception="<%= NoSuchUserException.class %>" message="authentication-failed" />
<liferay-ui:error exception="<%= PasswordExpiredException.class %>" message="your-password-has-expired" />
<liferay-ui:error exception="<%= UserEmailAddressException.class %>" message="authentication-failed" />
<liferay-ui:error exception="<%= UserLockoutException.class %>" message="this-account-has-been-locked" />
<liferay-ui:error exception="<%= UserPasswordException.class %>" message="authentication-failed" />
<liferay-ui:error exception="<%= UserScreenNameException.class %>" message="authentication-failed" />

When we enter wrong Email Address or Password, in the both the cases it will throw the same error message i.e. "Authentication failed. Please try again." for this the key is "authentication-failed" in Language.properties file.

I want to display different error message for the both the fields Email Address and Password when user enters wrong values.

Wrong Email Address - different error message i.e. Invalid User Id
Wrong Password - different error message ​i.e. Incorrect Password

As I have same key message="authentication-failed" ​ for all errors, how to override this using hook.

How to implement this one.
thumbnail
Samuel Kong, modificado 7 Anos atrás.

RE: How to Customize the login portlet ​error messages using hook

Liferay Legend Postagens: 1902 Data de Entrada: 10/03/08 Postagens Recentes
You should not make this change. The change you want to make will make your website vulnerable to email address enumeration.
thumbnail
Shilpa B, modificado 7 Anos atrás.

RE: How to Customize the login portlet ​error messages using hook

Junior Member Postagens: 61 Data de Entrada: 02/08/12 Postagens Recentes
But it is my requirement, I want to implement this way as mentioned above .
If I should not make this change than how should I implement it? Please let me know is there any other solution.
thumbnail
Samuel Kong, modificado 7 Anos atrás.

RE: How to Customize the login portlet ​error messages using hook

Liferay Legend Postagens: 1902 Data de Entrada: 10/03/08 Postagens Recentes
I'm saying you shouldn't implement this requirement at all. You should go to whoever gave you this requirement and tell them that what they want essentially creates a security vulnerability in the application. It's not a good change to make.