Firebase - 自定义重置密码登陆页面 [英] Firebase - Customize reset password landing page
问题描述
我可以在 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 控制台下自定义密码重置电子邮件 ->验证 ->电子邮件模板 ->密码重置
,并更改电子邮件中的链接以指向您自己的页面.请注意, 占位符将被 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/参考/js/firebase.auth.Auth#confirmPasswordResethttps://firebase.google.com/docs/reference/js/firebase.auth.Auth#verifyPasswordResetCode
这篇关于Firebase - 自定义重置密码登陆页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!