Ei kuvausta

LoginViewController.swift 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // LoginViewController.swift
  3. // EncuestaMarle
  4. //
  5. // Created by Tatiana Castro on 5/20/19.
  6. // Copyright © 2019 Marle. All rights reserved.
  7. //
  8. import UIKit
  9. import FirebaseAuth
  10. class LoginViewController: UIViewController {
  11. @IBOutlet weak var email: UITextField!
  12. @IBOutlet weak var password: UITextField!
  13. @IBAction func loginAction(_ sender: Any) {
  14. print("hey")
  15. Auth.auth().signIn(withEmail: email.text!, password: password.text!){ (user, error) in
  16. if error == nil{
  17. self.performSegue(withIdentifier: "loginToHome", sender: self)
  18. }
  19. else{
  20. let alertController = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .alert)
  21. let defaultAction = UIAlertAction(title: "OK", style: .cancel, handler: nil)
  22. alertController.addAction(defaultAction)
  23. self.present(alertController, animated: true, completion: nil)
  24. }
  25. }
  26. }
  27. override func viewDidLoad() {
  28. super.viewDidLoad()
  29. }
  30. /*
  31. // MARK: - Navigation
  32. // In a storyboard-based application, you will often want to do a little preparation before navigation
  33. override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  34. // Get the new view controller using segue.destination.
  35. // Pass the selected object to the new view controller.
  36. }
  37. */
  38. }