Forums de discussion

User choice login option in Liferay

thumbnail
zaheer mohammed saddapalli, modifié il y a 14 années.

User choice login option in Liferay

Regular Member Publications: 165 Date d'inscription: 15/01/08 Publications récentes
Dear All,

I have running Liferay. I have specified screen-name login settings.
Lets say i have 10 users. 5 of them want to login using their Email and 5 with their screen name.

Is there any work around in Liferay?

Thank you

SMDZ
thumbnail
Sandeep Nair, modifié il y a 14 années.

RE: User choice login option in Liferay

Liferay Legend Publications: 1744 Date d'inscription: 06/11/08 Publications récentes
Hi,

AFIK you can only use any one of the authtype for authentication that is either Email Address, Screen name or UserId which is specified in following property.


    # The portal can authenticate users based on their email address, screen
    # name, or user id.
    #
    company.security.auth.type=emailAddress
    #company.security.auth.type=screenName
    #company.security.auth.type=userId


This property value is read in LoginUtil and user is validated accordingly.

 if (authType.equals(CompanyConstants.AUTH_TYPE_EA)) {
			authResult = UserLocalServiceUtil.authenticateByEmailAddress(
				company.getCompanyId(), login, password, headerMap,
				parameterMap);

			userId = UserLocalServiceUtil.getUserIdByEmailAddress(
				company.getCompanyId(), login);
		}
		else if (authType.equals(CompanyConstants.AUTH_TYPE_SN)) {
			authResult = UserLocalServiceUtil.authenticateByScreenName(
				company.getCompanyId(), login, password, headerMap,
				parameterMap);

			userId = UserLocalServiceUtil.getUserIdByScreenName(
				company.getCompanyId(), login);
		}
		else if (authType.equals(CompanyConstants.AUTH_TYPE_ID)) {
			authResult = UserLocalServiceUtil.authenticateByUserId(
				company.getCompanyId(), userId, password, headerMap,
				parameterMap);
		}


Regards,
Sandeep
thumbnail
zaheer mohammed saddapalli, modifié il y a 14 années.

RE: User choice login option in Liferay

Regular Member Publications: 165 Date d'inscription: 15/01/08 Publications récentes
Thank you sandeep,

Can we achive this this by customizing LoginUtil?
thumbnail
Sandeep Nair, modifié il y a 14 années.

RE: User choice login option in Liferay

Liferay Legend Publications: 1744 Date d'inscription: 06/11/08 Publications récentes
Yes you should be able to though i havent tried. You can either pass a parameter specifying which authtype you want to use and not use the authtype from property. Or you can do a check inside the method like identifying whether the login name passed is users screen name or Emailaddress or userid and then authenticate accordingly.

Regards,
Sandeep
thumbnail
zaheer mohammed saddapalli, modifié il y a 14 années.

RE: User choice login option in Liferay

Regular Member Publications: 165 Date d'inscription: 15/01/08 Publications récentes
Let me try ....
Asik Umar, modifié il y a 14 années.

RE: User choice login option in Liferay

New Member Publications: 2 Date d'inscription: 26/03/10 Publications récentes
If u get it. Please help.