简体   繁体   English

成功更改密码后,Firebase 重定向到网页

[英]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.我在带有 Ionic 的网络应用程序中使用 firebase,并且我想在用户成功更改密码后将用户重定向到特定页面(在我的情况下为登录页面)。 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:您必须通过ActionCodeSettings传递一个继续 URL 才能将用户重定向回应用程序:

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了解有关ActionCodeSettings和在重定向中传递状态的更多信息: 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您还可以在此处构建自己的自定义登录页面: https : //firebase.google.com/docs/auth/custom-email-handler

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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