Foros de discusión

Issue in Login Hook

thumbnail
Vishal Srivastava, modificado hace 9 años.

Issue in Login Hook

Junior Member Mensajes: 26 Fecha de incorporación: 7/07/14 Mensajes recientes
Hi,
Issue in Login Hook-:
I am facing issue of Case Convertion in liferay default login page.
->If a user id created with e-mail id(in UpperCase) as Xyz.Abc@sample.com and than try to login, It shows me authentication failed.
->If user is created (in LowerCase)as xyz.abc@sample.com and on Login screen if i enter his details in Upper/Lower case than there is no issue.
Hope some one might have faced same issue before.
Thanks in advance.
thumbnail
David H Nebinger, modificado hace 9 años.

RE: Issue in Login Hook

Liferay Legend Mensajes: 14916 Fecha de incorporación: 2/09/06 Mensajes recientes
Email is supposed to be case insensitive.

Just force it to be lower case and move on.
thumbnail
Vishal Srivastava, modificado hace 9 años.

RE: Issue in Login Hook

Junior Member Mensajes: 26 Fecha de incorporación: 7/07/14 Mensajes recientes
Thanks David for your reply.
I did this-:
<aui:input label="<%= loginLabel %>" name="login" style="width:225px;" showRequiredLabel="<%= false %>" type="text" value="<%=(login).toLowerCase()%>"

I have tried this and its not working.
thumbnail
Andew Jardine, modificado hace 9 años.

RE: Issue in Login Hook

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
You might want to try moving that logic to your action hook where you do the lookup. If this still isn't working, can you share with us the login hook code (that java stuff), your configurations, etc?
thumbnail
Vishal Srivastava, modificado hace 9 años.

RE: Issue in Login Hook

Junior Member Mensajes: 26 Fecha de incorporación: 7/07/14 Mensajes recientes
I have used customjsp login.jsp and in my action class i am overriding run method.
Do i need to add my logic inside run method.
thumbnail
Jitendra Rajput, modificado hace 9 años.

RE: Issue in Login Hook

Liferay Master Mensajes: 875 Fecha de incorporación: 7/01/11 Mensajes recientes
Before authentication convert email address to lower case using StringUtil.toLowerCase()
thumbnail
Vishal Srivastava, modificado hace 9 años.

RE: Issue in Login Hook

Junior Member Mensajes: 26 Fecha de incorporación: 7/07/14 Mensajes recientes
Hi Jitendra,

StringUtil.toLowerCase() is not working
thumbnail
Andew Jardine, modificado hace 9 años.

RE: Issue in Login Hook

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Again -- show the code. Share with us your class with you "run" method.
thumbnail
Vishal Srivastava, modificado hace 9 años.

RE: Issue in Login Hook

Junior Member Mensajes: 26 Fecha de incorporación: 7/07/14 Mensajes recientes
<aui:form action="<%= loginURL %>" autocomplete='<%= PropsValues.COMPANY_SECURITY_LOGIN_FORM_AUTOCOMPLETE ? "on" : "off" %>' method="post" name="fm">
<aui:input name="redirect" type="hidden" value="<%= redirect %>" />

<c:choose>
<c:when test='<%= SessionMessages.contains(request, "user_added") %>'>

<%
String userEmailAddress = (String)SessionMessages.get(request, "user_added");
String userPassword = (String)SessionMessages.get(request, "user_added_password");
%>

<div class="portlet-msg-success">
<c:choose>
<c:when test="<%= company.isStrangersVerify() || Validator.isNull(userPassword) %>">
<%= LanguageUtil.get(pageContext, "thank-you-for-creating-an-account") %>

<c:if test="<%= company.isStrangersVerify() %>">
<%= LanguageUtil.format(pageContext, "your-email-verification-code-has-been-sent-to-x", userEmailAddress) %>
</c:if>
</c:when>
<c:otherwise>
<%= LanguageUtil.format(pageContext, "thank-you-for-creating-an-account.-your-password-is-x", userPassword, false) %>
</c:otherwise>
</c:choose>

<c:if test="<%= PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.ADMIN_EMAIL_USER_ADDED_ENABLED) %>">
<%= LanguageUtil.format(pageContext, "your-password-has-been-sent-to-x", userEmailAddress) %>
</c:if>
</div>
</c:when>
<c:when test='<%= SessionMessages.contains(request, "user_pending") %>'>

<%
String userEmailAddress = (String)SessionMessages.get(request, "user_pending");
%>

<div class="portlet-msg-success">
<%= LanguageUtil.format(pageContext, "thank-you-for-creating-an-account.-you-will-be-notified-via-email-at-x-when-your-account-has-been-approved", userEmailAddress) %>
</div>
</c:when>
</c:choose>

<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" />

<aui:fieldset>

<%
String loginLabel = null;

if (authType.equals(CompanyConstants.AUTH_TYPE_EA)) {
loginLabel = "email-address";
}
else if (authType.equals(CompanyConstants.AUTH_TYPE_SN)) {
loginLabel = "screen-name";
}
else if (authType.equals(CompanyConstants.AUTH_TYPE_ID)) {
loginLabel = "id";
}
%>

<aui:input label="<%= loginLabel %>" name="login" style="width:225px;" showRequiredLabel="<%= false %>" type="text" value="<%=login%>" >
<!-- I want when value of Logis (email) is entered its should be converted something like this.<%=(login).toLoweCase()> !>
<aui:validator name="required" errorMessage="Field is required" />
</aui:input>

<aui:input name="password" style="width:225px;" showRequiredLabel="<%= false %>" type="password" value="<%= password %>">
<aui:validator name="required" errorMessage="Field is required" />
</aui:input>

<span id="<portlet:namespace />passwordCapsLockSpan" style="display: none;"><liferay-ui:message key="caps-lock-is-on" /></span>

<%-- <c:if test="<%= company.isAutoLogin() && !PropsValues.SESSION_DISABLED %>">
<aui:input checked="<%= rememberMe %>" name="rememberMe" type="checkbox" />
</c:if> --%>
</aui:fieldset>

<aui:button-row>
<aui:button type="submit" value="sign-in" />
</aui:button-row>
</aui:form>

This ActionHook-:
public class LoginAdminAction extends Action{


@Override
public void run(HttpServletRequest request, HttpServletResponse response)
throws ActionException {
// TODO Auto-generated method stub

}
thumbnail
Andew Jardine, modificado hace 9 años.

RE: Issue in Login Hook

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
As previously suggested -- move the scrub logic to the backend.


This ActionHook-:
public class LoginAdminAction extends Action{


@Override
public void run(HttpServletRequest request, HttpServletResponse response)
throws ActionException { 

  try
  {
        _doRun(request, response);
  }
  catch( Exception e )
  {
      // log error
  }

private void _doRun(HttpServletRequest request, HttpServletResponse response) throws Exception
{
    String login = ParamUtil.getString(request, "login");

    if ( Validator.isNotNull(login) )
        login = StringUitl.toLowercase( login );

    // keep going...

}

}