Firebase-自定义重置密码登录页面 [英] Firebase - Customize reset password landing page

查看:189
本文介绍了Firebase-自定义重置密码登录页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在Firebase中自定义密码重置的登录页面.我想本地化该页面,因为我的应用程序不是英语.有什么办法吗?

Can I customize the landing page of password reset in Firebase. I want to localize that page since my app is not in english. Is there any way to do so?

谢谢.

推荐答案

您可以在Firebase Console -> Auth -> Email Templates -> Password Reset下自定义密码重置电子邮件,并更改电子邮件中的链接以指向您自己的页面.请注意,<code>占位符将替换为URL中的密码重置代码.

You can customize the Password Reset email under Firebase Console -> Auth -> Email Templates -> Password Reset, and change the link in the email to point to your own page. Note that the <code> placeholder will be replaced by the password reset code in the URL.

然后,在您的自定义页面中,您可以从URL中读取密码重置代码并执行

Then, in your custom page, you can read the password reset code from the URL and do

firebase.auth().confirmPasswordReset(code, newPassword)
    .then(function() {
      // Success
    })
    .catch(function() {
      // Invalid code
    })

(可选),您可以先显示该密码是否有效,然后再显示密码重置表单,

Optionally, you can first check if the code is valid before displaying the password reset form with

firebase.auth().verifyPasswordResetCode(code)
    .then(function(email) {
      // Display a "new password" form with the user's email address
    })
    .catch(function() {
      // Invalid code
    })

https://firebase.google.com/docs/reference/js/firebase.auth.Auth#confirmPasswordReset https://firebase.google.com/docs/reference/js /firebase.auth.Auth#verifyPasswordResetCode

这篇关于Firebase-自定义重置密码登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆