Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anders Schmidt 76 posts 207 karma points
    Dec 12, 2013 @ 00:47
    Anders Schmidt
    0

    Password recovery, membership provider.

    I am having big time trouble in creating a password recovery. Somehow the asp.net password recovery. So I have tried to make my own. My problem is to recive or create new password.

    My code:

    @{
    
        var message = string.Empty;
        var memberMail = string.Empty;
    
        //POSTBACK HANDLER
        if (Request.HttpMethod == "POST")
        {
            memberMail = Request["Email"] ?? string.Empty;
    
            Member currentMember = Member.GetMemberFromEmail(memberMail);
    
            if (currentMember != null && currentMember.Id > 0) 
            {            
                // 1
                currentMember.ChangePassword(currentMember.GetPassword(), "newnew"); 
    
                // 2
                var newPass = Membership.ChangePassword(currentMember.ResetPassword(), "newnew");
    
                // 3
                string password = currentMember.GetPassword();
                message = "your password is " + Server.HtmlEncode(password);
    
                // 4.
                string newPassword = Membership.GeneratePassword(6, 2);
                currentMember.Password = newPassword;
                currentMember.Save();
                message = newPassword;
    
            } 
            else 
            {
                message = "not found";
            }
    
         }
    
    }

    As you see I have been trying multiple solutions.

    My webconfig is set like this:

            <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" defaultMemberTypeAlias="uBlogsySubscriber" passwordFormat="Hashed" />
    

    It is an Umbraco  v 4.11.10 running uBlogsy package.

    Thanks

     

     

     

Please Sign in or register to post replies

Write your reply to:

Draft