Authentication in ruby on rails
Hello Friends. Till now we have seen to setup a basic application and applying validations in previous articles. Now lets implements the authentication in our application.
For authentication, we will be implementing devise gem. This gem is rich of modules related to authentications, such as:
Add following in Gemfile and run bundle install
gem 'devise'
After running bundle install you can see changes in models/user.rb file
Modify the routes.rb file as follow:
Now when you run the server and visit http://localhost:3000/ , you will be redirected to sign in page as shown in following screenshot:
On clicking signup link you will be able to navigate to signup page as shown below:
Similarly you can try to access forgot password page and also try to sign up and sign in.
Further we will be aiming to add some design and authorisation to the records that we will add. Till then enjoy and cheers!