// // SignUpViewController.swift // EncuestaMarle // // Created by Tatiana Castro on 5/20/19. // Copyright © 2019 Marle. All rights reserved. // import UIKit import FirebaseAuth class SignUpViewController: UIViewController { @IBOutlet weak var email: UITextField! @IBOutlet weak var password: UITextField! @IBOutlet weak var passwordConfirm: UITextField! @IBOutlet weak var consentimiento: UIButton! @IBAction func signUpAction(_ sender: Any) { if password.text != passwordConfirm.text { let alertController = UIAlertController(title: "Password Incorrect", message: "Please re-type password", preferredStyle: .alert) let defaultAction = UIAlertAction(title: "OK", style: .cancel, handler: nil) alertController.addAction(defaultAction) self.present(alertController, animated: true, completion: nil) } else{ Auth.auth().createUser(withEmail: email.text!, password: password.text!){ (user, error) in if error == nil { self.performSegue(withIdentifier: "signupToHome", sender: self) } else{ let alertController = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .alert) let defaultAction = UIAlertAction(title: "OK", style: .cancel, handler: nil) alertController.addAction(defaultAction) self.present(alertController, animated: true, completion: nil) } } } } override func viewDidLoad() { super.viewDidLoad() } /* // MARK: - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using segue.destination. // Pass the selected object to the new view controller. } */ }