掲示板

Liferay session with JSF without login hook

7年前 に Armando Ramirez によって更新されました。

Liferay session with JSF without login hook

New Member 投稿: 14 参加年月日: 16/10/05 最新の投稿
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
7年前 に Neil Griffin によって更新されました。

RE: Liferay session with JSF without login hook

Liferay Legend 投稿: 2655 参加年月日: 05/07/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