Forums de discussion

Liferay session with JSF without login hook

Armando Ramirez, modifié il y a 7 années.

Liferay session with JSF without login hook

New Member Publications: 14 Date d'inscription: 05/10/16 Publications récentes
I have a problem, I get the user and password of a view and I check If This data is correct in the data of liferay, when it's correct my method return 1 if the validation is true, but I do not know how to make the successful login in liferay. I search information but I only find the session portlet, so I need that the users can get in lferay session.
This is my method:
try {
long companyId = PortalUtil.getDefaultCompanyId();
System.out.println(companyId + " id company");
User user1;
try {
user1 = UserLocalServiceUtil.getUserByEmailAddress(companyId, name);
long cmp = user1.getCompanyId();
Company company = CompanyLocalServiceUtil.getCompany(cmp);
int a = UserLocalServiceUtil.authenticateByUserId(company.getCompanyId(), user.getId(), pass, null,
null, null);
if (a == 1) {

System.out.println("Log in successful");
HERE I SHOULD GIVE ACCES TO USERS IN LIFERAY SESSION

}
} catch (PortalException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
}
} catch (Exception e) {
System.out.println("ERROR" + e);
}


I work with tomcat 7.0.62 and liferay 6.2 and without struts
thumbnail
Neil Griffin, modifié il y a 7 années.

RE: Liferay session with JSF without login hook

Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Hi Armando,

Very sorry for the late reply to your question. Is this still a problem in your environment?

If yes, then I recommend that you try our jsf-login-portlet demo.

The source can be found at GitHub and the Liferay Portal 7.0 version and Liferay Portal 6.2 version can be downloaded from Maven Central as downloadable wars that you can copy to $LIFERAY_HOME/deploy in order to try in your environment.

Kind Regards,

Neil