Quantcast
Channel: Security
Viewing all articles
Browse latest Browse all 4737

How to allow unauthenticated users to reset password?

$
0
0

Hello everyone: This is an Update to my question below:

So far I am able to allow users to change their password but only if they are authenticated or logged into the application.
What I really need is for users to be able to get a link in an email. They can click this link and reset their password.

Example: Lets say a user forgets his or her password, they can visit a page which they can either enter security question and answer or their emaill address on file. They will then get an email with a link to reset their password.

All I have so far is this: Which allows only authenticated users to reset their passwords:

I do not want to use the Recovery Control which generates a password.

public void ChangePassword_OnClick(object sender, EventArgs args)
{

    MembershipUser user = Membership.GetUser(User.Identity.IsAuthenticated);

    try
    {
        if (user.ChangePassword(OldPasswordTextbox.Text, PasswordTextbox.Text))
        {
            Msg.Text = "Password changed.";
        }
        else
        {
            Msg.Text = "Password change failed. Please re-enter your values and try again.";
        }
    }
    catch (Exception e)
    {
    Msg.Text = "An exception occurred: " + Server.HtmlEncode(e.Message) + ". Please re-enter and try again.";
    }


Is there any tutorials out there, even a book that one can read to get this information?

Thank you for reading and helping.

JMan


Viewing all articles
Browse latest Browse all 4737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>