我正在Ionic的Web应用程序中使用firebase,我希望在用户成功更改密码后将其重定向到特定页面(在我的情况下为登录页面)。 此刻,当用户单击密码重置链接时,他会在另一个浏览器页面上重定向,该页面显示他已成功更改密码。
更改密码后,我想将他重定向到我的Web应用程序页面。 有可能这样做吗?
答案 0 :(得分:2)
您必须通过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