Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Video Player
00:00
00:00
00:00
- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Now that all our password checks pass, we can update the user with the new password.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points0 Answers
-
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points3 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
If we pass all these checks.
0:00
We're ready to update the password.
0:02
Let's create a new function to do this.
0:04
The update password function
will do a standard update query
0:17
where will pass the new hash password and
the user ID.
0:21
Only the global $db and
our try catch block.
0:31
We can return false if
the password was not updated.
0:51
Update users.
0:58
Send.
1:02
Password = password WHERE id = :userId.
1:07
Let's prepare a query and
bind our variables.
1:22
And finally, execute.
1:54
If everything worked, we can return true.
2:02
Now let's use this
function in our procedure.
2:06
Make sure we call the password hash
function and our new password.
2:19
Finally, let's redirect the user
with the success or error message.
2:40
Now we can add a link
3:29
in our navigation
3:36
if the user is
3:43
logged in.
3:47
Let's test this out in the browser.
4:08
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up