[英]Django & Pyrebase: How do I know if my email is verified or not in firebase
I am building a web app using Django as the framework and firebase as the database.我正在构建一个 web 应用程序,使用 Django 作为框架,firebase 作为数据库。 I am using the pyrebase API.
我正在使用pyrebase API。 The API allows sending the verification email but I didn't find any way to find out if the user has verified their email or not.
API 允许发送验证 email 但我没有找到任何方法来确定用户是否验证了他们的 email。 Please help!
请帮忙!
According to the documentation, the User
object contains an emailVerified
property.根据文档,
User
object 包含emailVerified
属性。 check if its True检查它是否为真
You should first sign in with e-mail and password by calling this function auth.sign_in_with_email_and_password(email, password)
(given in the pyrebase documentation) and store its detail in user
variable.您应该首先通过调用此 function
auth.sign_in_with_email_and_password(email, password)
(在 pyrebase 文档中给出)使用电子邮件和密码登录,并将其详细信息存储在user
变量中。 From user
variable extract id token and call auth.get_account_info(user['idToken'])
(given in the pyrebase documentation) and store its values in some variable name user_info
.从
user
变量中提取 id 令牌并调用auth.get_account_info(user['idToken'])
(在 pyrebase 文档中给出)并将其值存储在某个变量名user_info
中。 This user_info
will have a verified flag which can be use for checking the whether the e-mail is verified or not.此
user_info
将有一个已验证标志,可用于检查电子邮件是否已通过验证。 I hope this solution helps.我希望这个解决方案有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.