掲示板
How to create a valid password reset link?
10年前 に Stefan Holmgren によって更新されました。
How to create a valid password reset link?
New Member 投稿: 3 参加年月日: 11/05/06 最新の投稿
Liferay 6.2.0 CE GA1
Tomcat 7.0.42
I am trying to create a password reset URL. The following code gives me a URL (for example http://www.qweqweqweqweqwe.se:8085/c/portal/update_password?p_l_id=12421&ticketKey=bb8226a6-6349-4922-93ce-b067cc62cb23) that looks identical to the one that the Sign In Portlet sends in an email when clicking on "forgot password" (except for the ticket of course):
ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest);
Ticket ticket = TicketLocalServiceUtil.addTicket(user.getCompanyId(),
User.class.getName(), user.getUserId(),
TicketConstants.TYPE_PASSWORD, null, expirationDate,
serviceContext);
String passwordResetURL = serviceContext.getPortalURL() + serviceContext.getPathMain() +
"/portal/update_password?p_l_id=" + plid +
"&ticketKey=" + ticket.getKey();
The following is done in order:
1. When I click on my own generated URL I just come to a blank page.
2. When I click on the link sent from the Sign In Portlet I come to the correct reset page.
3. When I now again click on my own generated URL, I come to the correct reset page. (???)
Do anybody know how to create a link that works?
Tomcat 7.0.42
I am trying to create a password reset URL. The following code gives me a URL (for example http://www.qweqweqweqweqwe.se:8085/c/portal/update_password?p_l_id=12421&ticketKey=bb8226a6-6349-4922-93ce-b067cc62cb23) that looks identical to the one that the Sign In Portlet sends in an email when clicking on "forgot password" (except for the ticket of course):
ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest);
Ticket ticket = TicketLocalServiceUtil.addTicket(user.getCompanyId(),
User.class.getName(), user.getUserId(),
TicketConstants.TYPE_PASSWORD, null, expirationDate,
serviceContext);
String passwordResetURL = serviceContext.getPortalURL() + serviceContext.getPathMain() +
"/portal/update_password?p_l_id=" + plid +
"&ticketKey=" + ticket.getKey();
The following is done in order:
1. When I click on my own generated URL I just come to a blank page.
2. When I click on the link sent from the Sign In Portlet I come to the correct reset page.
3. When I now again click on my own generated URL, I come to the correct reset page. (???)
Do anybody know how to create a link that works?
10年前 に Tomáš Polešovský によって更新されました。
RE: How to create a valid password reset link?
Liferay Master 投稿: 676 参加年月日: 09/02/13 最新の投稿
Hi Stefan,
any errors in logs?
I tried that code and it works good.
any errors in logs?
I tried that code and it works good.
10年前 に Stefan Holmgren によって更新されました。
RE: How to create a valid password reset link?
New Member 投稿: 3 参加年月日: 11/05/06 最新の投稿
No, in the log nothing is written.
Strange that the code works for you. Currently I have no idea how to solve the problem. But we are going to setup a new production server, and hopefully it will work there.
Strange that the code works for you. Currently I have no idea how to solve the problem. But we are going to setup a new production server, and hopefully it will work there.
10年前 に Tomáš Polešovský によって更新されました。
RE: How to create a valid password reset link?
Liferay Master 投稿: 676 参加年月日: 09/02/13 最新の投稿
If it helps, here is the code I use.
I executed it from Script console as Groovy script:
And then used incognito browser mode to execute the URL:
http://localhost:8080/c/portal/update_password?p_l_id=0&ticketKey=92b1dcbf-ec81-4921-afa0-1d5de8a1fbcf
HTH.
I executed it from Script console as Groovy script:
import com.liferay.portal.service.*;
import com.liferay.portal.model.*;
ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest);
companyId = 10157;
userId = 10201;
expirationDate = new Date(1400000000000);
Ticket ticket = TicketLocalServiceUtil.addTicket(companyId,
User.class.getName(), userId,
TicketConstants.TYPE_PASSWORD, null, expirationDate,
serviceContext);
String passwordResetURL = serviceContext.getPortalURL() + serviceContext.getPathMain() +
"/portal/update_password?p_l_id=" + 0 +
"&ticketKey=" + ticket.getKey();
out.println(passwordResetURL);
And then used incognito browser mode to execute the URL:
http://localhost:8080/c/portal/update_password?p_l_id=0&ticketKey=92b1dcbf-ec81-4921-afa0-1d5de8a1fbcf
HTH.
9年前 に manish dadheech によって更新されました。
RE: How can i exclude admin from default password policy,
New Member 投稿: 3 参加年月日: 14/03/17 最新の投稿
Hi Tomas Polesovsky,
i have edited default password policy as per my requirement but default policy will be apply so i want to exclude admin user from that policy can u please help me........
i have edited default password policy as per my requirement but default policy will be apply so i want to exclude admin user from that policy can u please help me........