Ruby On Rails - log in & out and send confirmation emails, devise, gmail

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video i'm going to show you how to um add the login logout and email confirmation functions to your ruby on rails application i am using rubymine as an ide we have rails version 6032 and i will be using the device a gem and gmail account to do the email confirmation so let's create our application this is probably going to take a couple of minutes so i'll be back when it's done so now we have our rails application if we run this application we will be able to visit the localhost list refresh on the social another tab local house 3000 you are on rails so everything is working fine until now so we find ourselves directly in the gem file we need to add that device gen it is and we need to install this stream by running bundle install fantastic then rails g for generate device install and here tell us what we have to do next so we have to go to config environments development with rb and write this down under action mailer exactly here this will allow allow us to do to uh to send emails from our development environment after that we have this is not very important telling us to have a root um route it's not super important right now so make sure you have flash messages we have to copy these classes in our app view layouts application.html.rv and after that we have to generate our tables so rails g device user module sorry model user one user not users with a capital u so we have now our migrations ready oh i typed g okay so we have now let's come on here you are now we have our migration ready and we have to uncomment confirmable here these that means we are adding these columns to our table confirmation token um or token confirmed add confirmation sent ad and unconfirmed email after that we have to run rails db great so this one like will create our schema very good there it is after that we have to go to user dot rb and copy this right here all right now we have to tell device which email it should use when it tries to send emails so we have to go to environment dot rb you can find it here under config environment and you have to paste this here exactly let's add ctrl l to refactor everything to reformat everything you want to say and here you have to write your email and your password the email's password i'm going to do that and i will be right back when i'm done now i have wrote my email and my password in the environment.rb now we have to do one more thing about our email account our gmail account so we have to visit this url i'm going to write it down in the video description that here it is so you have to go to this url and allow the secure apps and you have to turn this on after that you will be able to send emails this is a security feature from google so now if we run our application okay let's try to refresh this page it's working if we go to users sign up this is our email we're going to sign in with or sign up with [Music] let me copy it put the password sign up so if you can remind the console we will see that it tells us that added an email to the database and it this is the basically the email that it sent so if everything worked fine we should now receive an email here it is welcome you can confirm your account here by clicking here you will confirm your email so if we try now to sign in with this email get the password which you have to confirm your email address before continuing confirm my account let's try to log in again and wherever thank you guys for watching if you find this helpful please give a like
Info
Channel: yossef N
Views: 1,387
Rating: undefined out of 5
Keywords: #rails, #rubyOnRails, #devise, #webDevelopment, #emailConfirmation, #rubyMine
Id: Gxq2KHxq0H0
Channel Id: undefined
Length: 8min 8sec (488 seconds)
Published: Fri Sep 04 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.