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

标签 javascript html firebase web-applications firebase-authentication

我在 Ionic 的网络应用程序中使用 firebase,我想在用户成功更改密码后将用户重定向到特定页面(在我的情况下为登录页面)。
目前,当用户点击密码重置链接时,他被重定向到另一个浏览器页面,显示他已成功更改密码。

enter image description here

更改密码后,我想将他重定向到我的网络应用程序的页面。
有可能这样做吗?

最佳答案

您必须通过 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/

相关文章:

javascript - AngularJS 和 Firebase 教程 : 'TypeError: undefined is not a function;' issue

javascript - 无法使用附加参数通过 AJAX 上传图像,因为 processData : false

javascript - ApiController返回Json结果无法解析,为什么数据类型:"json"不起作用?

html - 关于 float div 父级的 Css

javascript - Mouseover Mouseout 内容重叠

firebase - 将 Firebase 集成到 Vue.js 2 时出现“未捕获的 TypeError : firebaseApp. firestore 不是函数”

javascript - jQuery 返回元素属性的初始值

javascript - 使用 nvm 使 node.js 文件可执行的最佳方法

html - 为什么浏览器将换行符呈现为空格?

ios - Firebase 写入复杂数据