重置密码,果园未更新 [英] reset password with orchard not updating

查看:72
本文介绍了重置密码,果园未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用果园1.6.在控制台的设置"部分中,我启用了显示链接以使用户可以重置密码"

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?

感谢您的答复

推荐答案

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

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

问题似乎来自以下事实:尝试修改密码并将用户重定向到首页时,随机数为null.

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.

首先,我修改了Orchard.Users.AccountController LostPassword控制器,使其看起来像这样:

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();
    }

然后,您需要修改LostPassword.cshtml并将此行添加到表单中:

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.

希望这会有所帮助.

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

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.

这篇关于重置密码,果园未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆