Copied to clipboard

Flag this post as spam?

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


  • MC 19 posts 89 karma points
    Feb 18, 2014 @ 21:13
    MC
    0

    Please Help Implementing Forgotten password

    I have been working on the Forgotten Password using razor. here is my code 

    1. [HttpPost]
    2.         [Authorize]
    3. [ValidateAntiForgeryToken]
    4.         public ActionResult HandleForgottenPassword(ForgottenPasswordViewModel model)
    5.         {
    6.             if (!ModelState.IsValid)
    7.             {
    8.                 return PartialView("ForgottenPassword", model);
    9.             }
    10.             //Find the member with the email address
    11.             var findMembername = Member.GetMemberFromEmail(model.LoginName);
    12.             var findMember = Member.GetMemberFromEmail(model.EmailAddress);
    13.             if (findMember != null)
    14.             {
    15.                 //We found the member with that email
    16.                 //Set expiry date to 
    17.                 DateTime expiryTime = DateTime.Now.AddMinutes(15);
    18.                 //Lets update resetGUID property
    19.                 findMember.getProperty("resetGUID").Value = expiryTime.ToString("ddMMyyyyHHmmssFFFF");
    20.                 //Save the member with the up[dated property value
    21.                 findMember.Save();
    22.                 //Send user an email to reset password with GUID in it
    23.                 EmailHelper email = new EmailHelper();
    24.                 email.SendResetPasswordEmail(findMember.Email, expiryTime.ToString("ddMMyyyyHHmmssFFFF"));
    25.             }
    26.             else
    27.             {
    28.                 ModelState.AddModelError("ForgottenPasswordForm.", "No member found");
    29.                 return PartialView("ForgottenPassword", model);
    30.             }
    31.             return PartialView("ForgottenPassword", model);
    32.         }
    When i do debugging i got an error line 23  findMember.getProperty("resetGUID").Value = expiryTime.ToString("ddMMyyyyHHmmssFFFF");  is null, I have no crue whats wrong?!. 
    here is my web.config 

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

    Please some body help me to understand that.
    Thanks in advance!

  • Simon 692 posts 1068 karma points
    Jul 28, 2015 @ 12:26
    Simon
    0

    Hi,

    Have you got the solution please?

    Thank you.

    Kind Regards

  • Steve Morgan 1346 posts 4453 karma points c-trib
    Jul 28, 2015 @ 12:35
    Steve Morgan
    0

    Hi Simon,

    Have you taken this code from some other project / or off the internet?

    It looks like you need to add a custom member property (like when you add a bit of data to a doc type) called resetGUID so that Umbraco has somewhere to store this against the member.

    For the forum to be able to help you might have to give us a bit of background rather than a code dump - this

    Steve

  • Simon 692 posts 1068 karma points
    Jul 28, 2015 @ 12:39
    Simon
    0

    hi Steve,

    that code is not mine.

    I am trying to get a Reset Password functionality within my umbraco website.?

    Do you know with something for Umbraco 7.2.X in order for the user to have forgot password functionality?

    thank you.

    Kind Regards

  • Steve Morgan 1346 posts 4453 karma points c-trib
    Jul 28, 2015 @ 13:09
    Steve Morgan
    0

    Hi,

    It's usually up to the developer to roll something. It's not trivial to do this properly as you'd need to send an email with a link (with a one time use GUID).

    It's hard to recommend something without knowing your skill level - I haven't seen a member package that does everything if that's what you mean.

    If you're happy to write a bit of code you should be able to get some ideas from here:

    https://github.com/warrenbuckley/CWS-Umbraco-Standard-Membership

    Kind regards

    Steve

Please Sign in or register to post replies

Write your reply to:

Draft