【问题标题】:Firebase: How to validate the email address when a user updates his/her email?Firebase:当用户更新他/她的电子邮件时如何验证电子邮件地址?
【发布时间】:2017-12-13 16:45:12
【问题描述】:
我在 Firebase 中遇到错误。当用户在 firebase 中更新他/她的电子邮件时,用户的电子邮件会得到更新,但用户的电子邮件不会得到验证,因此用户无法登录,因为电子邮件无效。当用户在 Firebase 中更新他们的电子邮件时,还有什么需要做的吗?
【问题讨论】:
标签:
firebase
firebase-realtime-database
firebase-authentication
firebase-security
firebase-storage
【解决方案1】:
似乎可以使用 firebase 中 auth 变量的 currentUser 属性上的 sendEmailVerification 将 verifyEmail 发送到新电子邮件。一个异常情况是,有时邮件同时发送不止一次,链接就会过期。
` this.user.updateEmail(email).then(function () {
auth.currentUser.sendEmailVerification().then(() => {
this.notificationSystem.addNotification({
`message`: 'Verify your new email address with the link sent to ' + email,
level: 'info'
})
});`