-->

重置密码与果园没有更新(reset password with orchard not updati

2019-10-19 05:19发布

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

在服务器上更新此功能后,用户现在可以请求丢失密码的电子邮件发送给他们,让他们改变自己的密码。 这一切工作正常,不过新密码不生效。 与旧密码仍然有效? 为什么是这样?

感谢您的回复

Answer 1:

我只是有这个问题。 我使用的果园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"])

这保证了发布新密码时,随机数被传递回修复该问题。

希望这可以帮助。

编辑:请不要忘记,你需要添加一行在你的主题LostPassword.cshtml文件中。 如果你没有,你仍然有此错误。



文章来源: reset password with orchard not updating