reset password with orchard not updating

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-05 04:52:08

问题


Using Orchard 1.6. In the settings section in the Dashboard I have enabled 'Display a link to enable users to reset their password'

After updating this feature on the server the user can now request a lost password email be sent to them which allows them to change their password. This all works fine however the new password does not take affect. and the old password still works? why is this?

thanks for any replies


回答1:


I just had this issue. I am using Orchard 1.7.

The problems seem to come from the fact that the nonce is null when trying to modify the password, redirecting the user to the home page.

First, I modified the Orchard.Users.AccountController LostPassword controller to look like this :

 public ActionResult LostPassword(string nonce) {
        if ( _userService.ValidateLostPassword(nonce) == null ) {
            return RedirectToAction("LogOn");
        }
        ViewData["nonce"] = nonce; //add this line
        ViewData["PasswordLength"] = MinPasswordLength;

        return View();
    }

Then, you need to modify the LostPassword.cshtml and add this line within the form :

@Html.Hidden("nonce",ViewData["nonce"])

This assures that the nonce gets passed back when posting the new password and fixes the issue.

Hope this helps.

Edit: Don't forget that you need to add that line in your theme's LostPassword.cshtml file as well. If you don't you will still have this error.



来源:https://stackoverflow.com/questions/21116542/reset-password-with-orchard-not-updating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!