设计,允许用户更改密码 [英] Devise, allowing users to change passwords

查看:154
本文介绍了设计,允许用户更改密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序具有自定义注册控制器,称为users_controller,用于设计,因为只有管理员才能创建用户。我想允许用户通过输入旧密码并输入新密码来更改密码,我发现: https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-password ,但它不足够细节。

I have an application that has a custom registration controller, called users_controller, for devise because only Admin is able to create users. I want to allow users to change their password by entering their old password and entering a new one and I found: https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-password but it does not give enough detail.

我需要放在我的路线上?

What do I need to put in my routes?

我需要放在哪里在我的意见中?

Where and what do I need to put in my views?

推荐答案

如果您有设计模型用户,可以使用此路径路由到更改密码页面。

If you have a devise model User, you can use this path to route to the change password page.

edit_user_registration_path

只需在您的视图中使用:

Just use this in your view as:

<%= link_to 'Change Password', edit_user_registration_path %>

这应该是诀窍,它适用于我。

This should do the trick, it works for me.

这篇关于设计,允许用户更改密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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