Email Verification In Node Js Part-B : Preparing to Send the Email

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
yeah welcome to the next section link to the preview section will be up here and also in the description below [Music] let's go ahead to create this function now from the first argument which is the result we want to destructor the id and also the email and we add a second object which is the response remember the id that we want is the one generated by moongodib and this is how it looks like now i want to create a variable to store the url that you'll be using in the email if the application has been hosted we will use that here otherwise you make use of localhost now for our string we make use of the user record id which came from the database and combine it with the uid package value now at this point we set our mail options the first property will be from and we'll set this to our email which is in the dot emv file [Music] the next one will be 2 and we set it to the email of the user which you are receiving here now for the subject we'll set it to verify your email [Music] now add an html property here we are making use of the backtext [Music] [Applause] now we want to make a spurs in cesaro's [Music] boat [Music] now for the link we'll make use of the a tag and set the href property to a combination of the url the id and the unit string now they use that for slash verify it's a route that will create later on [Music] [Music] now before we send the email we want to hash the unit string and store it in the user verification collection so we'll make use of bqt first we'll create a short round value the salt runs will make it harder to crack the hash to see the actual value [Music] so [Music] i always like to handle the error first so that i don't forget when there is an arrow you want to return a json object so let me copy the one here and make some changes for the harsh part we supply the unique string and the salt rounds now inside the den we receive the hashed unique string [Music] now once you have the hash unit string you want to create a new user verification record [Music] so over here we are making use of the user verification model that we created the first property will be the user id [Music] and that will point to the id that we have here the next one will be the unique string and we'll use the hashed one [Music] now for the created art we'll make use of the current date so record it dot now for the spy set add six hours as we stated in the message and six hours in milliseconds is 21 million six hundred thousand so we'll do that once we have this we can go ahead to save it once again you handle the catch first [Music] foreign now at this point we've been able to save the user verification record now we send the email using the transporter [Music] we'll pass the mail options [Music] bye now at this point the email has been sent and also the verification record has been saved [Music] now for the status because we are not done with the process we make it pending [Music] and that's all for this section we proceed in the next one please leave a like and subscribe for more to the point good
Info
Channel: ToThePointCode
Views: 14,061
Rating: undefined out of 5
Keywords: node js, node js developer, web app hosting, nosql database, cloud database, mongodb, mongodb compass, data warehouse is, google sign in, google account sign in, google login, mariadb, app hosting, install mongodb, mongodb pricing, aws mongodb, google account sign up, google account login, google sign up, redis, datastream, nosql, mongodb cloud, cheap cpanel hosting, top hosting providers, cheap wordpress hosting, ms in computer science, frontend mentor, js node
Id: XqOIjQ78oJA
Channel Id: undefined
Length: 9min 34sec (574 seconds)
Published: Tue Aug 24 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.