Fórumok

UserServiceUtil.updatePassword throws exception

Zhang Lu, módosítva 12 év-val korábban

UserServiceUtil.updatePassword throws exception

New Member Bejegyzések: 7 Csatlakozás dátuma: 2011.02.10. Legújabb bejegyzések
Liferay 5.2 tomcat bundle.

When user forgot the password, I created my own custom forgot password page to handle the password reset because the user email address is not required for the site. I used the security question and answer strategy to validate the user.

When I call the function UserServiceUtil.updatePassword(userId, pwd1, pwd2, false); where pwd1 equals to the pwd2 which is the new password value, I am getting an exception below:

03:40:15,254 ERROR [IncludeTag:165] com.liferay.portal.security.auth.PrincipalException
at com.liferay.portal.service.permission.UserPermissionImpl.check(UserPermissionImpl.java:48)
at com.liferay.portal.service.permission.UserPermissionUtil.check(UserPermissionUtil.java:40)
at com.liferay.portal.service.impl.UserServiceImpl.updatePassword(UserServiceImpl.java:519)
at com.liferay.portal.service.UserServiceUtil.updatePassword(UserServiceUtil.java:309)
at org.apache.jsp.html.portlet.login.forgot_005fpassword_jsp._jspService(forgot_005fpassword_jsp.java:1072)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:497)
at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:67)
at org.apache.jsp.html.common.themes.portlet_jsp._jspService(portlet_jsp.java:2694)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

Please help~~~
thumbnail
Thiago Leão Moreira, módosítva 12 év-val korábban

RE: UserServiceUtil.updatePassword throws exception

Liferay Legend Bejegyzések: 1449 Csatlakozás dátuma: 2007.10.10. Legújabb bejegyzések
Since you are reseting the password of a user using the guest user you should use the UserLocalServiceUtil class to by pass the Permission system of Liferay. I cannot see another way to do it.
Zhang Lu, módosítva 12 év-val korábban

RE: UserServiceUtil.updatePassword throws exception

New Member Bejegyzések: 7 Csatlakozás dátuma: 2011.02.10. Legújabb bejegyzések
Well, that was simple enough to make this work. You have just nailed the issue there. I used the wrong function call here.

Thank you!!