1

使用果园 1.6。在仪表板的设置部分中,我启用了“显示链接以使用户能够重置密码”

在服务器上更新此功能后,用户现在可以请求向他们发送丢失的密码电子邮件,以便他们更改密码。这一切都很好,但是新密码不会生效。旧密码还能用吗?为什么是这样?

感谢您的回复

4

1 回答 1

0

我刚遇到这个问题。我正在使用果园 1.7。

问题似乎来自这样一个事实,即尝试修改密码时随机数为空,将用户重定向到主页。

首先,我将 Orchard.Users.AccountController LostPassword 控制器修改为如下所示:

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

        return View();
    }

然后,您需要修改 LostPassword.cshtml 并在表单中添加这一行:

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

这可确保在发布新密码时将 nonce 传回并解决问题。

希望这可以帮助。

编辑:不要忘记您还需要在主题的 LostPassword.cshtml 文件中添加该行。如果不这样做,您仍然会遇到此错误。

于 2014-02-20T02:44:10.793 回答