Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @IBAction func signInButton(_ sender: Any) {
- self.view.endEditing(true)
- let email = emailText.text!.lowercased()
- let finalEmail = email.trimmingCharacters(in: .whitespacesAndNewlines)
- let password = passwordText.text!
- if finalEmail.isEmpty || password.isEmpty {
- let alertController = UIAlertController(title: "Error!", message: "Please fill in all the fields.", preferredStyle: .alert)
- alertController.addAction(UIAlertAction(title: "Ok", style: .cancel, handler: nil))
- present(alertController, animated: true, completion: nil)
- }else {
- SVProgressHUD.show()
- Auth.auth().signIn(withEmail: email, password: password) { (user, error) in
- if error == nil {
- if let user = user {
- print("(user.displayName!) has been signed in")
- SVProgressHUD.dismiss()
- // self.enter()
- self.performSegue(withIdentifier: "signInHome", sender: nil)
- }else{
- SVProgressHUD.dismiss()
- print("error")
- let alertController = UIAlertController(title: "Low Blow!", message: "incorrect credentials", preferredStyle: .alert)
- alertController.addAction(UIAlertAction(title: "Ok", style: .cancel, handler: nil))
- self.present(alertController, animated: true, completion: nil)
- print(error?.localizedDescription as Any)
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment