How to Create a Complete Forgot Password System in C#.NET using SQL Server Database?With Source Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what government guys this is me Don and welcome to the new video tutorial in this video tutorial I'm going to show you how to create a complete forget password system in DC's a.net so let's do it first of all open visual studio go to file click on new and then click on project select visual fish app and then select windows form application and give the name of here application and then click OK now expand this home little bill first of all we need to create a login form and then we need to add the forward password system so go to tools box and then go to common controls and drag and drop some text box over the form and then one button this one is for login and then one label third word labor now tells the property of his control txt user well good PFT pair change the button name - sorry button text - Gusev login and the label text - forgot password you can also drag and drop some label and change the level text - I'll go to user name and then he'll good password now it is this forward bastard now here you can get some property so go to font and you can underline this forward path to true and then again win the user move your mouse over forgot password you can also change the pointer type so here you may find the cursor and change the process to and there you go now we need user threebees forward passer we need to display new form another form so right-click overall solution sorry right-click over your project inside that solution and then click on add and then click twinges form and then give the name of that windows form is sent code then click Add now again here we need to drag and drop some contour so this one is text box and one button and another text box and then in the bottle now since the property of each control and I will explain why we are using this text box and button in this form so here it goes TFT email and here goes txt verify code and change the bottom text not go spin and sell good verify verify code now here the user entered the email edges in which they won to receive dog code and we write the code inside this click here event of this send button and when the user receive that code they need to provide the four that we sent in the email and we need to check whether that code the user enter in this text box match the code that we sent in the email if the user entered the code other than we send in their email we need to display your method and if the user into the correct code that we send in your email we need to display another form that is reset their password form so again we need to add another form so right click over that posit a click on add and then click on windows form and here goes a reset password click add and again in this form we are going to drag and drop some text box and then one to bottom so change the property it has both txt brace it pass your goals txt reset path verify and then fills the botton takes turbos receipt we have completed our designing part now we need to create one database in SQL Server so open of SQL Server and right-click over database click on new database and give the name of the database like for gate pass or then click OK now expand that database directly and find the database that you rigidly created forget password and again expanded forgot password or actually cobalt table and click on table now here goes the column name username and data type is bad care and indoor column name is password data type is bad cat and then delete or paste ctrl + s from your keyboard and give the table lamp and then click OK now we need to add some value in this table so X on that table again right click over there traditionally created table and click on TV top country rose now we need to provide some username and password over turn like and password and simply close this now go back to visually to do we need to coin this application with the database so click that server Explorer right click over data connection click on edit connection then change the data source to SQL Server and enter your server name here goes or you can physically be drop-down icon and click your database and then click OK possible we need to go to calm one dots here and window user click these forward pattern we need to display this strain curve on so double click - Bulbasaur now here goes send code SV is equal to new send code these dot hide we need to hide this form I am going to display another form that it sync or form dot so here window user click the forgot password label this form will be closed and this form will be display here the user enter the username or the email that they register to this application is a username and we are going to send the quote to this email so double click that same button and we are going to write some code inside that clicking a bit of the send button so we need to use some nemesis or barrier using system dotnet choosing system dot nate dot mil now here inside the class we are going to define some global variable like E string Rin Dom core and in the 1 public static string and - I will expand why I use this public and static cure here to define a variable now inside the clicking event of this button I'm going to define some local variable string from pass and message body now we are going to generate some random number in C sub there are two type a random number one is zero random number and another one is Chieko random number but we are going to use a pseudo-random number so we need to use the random class random friend is the call to new random and we are going to east or the generated random number in these random Col variables so here goes random code P is equal to rent dot next in the boundaries nein nein nein nein nein nein meet we are going to generate a number from zero to nine nine nine nine nine nine and we need to convert this friend a number two string so three strings currencies have dotnet we have one class which allows us to send the email to the user so we are going to use that class so mail message method is equal to new mail method now we need to take the user input that they enter in this text box so the name of this text box is tht male so 2 is equal to TX t email dot takes and we need to convert these easily into the Bala to the string so dot quiz string now we need to each specify the email from which we are going to send the email to the user so from oh here I give the variable name wrong variable M so from suppose from is equal to CF email sender is gmail.com in the password is Ricardo I created this email address for this purpose or TSN taste one two three this is the pastor of this email and the method body is message body is equal to your rigid code is the random number that is random code now we need to pass all the parameters to the mail message classes through is object that is Method dot too dot 1/3 1/2 that is the email that the user provided to all units we are going to send the code method dot from is equal to MU melodies that is from in the message body message dot body is equal to method body in the methods are subject subject is equal to Paso digit password is sitting core now we are going to send the email through the SMTP client that is Simple Mail Transfer Protocol client so SMTP client SMTP is equal to vo SMTP client and we are going to use the email to send the message so smtp.gmail.com now SMTP dot enable SSL is equal to 2 now SMTP dot 4 is equal to 5 8 7 generally fibered 7 port is used to save the email now SMTP dot d method is equal to SMTP delivery methods or net we are going to send the email for Network now SMTP dot ten TL is equal to new network credentials and we need to pass the parameter that it the email address from which we are going to send the message or mail in the password of that email so a good path now we are going to use to try and get access and handling over here SMTP dark and very good method that is the object of mail message class and we need to display the message to the users of method box dot to court in successfully get Christon exits on a message box dot toe yet dot method now this piece of source code will send the code to the user email now we'll get to the design of that form and here user enters that code and we need to verify that cool without the user enter the code that we think in your email or also double click that verify button now here we need to take a random code is equal to the name of this textbox what is the name of this tick box let me show you txt head course txt bad code dot txt we need to convert this to the string so the twisting - do we need to pass the user entered email to them another form so 2 is equal to txt emailed or text we need to pass the usual inter ml to this reset password form because we are going to update their password by considering their email so we need to pass that email to this in the form so that's why we are going to use this public static 15 Q in order to define these two variables public means this variable can be used anywhere in this project static me this variable it's the class variable not the instance variable so here so here if the user in Turku is math with the core that we send in your email what we need to do it we need to display this reset password from so reset reset password our P is equal to new reset password this dot height and our T dot so and if the user enter code is not math with the code that will send Indian email so what we need to do is L message box dot so wrong code now window either enter the correct code this phone will be closed in this richard passive form will be display now here usually enter the new password and he'll verify the new password and window user click the reset button the password need to be updated to the newer one so double click that reset button and here we are going to use some nemesis so in using system dot data using system dot data toward SQL client now inside the class let me define on variable username which is to the value that we send from strain code class that is two variables to then code dot to now go back to clicking event of that reset button and what we are going to do is we are going to take if txt reset pass dot text is equal to txt preciate pass verified or take if the user entered the same value in these two text box we need to order their password so third SQL connection con is equal to new SQL connection and simply pass the collection a string so select your data source from the property copies at colleagues on the screen and paste inside the class and here goes SQL command CMD is equal to new SQL command and here we are going to write the SQL query so go back to SQL Server right click over your table click on a script a table is and then click on update to new query simply copy that SQL query you go back to be delete to do place that yd now you only need to update the password nor the username so you can clear this username section and move this all takes in the single line now here we need to pass the pass or so to single goods inside to single girls to double quit inside to double goods to plus sign and here goes txt three straight path verify dot txt and where we need to pass a condition so well username is equal to single code inside to single goes to double click to plus sign and hair goes to username and then connection now we need to open this connection so connection dot open and then we need to execute the query so CMD dot execute non query now we need to close this connection connection dot close and finally we need to display the message to the user so message box dot so here goes reset successfully if the usual interval Oh in these two text box are not exactly same what we need to do it we need to display the message to the users saying that L methods box dot so the new password do not match so inter same password that's all now go back to form one dot here right click and go to bu designer now window users select direct login button we need to login to the application so double click that login button and here we are going to use some namespace so using systems or data using system depth data dot SQL client now go to the clicking event of that login button SQL connection con is equal to new SQL connection simply select your data source or P the connection E string and paste that connection resisting your SQL data adapter we are going to use SQL data adapter which it is a breeze between the data set in the SQL Server so s ba is equal to new as kill the deductr now we are going to write the Y resource click select all from the table and that is forgot to let me see the table M forward posture I click a stick from table lamp where username is equal to single code inside to single codes to double cross two plus sign here goes txt user dot text and password is equal to similar forces cell with txt pair dot txt and the connection now we are going to use another class that is data table the t is equal to new data table now we are going to fill that data a doctor s fill the director with the DT so SDA dot field that will be T now we need to think if DT dot Rose dot count is greater than zero me if the usual inter username a password matches the database username and password we need to display the message to the user so message box dot so here goes login lets you see CSS fu ll successfully for the wide l message box dot to Peter so that's all they bit now run it before running this application you need to do one more thing so go to your Gmail account setting and then go to security now e to enable let's take your f2 on so you can change the go to that email so click that forward pass or here provide the email in it we need to send the Corso and then click send message will display court in successfully code sent successfully now let's tick whether that core is a receive in that email inbox or not there you go that is one core received in that email to open that email simply copy that core go back to the application and paste it and let me show you if I enter a wrong code the message will display wrong for now let me enter the correct code and then click verify code that a reset password for made one now first of all let me show you the exact password so restore controls I'll choose the path of PS and now we are going to update that password and then click proceed next it should be split pre-state successfully now lipstick without these password that is wrong easy stroll in their database or not so let me go to SQL Server right click v12 20 Road possible let me close it it is top 20 rows very book the password is updated from TSN to run now here after resetting these password what we need to do is we need to do one more thing here we need to place only button after clicking that button user need to go back to the login form and login to this it because I'm so you let me stop it and go to reset password dot here right-click go to design and here I am going to place one button over here and the bottom take seed login now double click that login button and what we are going to do is we are going to transport the user to be login from so form one F is equal to new form one these dot hide F dot so and again run this application click there forgot password enter the email and then click send code will be sent to the email so let's take the email course and successfully now let's take the email another code should be received simply copy that code go that way vixen paste that code click on verify and then we already updated password so click that login login from display now enter the username see us email are severe it is email come in the password read Iran and then click login message to display login successfully so that's it in this video tutorial guys if you like this video share this video with your friends so that they can know about this useful tutorial give thumbs up which really motivates us to make such programming video and is taken accrue this channel in order to listing connected with this channel you need to subscribe this channel subscribe this channel and don't forget to press that bill icon because when I upload a new tutorial you will get the notification and thank you once again for watching this video have a good day bye bye
Info
Channel: TechSupportNep
Views: 18,514
Rating: undefined out of 5
Keywords: create forgot password in c#, how to create forgot password in c#, how to create forgot password in c# using sql server database, how to create both login and forgot password in c#, forgot password system in c#, forgot password source code c#, forgot password system source code in c#, login form in c#, how to create login form in c# using sql server database, how to create login form in c# usig database, how to make forgot password in c#, how to send email using c#, ranbahadurbk, ran
Id: 8hXSMObIB3w
Channel Id: undefined
Length: 31min 53sec (1913 seconds)
Published: Fri Apr 05 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.