【问题标题】:reset password with orchard not updating果园未更新时重置密码
【发布时间】:2014-01-14 14:52:56
【问题描述】:

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

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

感谢任何回复

【问题讨论】:

    标签: orchardcms orchardcms-1.6 orchardcms-1.7


    【解决方案1】:

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

    问题似乎来自于尝试修改密码时nonce为空,将用户重定向到主页。

    首先,我将 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 文件中添加该行。如果不这样做,您仍然会遇到此错误。

    【讨论】:

      猜你喜欢
      • 2020-10-25
      • 2012-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-07
      • 1970-01-01
      • 2014-07-10
      相关资源
      最近更新 更多