使用Firebase通过电子邮件发送用户密码 [英] Send User Password via Email with Firebase

查看:84
本文介绍了使用Firebase通过电子邮件发送用户密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个使用Firebase身份验证的android应用程序,但我不想将确认电子邮件发送给用户以确认用户电子邮件地址,而是想为用户设置自动生成的密码并发送它发送给用户的电子邮件,这样我就可以验证他的电子邮件.

只想知道是否可以实现,如果可以,那么链接到任何指南或教程就很好了.

谢谢

解决方案

是的,有可能.用户创建帐户时,会在其电子邮件上发送自动生成的密码,并在实时数据库或Firestore中创建与用户Uid对应的字段状态,并将默认值设置为false.还将自动生成的代码保存在数据库中.当用户首次尝试登录时(检查状态是否为假),然后打开一个对话框并要求通过电子邮件发送代码.如果两个代码都与电子邮件验证的更改状态匹配,则更改状态为true,否则给出错误的消息代码.

当用户首次登录时,请询问其电子邮件地址和密码.然后在身份验证模块中进行验证.如果用户存在,则从实时数据库中检索其数据,并检查status的值是false还是true.如果value为false,则表示他是第一次登录.因此,打开一个活动或对话框,要求他的代码通过电子邮件发送.然后检查两个代码是否匹配.如果是,那么这是正确的用户.将他发送到家庭活动中,并在数据库中将status的值设置为true.

I am creating a android application where I'm using firebase auth but I don't want to send the confirmation email to user for confirming the user email address, instead I want to set a auto generated password for the user and send it to the users email so by that way I can verify his email.

Just wanted to know if it is possible or not, if yes then link to any guide or tutorial will be great.

Thanks

解决方案

Yes, it is possible. When user creates his account send a auto generated password on his email and also in realtime database or firestore create a field status corresponding to users Uid and set default value to false. Also save that auto generated code in database. When user tries to login for the first time (check if status is false) then open a dialog and ask for the code send on email. if both code matches email verified change status to true else gives message incorrect code.

When the user login for the first time ask his email and password. Then verify it in auth module. If user exists then retrieve his data from realtime database and check if value of status is false or true. If value is false this means he is logging for the first time. So, open either a activity or a dialog which asks his code send on email. Then check if both code matches. If yes then this is the correct user. Send him to home activity and set the value of status to true in database.

这篇关于使用Firebase通过电子邮件发送用户密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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