Last chance to get discounted tickets to Codegarden... Price goes up on Tuesday at 20:00 CEST!

Copied to clipboard

Flag this post as spam?

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


  • Jack 3 posts 73 karma points
    Apr 02, 2017 @ 11:11
    Jack
    0

    Hi All

    Is there a way for Umbraco members to self-serve their password resets? (Without a website admin having to do it for them)

    I have looked at various tutorials and forum posts and cant seem to find a definitive answer.

    Any help on the subject would be great

    Jack

  • Alex Skrypnyk 4468 posts 16007 karma points MVP admin
    Apr 02, 2017 @ 15:35
    Alex Skrypnyk
    100

    Hi Jack

    You need to create surface controller or api controller on backend code and form for members.

    Try to look at this method:

    [HttpPost]
    public ActionResult HandleUpdatePassword([Bind(Prefix = "passwordModel")]UpdatePasswordModel model)
    {
        try
        {
            if (ModelState.IsValid == false)
            {
                return CurrentUmbracoPage();
            }
            var memberService = Services.MemberService;
            var member = memberService.GetById(AppHelper.GetCurrentUserId());
            memberService.SavePassword(member, model.Password);
            TempData["UpdateSuccess"] = true;
        }
        catch { }
        return CurrentUmbracoPage();
    }
    

    It basically do what you need, adopt this code for your needs and it will work.

    Read more about memberService, it has a lot of methods for working with members:

    https://our.umbraco.org/documentation/reference/management/services/memberservice

    Hope it will help.

    Thanks.

    Alex

  • Alex Skrypnyk 4468 posts 16007 karma points MVP admin
    Apr 05, 2017 @ 10:19
    Alex Skrypnyk
    0

    Hi Jack

    Did you find out how to do your task?

    Thanks,

    Alex

  • Tim Powers 1 post 71 karma points
    Feb 16, 2018 @ 23:32
    Tim Powers
    0

    Hi there,

    Just wondering whether/how I'm able to add this without using Visual Studio? The Umbraco installation is already deployed and this is an additional functionality. Working on this project has shown me just how little I know about Umbraco!

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft