Forgotten password functionality based on UserName instead of Email

42 Rio asked on January 23, 2019 13:28

Hello, we are using the default forgotten password functionality of LogonForm webpart. But there is an issue with the demand of not having unique emails (there could be multiple accounts with same email). We need to be able to put username instead of email into the form, then find appropriate user account and send the reset link for this account to his email.

The problem is in the function: AuthenticationHelper.ForgottenEmailRequest(email, SiteContext.CurrentSiteName, "LOGONFORM", SendEmailFrom, null, ResetPasswordURL, returnUrl);

It takes email as parameter, then finds first account with that email and sends the link. It doesn't allow me to choose the account directly by username and therefore I am not able to send the link for the second user account with the same email.

Correct Answer

Brenden Kehren answered on January 23, 2019 13:52

Create a custom login control which looks the user info up by username, then send the forgotten email request based on the user's email you just looked up by username. Yes it requires some custom code but it should be a pretty easy write.

2 votesVote for this answer Unmark Correct answer

Recent Answers


42 Rio answered on January 23, 2019 14:11

Hi Brenden and thanks for your answer. I've managed to do the user lookup, but I don't know which method should I use for manually create the reset link. We dont have access to the Kentico source code and that functionality seems to be embedded in the AuthenticationHelper.ForgottenEmailRequest function.

0 votesVote for this answer Mark as a Correct answer

42 Rio answered on January 23, 2019 14:52

I've got it working with:

AuthenticationHelper.SendPasswordRequest(usr, SiteContext.CurrentSiteName, "LOGONFORM", SendEmailFrom, "Membership.ChangePasswordRequest", null, AuthenticationHelper.GetResetPasswordUrl(SiteContext.CurrentSiteName), returnUrl);

Thank you!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.