1 00:00:00,930 --> 00:00:01,590 Welcome back. 2 00:00:02,010 --> 00:00:05,730 Now, what we need to do is that we need to work on the change passport functionality. 3 00:00:06,210 --> 00:00:11,820 So in order to do that, we need to open up the account that we because this functionality, this feature 4 00:00:12,240 --> 00:00:20,430 is in the is in the account that BHP and here in the account with BHP, we have the account here and 5 00:00:20,430 --> 00:00:24,780 then if you scroll you'll find that we have uniform for changing the password. 6 00:00:25,200 --> 00:00:29,640 So this form, let's start working on this for as usual, we need to say method. 7 00:00:29,640 --> 00:00:34,560 We need to give this form method and the method is going to be post and then I'm going to also give 8 00:00:34,560 --> 00:00:36,450 it a action. 9 00:00:36,750 --> 00:00:43,530 So the action is, is just going to be the same page I'm going to say account that BHP. 10 00:00:45,350 --> 00:00:52,940 And the password has any password and the confirmed password has also any confirmed password. 11 00:00:53,270 --> 00:00:54,020 And then the button. 12 00:00:54,020 --> 00:00:55,610 We need to give them a name. 13 00:00:55,610 --> 00:00:57,380 I'm going to say your name. 14 00:00:57,830 --> 00:01:07,580 And the name for this button is is going to be change, underscore or change password. 15 00:01:07,640 --> 00:01:09,590 Very, very simple change password. 16 00:01:09,890 --> 00:01:12,440 Now we need to work on the each part. 17 00:01:12,740 --> 00:01:21,110 So add it up since this is a since this is a since this is a post request, we need to say if and then 18 00:01:21,110 --> 00:01:26,360 we need to check the the post change password parameter. 19 00:01:26,360 --> 00:01:30,470 I'm going to say a set and then I'm going to use a post. 20 00:01:30,470 --> 00:01:41,330 I'm going to say is set post is set fast and I'm going to pass the change change password button change 21 00:01:42,020 --> 00:01:47,090 password because the remember the button, I haven't given the button again, I have given the button 22 00:01:47,090 --> 00:01:48,950 here and simple change password. 23 00:01:49,490 --> 00:01:51,380 The next step is that we need to get the name. 24 00:01:51,650 --> 00:01:56,960 We need to get the password and the confirm password from the fields, from these fields. 25 00:01:57,440 --> 00:02:04,340 And to do this here in the inside, this statement, we need to say here, password. 26 00:02:05,390 --> 00:02:06,110 Password. 27 00:02:07,310 --> 00:02:17,780 Password is going to be password is going to be equal to most password, forced password. 28 00:02:18,140 --> 00:02:27,920 And the confirm password I'm going to say here confirm password here gone for us or is going to be equal 29 00:02:27,920 --> 00:02:42,410 to post pass confirm password bust, confirm, pass or and now what we need to do is that we need to 30 00:02:42,410 --> 00:02:49,550 get a code that we already created, which is verifying that the password that the two passwords match 31 00:02:49,790 --> 00:02:55,130 and also the password is not less than six characters and we already have that going in were just there. 32 00:02:55,250 --> 00:02:58,160 If you go to the register, you'll find that we have this code. 33 00:02:58,160 --> 00:03:01,610 So let's copy this code in order not to repeat this code. 34 00:03:01,610 --> 00:03:05,480 So I'm going to copy this code and then I'm going to put it here, I'm going to copy it, and then I'm 35 00:03:05,480 --> 00:03:06,170 going to be with you. 36 00:03:06,530 --> 00:03:11,150 However, this code is going to be a little different if passwords don't match. 37 00:03:11,540 --> 00:03:13,640 We need to redirect to the same page. 38 00:03:13,640 --> 00:03:22,480 We need to say we need to say here their location account account that BHP and then error is equal to 39 00:03:22,970 --> 00:03:23,990 password don't match. 40 00:03:24,410 --> 00:03:30,710 And if the password is less than six characters, we need to say location and then account and then 41 00:03:30,710 --> 00:03:33,710 your error is equal to password. 42 00:03:33,950 --> 00:03:41,450 Must be at least six characters and else if if there are if there is no error, we need to say else 43 00:03:43,100 --> 00:03:49,790 if no errors and before we continue in to make sure that we brace is the number of key. 44 00:03:49,880 --> 00:03:51,020 Caleb is correct. 45 00:03:51,020 --> 00:03:52,940 So here we have one, two, three. 46 00:03:53,210 --> 00:03:57,470 And here one, two, three, four, one. 47 00:03:58,040 --> 00:03:59,180 This is the closing. 48 00:03:59,750 --> 00:04:04,340 This is the opening and this is the closing bracket and this is for the else. 49 00:04:04,340 --> 00:04:06,620 So make sure that you don't have any problems. 50 00:04:07,340 --> 00:04:11,810 And I'm going to push this code so that you see the structure of any well. 51 00:04:12,500 --> 00:04:17,010 So here, in case we have no is no errors. 52 00:04:17,010 --> 00:04:23,450 So if we don't have any errors, what we want to do is that we want to make agree. 53 00:04:23,450 --> 00:04:29,120 So in order to make a query, we need to import here at the top, we need to include and then we need 54 00:04:29,120 --> 00:04:34,670 to say server, server or slash connection, not BHP. 55 00:04:35,240 --> 00:04:37,520 And then we need to use the connect here. 56 00:04:38,030 --> 00:04:43,280 We need to say gone, you're gone and then prepare. 57 00:04:44,000 --> 00:04:47,450 And then what we want to do is that we want to update the password. 58 00:04:47,930 --> 00:04:52,850 So to update the password we need to say update date. 59 00:04:54,940 --> 00:05:00,580 Users and then set password. 60 00:05:01,210 --> 00:05:04,660 Password is equal to your question mark actually. 61 00:05:04,660 --> 00:05:05,470 User password. 62 00:05:05,530 --> 00:05:08,080 User underscore password. 63 00:05:08,290 --> 00:05:11,620 User password is equal to a question mark. 64 00:05:12,160 --> 00:05:18,130 Where, where, where or where. 65 00:05:20,790 --> 00:05:22,920 Where user. 66 00:05:26,160 --> 00:05:28,020 Wear user underscore. 67 00:05:31,360 --> 00:05:32,110 Email. 68 00:05:34,080 --> 00:05:36,360 Is equal to, again, question mark. 69 00:05:38,190 --> 00:05:39,180 User email. 70 00:05:40,950 --> 00:05:42,170 Equal to question mark. 71 00:05:43,280 --> 00:05:46,630 And after that, we need to excuse this. 72 00:05:46,880 --> 00:05:50,600 In order to execute this, we need to say we need to store this first. 73 00:05:50,600 --> 00:05:57,860 In a statement I'm going to say here is t m t is equal to this and then we need to say is the empty. 74 00:05:58,370 --> 00:06:05,000 And then first we need to bind mind param and we need to bind two things. 75 00:06:05,000 --> 00:06:08,360 We need to bind the password and the email. 76 00:06:08,360 --> 00:06:12,980 So we need to say user, the password is this password. 77 00:06:13,940 --> 00:06:15,800 So first we need to bind the password. 78 00:06:15,800 --> 00:06:24,650 So we need to say comma and then password for and then comma and then email. 79 00:06:25,040 --> 00:06:26,840 So the email is in decision. 80 00:06:26,840 --> 00:06:28,580 Remember, the email is in this issue. 81 00:06:29,210 --> 00:06:43,040 So to get the email from the session we need to use a user email is equal to is equal to user. 82 00:06:44,590 --> 00:06:47,560 Executive session session. 83 00:06:50,170 --> 00:06:53,620 User underscore email. 84 00:06:57,410 --> 00:06:58,790 And I'm going to say you that in. 85 00:07:02,430 --> 00:07:03,900 And before. 86 00:07:04,110 --> 00:07:07,560 Before I bind, we need to hash the password. 87 00:07:07,710 --> 00:07:10,910 So I'm going to say in the five. 88 00:07:12,410 --> 00:07:18,890 You know, I'm going to say Andy five and then I'm going to pass the password inside the device. 89 00:07:19,820 --> 00:07:22,250 This is considered one of the best practices. 90 00:07:22,250 --> 00:07:29,510 And if you want to know more about best practices, practices and security best practices, you can 91 00:07:29,510 --> 00:07:30,680 take my course about that. 92 00:07:30,750 --> 00:07:37,520 I recommend taking this course if you really want to know more about security best practices of BHP. 93 00:07:38,240 --> 00:07:39,950 So after this, what do you want to do? 94 00:07:39,950 --> 00:07:41,150 Is that what you want to execute? 95 00:07:41,150 --> 00:07:47,450 So I'm going to say here is the empty and then how we just need to execute. 96 00:07:48,260 --> 00:07:49,820 It's very similar. 97 00:07:49,820 --> 00:07:55,550 If you if you check this out, you'll find that it's similar to two other code. 98 00:07:55,790 --> 00:07:56,600 It's similar to this. 99 00:07:56,600 --> 00:08:00,170 For example, we mine the program and then we execute and that's it. 100 00:08:00,170 --> 00:08:07,790 But we don't hear the difference is that here we get the result, here we get we prepare and then bind 101 00:08:07,790 --> 00:08:10,520 the amount of in execute and then we get the results. 102 00:08:11,000 --> 00:08:14,300 But here since we are just updating, we don't need to do anything else. 103 00:08:14,300 --> 00:08:17,930 We just need to check if password has been updated or not. 104 00:08:18,560 --> 00:08:22,430 If this is true, we can here say Hey there. 105 00:08:24,410 --> 00:08:25,100 And then. 106 00:08:27,310 --> 00:08:30,160 Location and then. 107 00:08:32,930 --> 00:08:34,640 And then I count. 108 00:08:37,080 --> 00:08:38,010 That would be. 109 00:08:39,420 --> 00:08:44,220 And their message is equal to past war. 110 00:08:46,050 --> 00:08:50,670 Has been updated successfully. 111 00:08:54,000 --> 00:08:54,660 Else. 112 00:08:54,660 --> 00:08:59,280 If the password has not been updated, then we need to do the same. 113 00:08:59,280 --> 00:09:06,510 We need to copy this exist and we need to copy this header and then we need to visit here and then we 114 00:09:06,510 --> 00:09:08,250 need to say here. 115 00:09:08,250 --> 00:09:13,560 And so the message here and then we need to say goodnight. 116 00:09:14,790 --> 00:09:19,590 Good night of the password. 117 00:09:21,280 --> 00:09:24,940 And now what we want to do is that we want to store messages. 118 00:09:25,480 --> 00:09:28,930 So to store messages, to display actually messages. 119 00:09:29,920 --> 00:09:37,810 So in order to display messages above the forum here, above this forum account, this forum, above 120 00:09:37,810 --> 00:09:44,830 this forum I'm going to display to be the first feedback is going to be for the errors and the second 121 00:09:44,830 --> 00:09:46,630 one will be for success messages. 122 00:09:47,080 --> 00:09:48,460 So here I'm going to say class. 123 00:09:50,220 --> 00:09:52,110 Text Center. 124 00:09:54,720 --> 00:09:57,900 The Center and the restyle. 125 00:09:59,630 --> 00:10:05,120 Color is going to be red and in between. 126 00:10:05,120 --> 00:10:06,380 I'm going to say you're looking. 127 00:10:08,530 --> 00:10:16,750 I'm going I'm going to see if if is said, get a visit. 128 00:10:17,590 --> 00:10:18,130 Get. 129 00:10:20,190 --> 00:10:22,020 Error if there is an error. 130 00:10:24,130 --> 00:10:24,560 Error. 131 00:10:25,480 --> 00:10:26,500 Then we need to display it. 132 00:10:26,500 --> 00:10:27,760 We need to say echo. 133 00:10:29,050 --> 00:10:29,650 Echo. 134 00:10:30,610 --> 00:10:32,250 And then what do we want? 135 00:10:32,280 --> 00:10:32,530 Echo. 136 00:10:32,530 --> 00:10:35,080 We want to activate, get, get. 137 00:10:35,080 --> 00:10:37,090 Air, get. 138 00:10:38,970 --> 00:10:39,390 Here. 139 00:10:40,540 --> 00:10:41,260 Pretty simple. 140 00:10:42,700 --> 00:10:48,670 And in case of success, we need to copy the same exact paragraph, this paragraph, and then we need 141 00:10:48,670 --> 00:10:49,810 to proceed below here. 142 00:10:50,410 --> 00:10:57,280 And then we need to say, instead of red, I'm going to say green and then I'm going to say if it set, 143 00:10:57,940 --> 00:11:02,470 yeah, get message, then we need to display the message. 144 00:11:03,310 --> 00:11:03,880 So that's it. 145 00:11:03,880 --> 00:11:04,540 Very simple. 146 00:11:05,050 --> 00:11:07,510 Let me save and let's get on over to the browser to test. 147 00:11:08,320 --> 00:11:12,610 So I'm going to hand it over to the browser and I'm going to refresh first and then I'm going to here 148 00:11:13,540 --> 00:11:14,230 display. 149 00:11:15,850 --> 00:11:21,820 As you can see here, it's going to be logged in successfully because I, I displayed the message because 150 00:11:21,820 --> 00:11:26,500 in the log in in the log in, by the way, in logging, I passed upon logging in. 151 00:11:26,500 --> 00:11:32,260 I passed this message logging in successfully and in case of error, couldn't verify the password. 152 00:11:33,040 --> 00:11:36,250 So here, let me say I'm leaving here. 153 00:11:36,250 --> 00:11:38,410 Say I'm leaving here. 154 00:11:38,410 --> 00:11:39,280 Update my password. 155 00:11:39,550 --> 00:11:41,050 So I'm going to type a new password. 156 00:11:41,290 --> 00:11:43,810 I'm going to type a new password and see what's going to happen. 157 00:11:45,310 --> 00:11:49,780 So I'm going to type here a new passport and then I'm going to click on Change Password. 158 00:11:51,140 --> 00:11:54,110 And as you can see here, I have a very, very simple error. 159 00:11:54,560 --> 00:11:55,640 It says account. 160 00:11:56,370 --> 00:11:58,280 Not once was not found on the server. 161 00:11:58,280 --> 00:11:59,720 And this is a very simple error. 162 00:12:00,290 --> 00:12:03,920 There is because I have you in the form I should say. 163 00:12:05,540 --> 00:12:07,430 I should say not in the form. 164 00:12:07,430 --> 00:12:08,300 In the card. 165 00:12:09,020 --> 00:12:11,870 I should say account. 166 00:12:11,930 --> 00:12:14,840 Let me check one more time account this. 167 00:12:14,930 --> 00:12:18,890 So there is here, I should say account. 168 00:12:20,430 --> 00:12:21,900 I cannot be. 169 00:12:25,090 --> 00:12:27,220 Air is equal to blah, blah, blah. 170 00:12:28,360 --> 00:12:28,930 So that's it. 171 00:12:29,230 --> 00:12:35,910 And another area that they have is here, I should say confirm Kimmel case password. 172 00:12:35,920 --> 00:12:39,610 So we need to make sure that we don't have errors before like this one more time. 173 00:12:40,180 --> 00:12:41,380 Let me now see about this. 174 00:12:42,070 --> 00:12:43,020 So I'm going to save. 175 00:12:43,310 --> 00:12:45,670 Let me go back and let's test. 176 00:12:46,510 --> 00:12:48,610 So let me remove this. 177 00:12:48,620 --> 00:12:50,930 Get request a refresh. 178 00:12:50,950 --> 00:12:53,380 So now let me type a new password. 179 00:12:53,980 --> 00:12:57,160 I'm going to here type in your password and test with a new password. 180 00:12:57,970 --> 00:13:03,430 So if I click on change password, as you can see, it says that your password has been changed, has 181 00:13:03,430 --> 00:13:04,570 been updated successfully. 182 00:13:05,080 --> 00:13:11,230 And if password don't match, for example, if I type your password and in the second field I type another 183 00:13:11,230 --> 00:13:14,560 password, it's going to say password don't match. 184 00:13:14,950 --> 00:13:21,400 If I type a password, that's very short, meaning a type of password that is very, very short. 185 00:13:23,080 --> 00:13:27,850 And then if you click on change password, it's going to say password must be at least six characters. 186 00:13:28,390 --> 00:13:29,620 So this is how it works. 187 00:13:29,620 --> 00:13:37,000 And this is it will allow users to change their passwords if they want to. 188 00:13:38,260 --> 00:13:47,260 And another thing that they wanted to talk about is the is upon app on registering after the user register 189 00:13:47,890 --> 00:13:53,170 we we will display this message user was not this one actually this one. 190 00:13:54,560 --> 00:13:57,080 This one, you register successfully. 191 00:13:57,380 --> 00:14:00,500 So we have this register message. 192 00:14:00,890 --> 00:14:02,960 You can display it here in the account. 193 00:14:03,710 --> 00:14:05,630 You can display in this account here. 194 00:14:07,210 --> 00:14:07,510 Here. 195 00:14:07,890 --> 00:14:10,740 Register here just to restore our success. 196 00:14:10,740 --> 00:14:12,660 Let me say just to underscore success. 197 00:14:13,950 --> 00:14:16,560 And here I'm going to say our sir. 198 00:14:20,320 --> 00:14:20,620 Here. 199 00:14:20,620 --> 00:14:21,910 We don't need actually here. 200 00:14:22,600 --> 00:14:24,010 We don't need a. 201 00:14:25,180 --> 00:14:26,000 We just need air. 202 00:14:26,020 --> 00:14:27,190 So here is just our success. 203 00:14:27,610 --> 00:14:34,240 So in the account, what we want to do is that we want to display this message above the above this 204 00:14:34,240 --> 00:14:34,570 form. 205 00:14:36,320 --> 00:14:37,010 In that account. 206 00:14:37,010 --> 00:14:39,820 We want it displayed above the above. 207 00:14:40,670 --> 00:14:42,320 Not this form above this. 208 00:14:44,950 --> 00:14:45,820 Above this. 209 00:14:46,310 --> 00:14:46,520 Me. 210 00:14:46,690 --> 00:14:50,340 So here I'm going to say A.P. I'm going to copy this speech. 211 00:14:51,600 --> 00:14:53,250 I'm going to copy this piece. 212 00:14:54,540 --> 00:14:57,510 And then I'm going to say. 213 00:15:00,320 --> 00:15:02,090 I'm going to say green. 214 00:15:03,470 --> 00:15:05,420 And then I'm going to say if. 215 00:15:05,420 --> 00:15:06,110 Get. 216 00:15:06,710 --> 00:15:07,790 Resistor. 217 00:15:08,300 --> 00:15:08,930 Underscore. 218 00:15:08,930 --> 00:15:09,650 Success. 219 00:15:10,530 --> 00:15:11,700 Success. 220 00:15:12,980 --> 00:15:14,070 Success. 221 00:15:14,090 --> 00:15:17,000 Then display the register. 222 00:15:17,810 --> 00:15:20,360 Underscore success. 223 00:15:21,200 --> 00:15:24,490 Similarly, with the log in, we have here a message. 224 00:15:24,510 --> 00:15:28,370 Remember in the in the log in, we have error message. 225 00:15:28,790 --> 00:15:40,160 We can say in a set of message in, let's say log in, underscore success and here that it's logging 226 00:15:40,160 --> 00:15:40,550 success. 227 00:15:40,880 --> 00:15:43,430 So in case of success, I'm going to display this message as well. 228 00:15:43,430 --> 00:15:50,600 I'm going to copy this paragraph and let me copy this paragraph and then let me visit here. 229 00:15:50,600 --> 00:15:57,500 And instead of instead of register six, I'm going to say log in success, log in, underscore success, 230 00:15:58,100 --> 00:16:02,750 and here, log in, underscore success. 231 00:16:03,990 --> 00:16:05,330 Laney save and let's test this. 232 00:16:06,050 --> 00:16:21,200 So now in the in the page, if I if I got if I logout, if I tried to log in, let me log in now, maybe 233 00:16:21,200 --> 00:16:22,100 log in one more time. 234 00:16:24,190 --> 00:16:25,360 So if I log in. 235 00:16:30,610 --> 00:16:31,930 So if I log in, guess what? 236 00:16:31,930 --> 00:16:34,690 If they log in, a message will be displayed. 237 00:16:35,560 --> 00:16:40,750 So if you click on log in, as you can see, it's going to say it's going to say you logged in successfully. 238 00:16:41,080 --> 00:16:46,230 Similarly with the restriction, if you register successfully, another message will be displayed here. 239 00:16:46,240 --> 00:16:53,160 So now our this area is complete the account info as well as the change password area. 240 00:16:53,170 --> 00:16:55,270 Both are complete.