1. 17
    Send a Password Reset Email Using Firebase Authentication with sendPasswordResetEmail
    2m 1s

Send a Password Reset Email Using Firebase Authentication with sendPasswordResetEmail

Jorge Vergara
InstructorJorge Vergara
Share this video with your friends

Social Share Links

Send Tweet
Published a year ago
Updated a year ago

A scenario you will inevitably run into is users needing to reset their passwords for security reasons or they lost and forgot their password.

We'll learn how to send our users an email to reset their passwords, after we send the email, we'll display a notification alert with ionic alertController to the user and redirect them to the login page.

Instructor: [0:01] Now, we're going to handle what to do when the user resets their account. Firebase authentication has a function called sendPasswordResetEmail, and this function does all of the work for us. It takes the current authentication instance, and it takes the user's email.

[0:24] What it does is that once the user clicks Reset password adding their email, it's going to use Firebase to send an email for the user to reset their password. All of that is going to be handled by Firebase and not by our application.

[0:39] This returns an empty promise and here instead of navigating the user to the home page, we're going to redirect them back to login.

[0:49] Before we redirect them, we are going to do something different. We're going to display an alert and for that, I'm going to use Ionic's AlertController. Then here after Firebase sends the reset email, we are going to trigger an alert.

[1:12] This alert is going to have a message where we are going to tell the user that we just sent the email. This one is going to have one button. It's an OK button and when the user clicks it, now we are going to navigate them to the login page.

[1:41] If I save this and go to forgot password, I can add my email here, click Continue. When it sends the email, it's going to say, "We just sent the password reset link, please check your email." As soon as I click OK, it redirects me back to the login page.

egghead
egghead
~ 33 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today