gpt4 book ai didi

ios - 如何使用 firebase 在 xcode 中验证电子邮件和密码

转载 作者:行者123 更新时间:2023-11-29 05:22:36 24 4
gpt4 key购买 nike

我想通过 Firebase 中的验证电子邮件来验证使用电子邮件和密码登录的用户。

这是我的代码:

@IBAction func Login(_ sender: Any) {
guard let email = txtUser.text, email != "",
let password = txtPass.text, password != ""
else {
AlertController.showAlert(self, title: "Missing Info", message: "Please fill out all required fields")
return
}
Auth.auth().signIn(withEmail: txtUser.text!, password: txtPass.text!, completion: { (authResult,error) in
if error != nil{
AlertController.showAlert(self, title: "Error", message: error!.localizedDescription)
} else if authResult != nil {
self.performSegue(withIdentifier: "SegueMode", sender: self)
}
})
}

最佳答案

你试过这个吗

Auth.auth().sendSignInLink(toEmail:email,
actionCodeSettings: actionCodeSettings) { error in
// ...
if let error = error {
self.showMessagePrompt(error.localizedDescription)
return
}
// The link was successfully sent. Inform the user.
// Save the email locally so you don't need to ask the user for it again
// if they open the link on the same device.
UserDefaults.standard.set(email, forKey: "Email")
self.showMessagePrompt("Check your email for link")
// ...
}

关于ios - 如何使用 firebase 在 xcode 中验证电子邮件和密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58519092/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com