How to Create a Complete Login and Forgot Password System in VB.NET using SQL Server Database?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's going on guys this is Madonna welcome to the new video tutorial in this video tutorial I'm going to show you how to create a complete login in forget password system in vb.net using SQL Server database that means if you forget your faster you can easily change your password using this system actually this video covers couple of perfect like how to create login form in vb.net using SQL Server database how to send an email using vb.net and then how to generate random number in BB dotnet and finally how to update the database data using vb.net so without any further more explanation let's do it open up visual studio go to file click on new and then click on project select a visual basic under the Neath of Visual Basic select windows windows form application and give the name of your project and then click OK now expand that form little bit and then from the toolbox drag and drop some controls like labels to levels for username and password through text box and then one botton now since the property is likely its label and change their tags here goes user name and then here goes password you can also increase the font of this label so go to Khan property and then you can give the size over here now select the text box and we need to change the textbox name so that we can remember while writing the code so here it goes txt user here it goes txt Pass and here goes BTN login and says the takes of this button here goes login and drag and drop one more label and place below the login and keep the takes Ed's forgot password and then see it now we need to change the cursor so that when the user moved your mouse over these are forgot password the hand should be displays so change the cursor from default to and and go to phone and underline this password - there you go now we just create a simple login form now we need to create a database in here server so open up SQL Server management studio right click about database click on new database and give the database name and then click okay now expand that database nudity scroll down and find the recently created database or going to expand that database right Coleco bar table click on table here column name goes to user name and data type must be bare care and PA SS w rd bear care face ctrl + s premier keyboard and give the table lamp login forget click ok now I can expand that table directly right click over recently created table click on in the top 200 rows we need to ensure some username and password over here like TSN email as cd-r n and the password is 1 2 3 I am using such an easy a password into debits to you but you should not use such an easy password in your system so simply close this window it will automatically save a reason event password now go back to visual studio right-click over your project there we are going to add two more form so third goes same core and one more form now go back to same core form and expand that form from the tool box drag and drop some controls like labels to labels and then to text box and then to button now select that label and her say the text into email here Goods inter code and then button we are good sent her goes verify now select the text box and change the text box name like hair goes txt email and here goes txt verify now the basic mechanism in this forget password system is when the user entered your registered email a this in this text box and then click that same button what we are going to do internally is we are going to generate own a random number and send that random number into their email and we are going to display on message box saying that please check your email and enter that code into the flowing inter code text box now when the user entered the code in these inter code text box and click that verify button what we are going to do is we are going to check whether the user enter the exact same code that we send into their email at this or not if the user in turn code is a mess with the code that we send in their email we are going to open the reset form this one form in this form they can reach her their password and otherwise we are going to display the message saying that wrong code now here you need to understand two things first one if the user entered the email it is whether than the registered email address they cannot reset their password even though they enter the exact same code that we say neither email because we will check their email address in this reset form and the second one is you may ask why we need to verify the user that means why we need to enter the code and verify because anyone can try to reset your password if we remove this verify section from this program so let's do it now double click this button and before writing the code we need to import some namespace so imports system dot net imports system dot dot mail now enter the class when you define some global variables or deem random core is string and then public seer to user is sting which defined random code is a global variable because we are going to exist this variable value in the another button clicking event that is in this verify button clicking event to check whether the user enter the exact same code that we send into their email are not and to user variable both public ends here we make this variable public because we are going to exist the user interval a this from another form that is a decide form so we are going to pass the user interval a this into the ready set form so we need to make this variable public so that we can exist the variable from another form and share also in visual basic share means static that means we do not need to create the object of this class in order to initialize this variable one more thing this variable is store one and only one value over the execution of this program so let's write the code inside the clicking event of this button here I am going to define some variables or deem from pass masses body is string and we are going to use the random class or deem brand is random is equal to do random now we are going to generate a random code and stood that random put in the random code variable so random code is equal to rent . next in the boundaries nine nine nine nine nine nine which we're going to isn't random number from zero to nine nine nine nine nine nine and we need to convert this into strings to string now we need to use the mail message class in order to send the mail from the BB dotnet so theme message is mail message it's equal to new mail message now we are going to take the input from the user so two user is equal to txt email dot txt now you need to provide the email a this from which you are going to send the email to the user so from is equal to G mail.com now in to provide the password of this email so pass is equal to let me copy the password there you go now the message body is masses body is equal to your preset code each plus random code now we need to add the message so message dot 2.82 user now we need to specify from where we are going to send the message so message word from is equal to new mail address here was from and we need says the message body so message dot body is equal to message body you and you can also write the message subject so message dot subject is equal to pass or a resetting core and we are going to send the message through the SMTP client that means Simple Mail Transfer Protocol so theme SMTP is SMTP client is equal to new SMTP client and SMTP we are going to send the message from the Gmail so smtp.gmail.com now we need to enable the SSL so SMTP dot enable SSL enable secure socket layer is equal to true we need to specify the port so SMTP dot fork is equal to generally 587 is used and we need to specify the delivery method so so SMTP dot delivery method is equal to SMTP or delivery method dot network we are going to say in the mail to the user from this networks or network SMTP dot you network credentials in our trading tales are from and password now fry we are going to use try an catch exceptional learning over here so try SMTP dot sin message and we need to the message box to the users of message box dot so please check your email and enter the code in the inter core text box and in the Katz exception message box thought so exception dot message that's it it now this much up core can send the email to the user and we are going to send the addendum code that means resetting code into their email now go back to the design double-click that verify button we are going to think whether the user into the exact same code that we said in their email are not so in order to do so if txt verify dot text dot equals random core what we need to do is we need to display the another form so deem reset is reset is equal to new reset we are going to create the object of this rigid form and reset dot so and dim as C is send code is equal to new same core SC dot height we are going to add this same code form and one more thing what we need to is we need to transport the user interval a this into the reset form so in order to do so to user is equal to t xt email dot txt now if the user enter code is not a match with the code that we send into their email what we need to do is we need to display the message to the user saying that else message box dots so or wrong code that's it now go to the reset code and here we need to drag and drop some controls so two levels - textbox in one button now slick this level here goes new password here it goes very high password here goes txt there pass or txt verify new pass or the hair goes reset now double-click this and we need to import some namespace imports system door data impulse system door data dot SQL slides now we need to connect this application with our database so go to server Explorer right click about data connection click on new connection and is the datasource to SQL Server and give your server name and slick the database in the like ok now click that decently connected data connection and go to the property of that data connection and simply copy that connection string now here we need to connect this application with the database so here goes beam connection is SQL connection is equal to new SQL connection and here goes the connection sting so place that connection is sting and deem CMD is SQL command is equal to new SQL command now here we need to write the update coil now go back to SQL Server right-click over that table and click on script table is update to new query and simply copy that SQL query go back to visual studio place that query now here the if the name is single quotes inside two single girls two double quotes inside the double girls two plus signed before passing the code we need to capture the username that the user entered in this same code so we need to capture that user entered emailing this into this reset so here deem user damn is string is equal to send Corps dot to user now here we can use that username and passwords single quotes inside two single cuts to double course inside the double girls two plus sign txt verify new password dot text in the condition is where you see them is equal to two single quotes to double course two plus sign and username that's it now here goes connection now we need to open the connection so connection dot open we need to execute this SQL query so CMD dot execute non wily and there which it is fill the message to the user so message box dot so password reset it successfully here goes information and then message box button dot okay message box icon dot information we need to close the connection so connection dot clothes you that's it now go to the forum one now we'll double click that login button and we are going to write the code in order to login into the system so we input some namespace import system dot data imports system door data dot SQL clients now inside the clicking EBIT of that button deem connection is SQL connection is equal to new SQL connection now simply paste that connection listing so copy and then paste deme CMD is SQL command is equal to new SQL command and here what we need to write is select all from our table lamp that is forgot login where username is equal to single quotes inside two single quotes 2 plus inside two double single quotes 2 plus sign a hair bows txt user dot takes and password is equal to two single quotes inside two single quotes - double quotes inside - double goes to plus sign and here goes txt past dot txt and here goes connection theme sta is SQL data adapter is equal to new SQL data adapter and here good common now we need to use one more class for theme DT is data table is equal to new data table now we need to fill the STS osta dot fail there goes DT and now we need to take if DT dot rows dot count is greater than zero means the if user enter username and password match with the database username and password what we need to do is in to display the message to the user message box dots so login success otherwise else messes box dot so either now go back to form one and double click that a further episode when the user click that forward parcel you need to display this form so double click and here goes team SC is st. code is equal to new same code as C dot so the form is form one is equal to new form one and we need to hide this form so f dot hide so that's it to save it now run your program now we are going to check our system is step by step so TSN and the password is killing local message logging success so but we got some error 'invalid of the curves let me take our table M log in forget but what we give login forget logn frjt so simply save it again n again run it please lovely message say display login success if you enter with our then this is an L password message display either now click that forget password now enter the email address over here when you click the send button what internally this program do is in generate a random number and send that random number into this email address so click that st. message is displayed please check your email and enter the code in the inter code text box okay now check your email inbox there you go the resetting code is this one simply copy this core and go back to your program and enter that code before entering the correct code I am going to check the wrong code so click verify this is a different long code there you go now enter the exact same code and click verify and this reset form is display now enter the new password but people writing the new password I forget to do one thing so simply or disturb that program and go to the reset so here inside the clicking event of this button what we need to write a we need to check if txt verify pass dot text dot equals T XT verify new password or text if the user enter password in these two text box are exactly the same we need to reset the password otherwise we need to display the message saying that please enter the same password in the two text box so then on this one and here is message box dot so there you go but we got some heater here here in this there you go so simply start your program I only show the login page so click on forgot password and here goes TSN and then click send before doing this when you enter the email in dissin click that sign button you may got some error so in order to resolve that error go to your email and that we give in our program and go to the manage your account and go to the security and it scroll down and what you need to do is you need to enable the less secure if X is 2 on so that you can login into your email ladies from the pijl basic so go back to the your send code click that send button now let's check your email inbox here if you do not enter the exact same email address you may get this year your message was not delivered to this one because the domain gmail.com could not refund so we need to enter the exact same email format so I forget to write I here click send the message to display this one now go to your email and refresh your email there you go we get a new port simply copy that and click that verify button now here if I enter the defend of password message to display please enter the exact same password into text box and Here I am going to write run one two three row on one two three and click reset message to display password reset it successfully but we got some meter over here incur X and X okay you you oh now we can run it over password click send you since successfully now I can let's take another code simply copy and paste click verify click reset password reset it successfully now lipstick or password reset it or not so before we have the password of one two three now we should have the updated passer there you go you're on one two three now let's login into our system so simply instead of it again run it and here goes TSN email our say we are aids al.com and password is non one two three message to display lock success if I enter the old password eater so that's it in this video tutorial guys if you like these videos share this video with your friends so that they can know about this forget password system and give thumbs up which really motivates us to clear such programming video and is to connect through this channel in order to extend connect to do with this channel in to subscribe this channel so subscribe this channel and thank you once again for watching this video have a good day bye bye
Info
Channel: RunCodes
Views: 14,653
Rating: undefined out of 5
Keywords: create forgot password in vb, how to create forgot password in vb, how to create forgot password in vb using sql server database, how to create both login and forgot password in vb, forgot password system in vb, forgot password source code vb, forgot password system source code in vb, how to create login form in vb using sql server database, how to create login form in vb usig database, how to make forgot password in vb, forgot password in vb.net, forgot password system in vb.net
Id: tmC_uQMH86Q
Channel Id: undefined
Length: 34min 1sec (2041 seconds)
Published: Sat Nov 23 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.