Implement Forgot Password functionalilty in Sitefinity appli

Posted by Community Admin on 03-Aug-2018 13:15

Implement Forgot Password functionalilty in Sitefinity application

All Replies

Posted by Community Admin on 05-Sep-2011 00:00

Hello,

I am developing an application where I would have to implement a functionality for Forgot Password. I dont want to use Reset Password feature of sitefinity.I would have to make it dynamically. My scenario is to send an email to user email id when he/she clicks on Forgot Password link. User will click on the link in email and custom page will be opened in new window. In this window, user can enter new Password and submit it. So that password will be set with user defined new Password in the database table.
 
In Sitefinity, there are methods for changing password and reseting password however in method ChangePassword(), user needs to know old Password.Here I need to pass old password, have tried to get old password also of user but it is not returning password in simple text. If I get old password with simple text format then also I can use changePassword() method by passing old password and new password as a parameters for this scenario. Please let me know if this approach works and how could it be acheived with old password.

 In method ResetPassword(), users don't have option to set his/her password. So both methods are not useful for Forgot Password scenario.


I have checked with multiple posts in Telerik forum but no suitable solution is available for it. Please let us know about the approach so that we could achieve solution.
Your support will be great help. Awaiting for your reply.

Regards,
Jesse

Posted by Community Admin on 08-Sep-2011 00:00

Hello Jesse,

There's several things that you'll need to take into account in order to achieve the described scenario.

1. The PasswordRecoveryForm control can be used separately like this:

<sf:PasswordRecoveryForm runat="server" AllowSelectMembershipProvider="true">
                           <MailDefinition From="passwordRecovery@noreply.com"
                             Subject="Password Recovery" IsBodyHtml="true" />
                       </sf:PasswordRecoveryForm>

However, if the password is not stored in clear, or encrypted format, Sitefinity will not be able to retrieve it, so it will reset the password and send you the new one on the provided email. Please take a look at the attached screenshots demonstrating two important settings that you'll need to configure if you'll be usign the out-of-the box PasswordRecoveryForm - the password format should be set to different than Hashed, and also you'll need to set enablePasswordRecovery to "true". If you'll be developing a user control to handle this functionality, you can still call:

password = user.GetPassword();

The default implementation is looking for a user by his/her username, however if you prefer on using email, you can still do something like:

UserManager manager = UserManager.GetManager();
            var user = manager.GetUserByEmail("e@mail.net");
            var password = user.GetPassword();
            var message = EmailSender.CreatePasswordMail(manager.Provider.Name, user.UserName, password);
            var emailSender = EmailSender.Get();
            emailSender.TrySend(message);


I hope you find the above information useful, if you need any further assistance in implementing the desired functionality, or have some additional questions, please do not hesitate to get back to me. I'll be glad to assist you further.

Regards,
Boyan Barnev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Posted by Community Admin on 04-Jan-2012 00:00

Hi I have done following code implementation in my project and I am getting following error.

Server Error in '/' Application.

The parameter 'from' cannot be an empty string.
Parameter name: from

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: The parameter 'from' cannot be an empty string.
Parameter name: from

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[ArgumentException: The parameter 'from' cannot be an empty string.
Parameter name: from]
   System.Net.Mail.MailMessage..ctor(String from, String to) +1488865
   Telerik.Sitefinity.Web.Mail.EmailSender.CreatePasswordMail(String recoveryMail, String userMmail, String userName, String password, String subject, String body) +317
   Telerik.Sitefinity.Security.Web.UI.PasswordRecoveryForm.AttemptSendPasswordUserNameView() +1235
   Telerik.Sitefinity.Security.Web.UI.PasswordRecoveryForm.AttemptSendPassword() +60
   Telerik.Sitefinity.Security.Web.UI.PasswordRecoveryForm.OnBubbleEvent(Object source, EventArgs e) +90
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +125
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

Please can you guide me what is an issue.

Regards,
QainanIdris.com

Posted by Community Admin on 04-Jan-2012 00:00

Hello Qainan,


Can you please check your SMTP  settings under Administration->Settings->Advanced->System and check if you have filled the default sender address, which is required parameter for Sitefinity to be able to send emails. If any issues persist, please let us know, we'll be glad to help further.

Greetings,
Boyan Barnev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 05-Jan-2012 00:00

Hi Boyan,
Thank you very much. It's working fine.
Regards,
Qainanidris.com

This thread is closed