大佬教程收集整理的这篇文章主要介绍了如何使用Firebase在iOS上验证用户的电子邮件地址?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
if FIRAuth.auth()?.currentUser!.emailVerified == true{ FIRAuth.auth()?.signInWithEmail(email.text!,password: passsword.text!,completion: { user,error in if error != nil{ print("Email/password is wrong or user does not exist") }else{ print("successful login.") } }) }else{ print("Please verify your email.") }
let eduEmail = email.text let endInEdu = eduEmail?.hasSuffix("my.utsa.edu") if endInEdu == true { FIRAuth.auth()?.createUserWithEmail(email.text!,completion: { user,error in if error != nil{ let alert = UIAlertController(title: "User exists.",message: "Please use another email or sign in.",preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title: "Ok",style: UIAlertActionStyle.Default,handler: nil)) self.presentViewController(alert,animated: true,completion: nil) print("Email has been used,try a different one") }else{ FIRAuth.auth()?.currentUser!.sendEmailVerificationWithCompletion({ (error) in }) let alert = UIAlertController(title: "Account Created",message: "Please verify your email by confirming the sent link.",completion: nil) print("This is a college email and user is created") } }) }else{ print("This is not a my.utsa.edu email") }
这对我有用.
FIRAuth.auth()?.signInWithEmail(txtUsername.text!,password: txtpassword.text!) { (user,error) in if let user = FIRAuth.auth()?.currentUser { if !user.emailVerified{ let alertVC = UIAlertController(title: "Error",message: "Sorry. Your email address has not yet been verified. Do you want us to send another verification email to \(self.txtUsername.text).",preferredStyle: .Alert) let alertActionOkay = UIAlertAction(title: "Okay",style: .Default) { (_) in user.sendEmailVerificationWithCompletion(nil) } let alertActionCancel = UIAlertAction(title: "Cancel",style: .Default,handler: nil) alertVC.addAction(alertActionOkay) alertVC.addAction(alertActionCancel) self.presentViewController(alertVC,completion: nil) } else { print ("Email verified. Signing in...") } } }
以上是大佬教程为你收集整理的如何使用Firebase在iOS上验证用户的电子邮件地址?全部内容,希望文章能够帮你解决如何使用Firebase在iOS上验证用户的电子邮件地址?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。