in this video I’m going to show you how to implement password recovery feature into your Swift mobile app that uses parse for a user registration and login and I will quickly show you how it’s going to work so on my login form I have email address here and password I will add that for a good password button which user will be able to tap and then they will be presented with a new view where they can type the email address and ours will send them an email message with the link to password recovery web page there are they can type a new password and successfully reset it so this view if I tap on cancel button it will simply close if I tap on recover password pars will reply back to me with a message and I’m displaying this message in alert you must provide email and this message comes four parts you can use any message you like I’ll show you how and once you close it or if I type on for example password it does not exist I mean email address does not exist password parts parts will also reply back to me with the message no user found with email addresses but again you can you can customize this a new code so let’s go ahead and implement this functionality into your mobile app I will stop this okay I have my project user login and registration opened I have recorded a video on how to implement this flow in my a little bit earlier so if you did not watch a video on how to build this user interface and connect all this views and integrate parts into you more about hub you can I find a link to that video below in the description I will include it there and to speed it up I have started with existing project so let’s go ahead and implement the user interface for passwords recovering the you I will need my right panel here and I will need a view controller so drag-and-drop your view controller I always like to resize it – for each it’s just convenient to work put it next to my login view controller and I will need a text field for email address position here I will put placeholder text type your email address here and will activate clear button witches so until that user clear their email under safety I made a mistake and I need a couple of buttons right I need one button for I need one button for recover password once we recover password and I’ll color it with same I’ll change background color over to something blue and the team color to white okay and I will need one more button for to dismiss these few controllers and make a cancel button and I will also make it different with something like this a background color for red I mean red for background color and white for a team color okay so my view is almost ready and now I need a suite file that will be associated with this view controller so I will go click on my user login the registration group and create a new file

and that will be source code touch class next and here I’ll say password recover view controller subclass of uiviewcontroller and language Swift next create very good so I have sweet file now I can go back to my in storyboard and I can associate this place with file with my the password recovery you are so I’ll select your controller here I’ll switch to identity inspector and in the custom class here I will type password recovery as soon as I started typing password recovery view controller it actually ought to suggest and I can hit enter to apply ok so now I can connect these two views so what when will a password recovery be view controller open when user requests for it so I need one more button and this time I need it for my login view I’ll put it next to password field because I think it makes sense when user doesn’t know their password or they don’t remember their password they want to arm they don’t see this button so I will name it for God yes forgot password I’ll make it look a bit smaller yeah and maybe change its color to red sometimes but I mean your colors and wine can be anything ok so I will now so one user I will select this button and then hold the control button click on the drag and drop to my plants way to cover a view controller and release and I will create an actions thank you that will show this you this is how I connect them to so what I can now do I can run this example and see if it works okay so I can clearly see my forgot password they can tap on it and I get the new view these buttons don’t work because I did not implement any now and you called for that so quickly stop it and continue okay now when user I want to I want to create outlets for this UI so I will select view controller right this right side panel and I will open a system editor by clicking on this ovals circles okay now my recover password view controller the view controller associated with this UI is open and I can start creating outlet one outlet I need for my text field and this will be called something like a user and now text account and I need a couple of action created one for recover password so select the button hold ctrl click drag and drop and all the below here and the connection type is action and I will call it the recover button tat so when user taps on this button this function will be called and console when user taps on console connection action cancel button jobs okay so one cancel button tap don’t need this one console button tap I simply want to dismiss current view controller now so I will type this means view controller animated troll and completion now you know so that the current view will be dismissed I’m going to recover button that I basically first need to get hold of my user like this so I will say let user email equals and then I will refer

to the text field that I have here and grab the text if next value as now obviously you want to check for like if user did not type anything you can display a friendly a message you you forgot the type email address but pars also does it for us so I can start a writing parse code because I have connected my I’ve integrated this mobile application with bars I’m not going to show you how to integrate parse framework into it you can watch again you can watch a video that I have recorded earlier and there’s the link to this video is going to be below the description no I’ll just start writing bars code right away so we have this PF user and if I tap on dot that will be another suggested a list of functions I can use and you can see it recommends me some like request password resent for email in background this is what I want request password reset for email in background so I will select it and I need an user email address right and I need a block of code and this basically is the code that will be implemented once one this function is called so the first parameter is for success and the second parameter is for error so what I can do I can talk something like success and it’s going to be of boolean true or false and as there I will I can also do something like error and as so it’s going to be variable error I mean this error object will be of type honest here and this success opticool value will be of type true or false and any code that I want to be here okay so basically if um um sometimes I join with email request password use every time a request can sit well quite spicy although with our communities argument this is not correct what is it let’s just do it again request possible for me email stream and then we have to wash so for my email I can do what what do we have we have our user email and then for block of gold some reason to sing like this so it was block of code so for success I remember it was bullying volume right okay so if it was if if it’s success if success I basically want to display a message like email now that success message equals to email message with

email message was sent to you ad and then email address okay and I will need to display the maillard message I will show you how to adjust in a moment and if error is not nil I need to display an error message right so I’ll say error message and I will get the error message from this error object that parse it turns me and my error message is of course going to be a string right and now from error message object I need there is a user inform and from that user info I think it was called error basically if you if you output entire user object you will see that there there are some key in value and one of the objects that it contains is using for and dictionary and I think this is it so one of them is there cannot all subscripts you supply arguments user error and that’s emotional values and user user form just gonna drop everything okay so we need to display in terms of when in success we need to display success message and when error message we need to display error message and I do have a little code prepared for this alert message so I don’t have to type it from the beginning so let me quickly going to find a function that I have so it’s called display error message function which accepts the message let’s say it accepts the message so copy the function signature and if success we need to display success message and if it’s error we need to display error message and of course needs to be south-south okay so display display message is playing message displaying message okay if success with display message if we display message and here we go something we have changed yes we’ve changed the message so I’m creating an alert controller and that alert control will display whatever message we pass in of style alert and we’ll create an action button and once user taps on this on K button on the alert message is dismissed we add action button and then we present this view controller to a user on the screen and this all this code is triggered when user taps on recover button that we have connected here okay so I think we are ready to run this example and see how it really works okay my app is up and I tap on forgot password I’m presented with new controller it happened cancel button and it is dismissed right away and I can try typing any email address that is there and I mean that does not

exist Tapan recover password and I get an alert message which which has no user found with email address like this okay and I will try existing email address which is my personal email address recovered and it says email message was sent to you at my mother’s and I just heard something – yes it’s in them and a mail message from pars so what I’ll do I will close this video and then open that go into my email box email inbox opened down tab in email message and I’ll show you what came through okay so here I am in my personal inbox and I have a message from parse I have a subject here we said password reset for my collab the name of the app you can change and then this is a test app but that will be the name of your app and the message this message template you can change and I actually think I have this yes I have a webpage open that will show you how to change this and basically you need to go to your dashboard in parse and on your dashboard you’ll have a list of your apps I have the only up with parts which is called Michael up when I click on it I go in and at the top here you have settings click on settings and scroll down below and you will have um no actually no numbers and under settings you need to go here on the left our email email and this our email settings and if you scroll down below here are the variables that you that are created for you automatically it says here the following variables will be automatically filled in with their appropriate values so username email name an app link will be replaced by appropriate values and the first email verification template which which is something else password reset email template so this is what we need so if you want to change if you want a program message here this message is very short you requested to reset your password you can make better a better message and these are the variables that will be automatically put here which is our name and the link to reset webpage so I go back to my email and if I click on this link it opens a page which says reset your password for the name of the app and I can type any password here I’ll type 1 2 3 4 5 6 7 1 2 3 4 5 6 7 and I kept on changing password successfully updated your password now I can go back to my hand I think it should be running yeah and I can login with the email address which is my personal email address they have emailed me and and the new password which is 1 2 3 4 5 6 7 log in voila it work I think this is it for this video friends if you have questions if something is not clear if something for some reason did not work please try type your question below and I will do my best to help you out as soon as I can and please don’t forget to check the description below to see the link to a previous video which describes how to create user interface and a link to my blog post on suite developer blog calm I’m going to publish this function basically password recovery a code and display alert message called an okay I wish you a great day