Copied to clipboard

Flag this post as spam?

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


  • GianniDPC 14 posts 80 karma points
    Jan 31, 2020 @ 14:32
    GianniDPC
    0

    ChangePassword always returns true even if the old password doesn't match the current one

    Hello,

    I'm having a problem using the ChangePassword method on the MembershipHelper class.

    Even when the old password the user entered doesn't match his current password the method will return true. Is this expected behaviour? Or is this is a bug in Umbraco?

    Otherwise why should we pass the old password even though it let's you change the password even if it doesn't match the old one.

    public ActionResult ChangePassword(WijzigWachtwoordViewModel viewModel)
    {
        if (ModelState.IsValid)
        {
            ChangingPasswordModel changingPasswordModel = new ChangingPasswordModel
            {
                NewPassword = viewModel.NieuwWachtwoord,
                OldPassword = viewModel.HuidigWachtwoord         
            };
    
    
            var res = Members.ChangePassword(Members.CurrentUserName, changingPasswordModel, Constants.Conventions.Member.UmbracoMemberProviderName);
    
            if (!res.Success)
            {
                ModelState.AddModelError(string.Empty, "Kon WW niet wijzigen.");
                return CurrentUmbracoPage();
            }
    
            return Redirect("/");
        }
    
        return CurrentUmbracoPage();
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft