问题描述
我正在使用 JavaScript
和 Vue
,并将 firebase
与我的应用程序集成
I am using Javascript
and Vue
and integrating firebase
with my app
场景(已构建)
- 我有一个
登录
页面,用户可以在其中登录 - 对于要在
emailVerified
属性中签名的用户,应该为
- I have a
sign in
page where users sign in - For a user to be signed in the
emailVerified
property should be true
问题
- 仅当我使用
firebase.auth().createUserWithEmailAndPassword(电子邮件,密码)
方法 时,我才能发送验证电子邮件
- I am able to send verification email only when i use the
firebase.auth().createUserWithEmailAndPassword(email, password)
method
注册方法
signup: async (email, password) => {
const user = await firebase.auth().createUserWithEmailAndPassword(email, password)
await user.user.sendEmailVerification()
return `Check your email for verification mail before logging in`
},
所需的解决方案
-
我从
firebase控制台
我将 email
作为参数或 uid
传递,该方法应向用户发送验证电子邮件,以便他们可以验证其电子邮件
I pass email
as a parameter or uid
and that method should send a verification email to the user so they can verify thier email
完全废弃 signup
方法,因为我不再需要它来发送验证邮件
Completely scrap the signup
method as i don't need it anymore to send a verification mail
是否仍然可以不登录就发送验证电子邮件?
Is there anyway to send a verification email without signing in ?
推荐答案
只能从客户端SDK发送验证电子邮件,并且只有在用户登录后才能发送验证电子邮件.这样做是为了防止滥用Firebase服务器发送垃圾邮件的能力.
Verification emails can only be sent from the client-side SDK, and only after the user has signed in. This is done to prevent the ability to abuse Firebase's servers for sending spam.
如果Firebase的现有电子邮件验证流程不符合您的需求,则可以实施自己的自定义流程和在满足您的验证要求后,使用Admin SDK设置验证状态.
If the existing email verification flow of Firebase doesn't fit your needs, you can implement your own custom flow and use the Admin SDKs to set the the verification status once they've met your verification requirements.
这篇关于Firebase向用户发送电子邮件验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!