我在 Ionic 的网络应用程序中使用 firebase,我想在用户成功更改密码后将用户重定向到特定页面(在我的情况下为登录页面)。
目前,当用户点击密码重置链接时,他被重定向到另一个浏览器页面,显示他已成功更改密码。
更改密码后,我想将他重定向到我的网络应用程序的页面。
有可能这样做吗?
最佳答案
您必须通过 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.
});
了解更多关于
ActionCodeSettings
并在重定向中传递状态:https://firebase.google.com/docs/auth/web/passing-state-in-email-actions
您还可以在此处构建自己的自定义登录页面:
https://firebase.google.com/docs/auth/custom-email-handler
关于javascript - 成功更改密码后 Firebase 重定向到网页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55296314/