Guest User

Untitled

a guest
Jul 12th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. @IBAction func signIn(_ sender: UIButton) {
  2. let user = PFUser()
  3. let username = emailTF.text
  4. user.email = username
  5. user.password = passwordTF.text
  6. let spinner: UIActivityIndicatorView = UIActivityIndicatorView(frame: CGRect(x: 0, y: 0, width: 150, height: 150)) as UIActivityIndicatorView
  7. if user.email == "" || user.password == "" {
  8. self.alert(message: "Введите email или пароль ", title: "Ошибка")
  9. } else {
  10.  
  11. PFUser.logInWithUsername(inBackground: username! , password: passwordTF.text!) { (user, error) in
  12. spinner.stopAnimating()
  13.  
  14. if user != nil {
  15. //if user!["emailVerified"] as! Bool == true {
  16.  
  17. self.loadMenuScreen()
  18. self.alert(message: "Вы успешно вошли ", title: "BRAVOBET")
  19. spinner.stopAnimating()
  20. // }
  21. }else {
  22. if let descrip = error?.localizedDescription{
  23. self.displayErrorMessage(message: (descrip))
  24. }
  25. }
  26. }
  27. }
  28. }
  29.  
  30. func loadMenuScreen(){
  31.  
  32. let MenuVC = self.storyboard?.instantiateViewController(withIdentifier: "ViewController") as!ViewController
  33.  
  34. self.present(MenuVC, animated: true, completion: nil)
  35.  
  36. }
Add Comment
Please, Sign In to add comment