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..
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.
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.
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?
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With