留言板

Liferay session with JSF without login hook

Armando Ramirez,修改在7 年前。

Liferay session with JSF without login hook

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

RE: Liferay session with JSF without login hook

Liferay Legend 帖子: 2655 加入日期: 05-7-27 最近的帖子
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