从swift检查解析电子邮件验证的状态

时间:2015-12-11 13:10:37

标签: swift email parse-platform verification

在解析后将电子邮件发送到输入的电子邮件地址后,我如何检查swift中是否已验证该电子邮件地址,然后才允许用户登录该应用程序?谢谢!

1 个答案:

答案 0 :(得分:0)

解析User对象,具有字段emailVerified。因此,当用户登录应用程序时,您可以检查它:

PFUser.logInWithUsernameInBackground(email, password: password) { (user, error) in

  if error == nil{
    if let verified = user["emailVerified"] as? Bool{
      if verified == true{
       // log in
      }else{
       // show that email isn't verified
      }
    }else{
      // show that email isn't verified
    }
  }
}