Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. But I want to remove the features of Sign up and Forgot Password modules.

For removing sign_up, In config/routes.rb file using skip option like,

devise :users, :skip => :registration

It removes the sign_up module also truncated path generation. This is fine.

But the same way, if I include this option for 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..

like image 887
Ranjith Avatar asked Apr 11 '14 09:04

Ranjith


People also ask

How do I change the password for a mailer in rails?

Fire up a Rails server and visit http://localhost:3000/rails/mailers/user_mailer/welcome_reset_password_instructions. Click on the reset password link within your mailer. You should now be redirected to Devise’s Change Password page instead of the log in page.

What is devise in rails authentication?

When we are talking about authentication in Rails, Devise is our go-to gem that is providing easy and flexible authentication. We won’t be going into depth about the Devise today.

How can I Make my Rails User sign in securely?

In its simplest form, you want your user to be able to sign up, log in, and log out securely. You could rely on Rails’ built in method has_secure_password to provide that functionality, but then you’re required to add necessary password validations and helper methods yourself. And what if your user forgets their password?

How can I use devise with previous versions of rails?

If you need to use Devise with previous versions of Rails, you can always run "gem server" from the command line after you install the gem to access the old documentation. There are a few example applications available on GitHub that demonstrate various features of Devise with different versions of Rails.


1 Answers

I got the answer,

In Devise model class remove the devise :registerable, :recoverable option.

Also do the changes in devise/shared/_link.html.erb by deleting the path generation links of sign_up and forgot_password

like image 89
Ranjith Avatar answered Oct 21 '22 06:10

Ranjith