Essential CSS
JavaScript Roadmap
Learn JavaScript
Mastering Web Typography
Practical Astro
Understanding Async JS
Unorthodox Tailwind
API Masterclass
Build and Deploy
The Beginner Freelancer
Real World Node
Profile Billing Logout
Real World Node
Lesson Plan
  1. Workshop Recordings
    1. ๐Ÿ“น Understanding Node and Express
    2. ๐Ÿ“น Creating a traditional server
    3. ๐Ÿ“น Building API servers
    4. ๐Ÿ“น Create, Read, Update, and Delete APIs with real databases
    5. ๐Ÿ“น Handling user flows
    6. ๐Ÿ“น Testing your app and database with Vitest
    7. ๐Ÿ“น Testing Middlewares and APIs โ€” including Mocking
    8. ๐Ÿ“น Changing and resetting passwords

๐Ÿ“น Changing and resetting passwords

1m:36s
48m:22s

Hereโ€™s the final session of the series.

Today, youโ€™ll learn how to create APIs that let a user change and reset their password โ€” this is arguably one of the most important functionalities for user management.

Thereโ€™s nothing much to say here other than this is an important lesson ๐Ÿ™‚.

Note

I was in a pretty bad state when recording this workshop โ€” so youโ€™ll see me make a ton of typos (and end up having to debug them on the spot) in this session.

If you want to learn to debug when things go wrong then watch the debugging sections. Otherwise, just skip ahead according to the timestamps below.

Source Code

Hereโ€™s a link to the Github Repository.

Timestamps

  • 0:00 Introduction
  • 03:00 Recap of the previous session
  • 04:00 Creating a password reset feature
  • 08:00 Creating a reset password endpoint
  • 11:00 Writing tests for the reset passward feature
  • 18:30 Writing better functions
  • 21:10 Using Porimse chains instead of try/catch
  • 24:30 Decoding the password token
  • 30:00 Thinking about the user flow
  • 34:00 Creating a change password service function
  • 42:40 Debugging the change password test
  • 49:50 Debugging end
  • 50:30 Testing the change password happy path
  • 59:30 What reset password endpoint should contain
  • 1:02:20 Changing the endpoints (and more debugging :Sweat:)
  • 1:09:20 Fixing tests caused by a mutation
  • 1:11:14 Back to the reset password feature (build it out)
  • 1:12:40 Writing a API test for the reset password flow (and more debugging)
  • 1:18:36 Debugging end
  • 1:18:37 Getting a password reset token in the test file
  • 1:28:58 Debugging end
  • 1:32:20 Sending a change password request
  • 1:36:30 Fixing the change password function
  • 1:37:20 Logging in with the new password
  • 1:39:50 Wrapping up and recap
  • 1:42:15 Verifying the password reset token