简体   繁体   English

Rails - Devise Gem删除注册和忘记密码模块

[英]Rails - Devise Gem remove Sign up and Forgot Password modules

I work Rails 4 with Devise gem for User authentication, In my project also working fine with Devise gem. 我使用Devise gem工作Rails 4进行用户身份验证,在我的项目中也可以正常使用Devise gem。 But I want to remove the features of Sign up and Forgot Password modules. 但我想删除Sign upForgot Password模块的功能。

For removing sign_up , In config/routes.rb file using skip option like, 要删除sign_up ,请使用skip选项在config/routes.rb文件中,

devise :users, :skip => :registration

It removes the sign_up module also truncated path generation . 它删除了sign_up模块也截断了path generation This is fine. 这可以。

But the same way, if I include this option for Forgot password 但同样的方法,如果我为Forgot password包含此选项

devise :users, :skip => :recover   
     or
devise :users, :skip => :recoverable

it won't work. 它不会起作用。 I need to hide both modules in the same way of method. 我需要以相同的方法隐藏两个模块。

How to achieve this? 怎么做到这一点? Thanks in advance.. 提前致谢..

I got the answer, 我得到了答案,

In Devise model class remove the devise :registerable, :recoverable option. 在Devise model类中删除devise :registerable, :recoverable选项。

Also do the changes in devise/shared/_link.html.erb by deleting the path generation links of sign_up and forgot_password 还可以通过删除sign_up and forgot_passwordpath generation链接来进行sign_up and forgot_password devise/shared/_link.html.erb的更改

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM