简体   繁体   中英

Firebase redirect to webpage after successful password change

I'm using firebase in my web app with Ionic and I would like to redirect the user to a specific page (the login page, in my case) after he change the password successfully. At the moment, when the user clicks on the password reset link, he is redirected on another browser page that says that he has successfully changed the password.

在此处输入图片说明

I would like to redirect him to a page of my web app, after changing the password. Is it possible to do that?

You have to pass a continue URL via ActionCodeSettings to redirect the user back to the app:

var actionCodeSettings = {
  // After password reset, the user will be give the ability to go back
  // to this page.
  url: 'https://www.example.com/afterPasswordReset',
  handleCodeInApp: false
};
firebase.auth().sendPasswordResetEmail(email, actionCodeSettings)
  .then(function() {
    // Password reset email sent.
  })
  .catch(function(error) {
    // Error occurred. Inspect error.code.
  });

Learn more about ActionCodeSettings and passing state in redirect: https://firebase.google.com/docs/auth/web/passing-state-in-email-actions

You can also build your own custom landing page here: https://firebase.google.com/docs/auth/custom-email-handler

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM