1 00:00:00,210 --> 00:00:02,030 So let's proceed to our next step. 2 00:00:02,040 --> 00:00:06,870 But before we do that we're gonna set back to our default values. 3 00:00:06,870 --> 00:00:08,930 This is gonna be false. 4 00:00:08,920 --> 00:00:17,910 And then also the text is just gonna be an empty string and type is gonna be always always a success. 5 00:00:17,910 --> 00:00:19,080 I'm going to save it. 6 00:00:19,080 --> 00:00:21,880 We're going to open up the sidebar right away. 7 00:00:21,870 --> 00:00:27,750 Maybe you can just remove the rest of the files that I had open and then we're going to look again for 8 00:00:27,750 --> 00:00:29,500 our log in page. 9 00:00:29,550 --> 00:00:30,660 So we have pages. 10 00:00:30,780 --> 00:00:34,770 We have the logging and now of course we have our user context. 11 00:00:34,770 --> 00:00:36,540 Of course we access it already. 12 00:00:36,540 --> 00:00:41,330 But what we're looking for right now is the alert as well as show alert. 13 00:00:41,850 --> 00:00:48,150 So there's gonna be two cases where we want to show alert if dialoguing was successful or there was 14 00:00:48,150 --> 00:00:50,040 some kind of fail. 15 00:00:50,040 --> 00:00:57,540 So we're going to go with user log in then we're looking for alert from our user context and then also 16 00:00:57,540 --> 00:01:00,570 we're looking for the show alert. 17 00:01:00,960 --> 00:01:07,500 So those are the methods that we're looking for or I guess more properly one method and one state value. 18 00:01:07,500 --> 00:01:10,540 So let's look for show alert. 19 00:01:10,540 --> 00:01:16,650 And now once we have access to both of these things we're going to scroll down a bit where we have a 20 00:01:16,650 --> 00:01:19,330 handle submit and we're going to set it up. 21 00:01:19,440 --> 00:01:25,590 First of all if the response was successful so let's say right in between the user log in and there's 22 00:01:25,590 --> 00:01:26,550 three push. 23 00:01:26,550 --> 00:01:29,080 We're going to have our show alert. 24 00:01:29,220 --> 00:01:31,710 And what kind of values would want person. 25 00:01:31,710 --> 00:01:33,880 Well first of all we're going to have some kind of message. 26 00:01:33,990 --> 00:01:34,830 Correct. 27 00:01:34,870 --> 00:01:37,240 So we're going to go with a message. 28 00:01:37,320 --> 00:01:45,220 So SMG parameter or property more correctly then this is going to be equal to a time String. 29 00:01:45,270 --> 00:01:49,070 Say you are logged in. 30 00:01:49,080 --> 00:01:50,570 That's step number one. 31 00:01:50,620 --> 00:01:55,550 Then we're going to access our variable our user name just because I would want to show that so user 32 00:01:55,550 --> 00:02:03,360 name and remember we structured it few videos ago as well as we have some more text of shop or shop 33 00:02:03,360 --> 00:02:08,670 away to chop away my right Mike. 34 00:02:08,680 --> 00:02:11,410 So we're gonna save that. 35 00:02:11,460 --> 00:02:14,240 And also would want to show if there was some kind of error. 36 00:02:14,640 --> 00:02:16,190 So we have the else correct. 37 00:02:16,230 --> 00:02:20,820 If the response is going to be undefined then we're gonna have a different alert. 38 00:02:20,940 --> 00:02:27,390 And in this case we're going to run show alert and we're going to pass in our object a message some 39 00:02:27,650 --> 00:02:28,960 kind of text. 40 00:02:29,010 --> 00:02:39,510 There was an error and then that leaves try again dot dot dot. 41 00:02:39,510 --> 00:02:44,400 And then as far as the type remember by default we're going to have it as a success. 42 00:02:44,550 --> 00:02:46,340 So we're gonna type type. 43 00:02:46,500 --> 00:02:52,230 He is going to be equal to a danger I'm going to say if it is then we're gonna head over to a bigger 44 00:02:52,350 --> 00:02:58,260 browser window just because it's gonna be easier to see going can remember I have my John username I 45 00:02:58,260 --> 00:03:03,420 don't know whatever users you have but I'm going to try to log in please again keep in mind the same 46 00:03:03,420 --> 00:03:06,850 is gonna work with our register functionality. 47 00:03:06,970 --> 00:03:12,910 There's no point for me each and every video repeat that so I'm going to go with logging and go john 48 00:03:13,680 --> 00:03:15,570 g mail dot com. 49 00:03:15,610 --> 00:03:21,630 Now let me remember the password if everything is correct I'm going to have you are logged in whatever 50 00:03:21,630 --> 00:03:25,200 the user name was and I can have shopped away my friend. 51 00:03:25,200 --> 00:03:31,220 Now we're gonna head over back and we're going to try to in fact sign in with a wrong password. 52 00:03:31,680 --> 00:03:36,030 So let's start that John and you know I think I can close the console. 53 00:03:36,120 --> 00:03:37,610 Can I have a g mail. 54 00:03:38,420 --> 00:03:46,020 Then again we're gonna have a secret one or whatever just some wrong password and there was an error. 55 00:03:46,080 --> 00:03:47,370 Please try again. 56 00:03:47,370 --> 00:03:51,560 And if you'd like to close the alert would just click on close button.