Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @IBAction func signInTapped(_ sender: AnyObject) {
- if let email = emailField.text, let pwd = pwdField.text {
- FIRAuth.auth()?.signIn(withEmail: email, password: pwd, completion: { (user, error) in
- if error == nil {
- print("JETT: Email user authenticated with Firebase")
- if let user = user {
- let userData = ["provider": user.providerID,
- "uid": user.uid]
- self.completeSignIn(id: user.uid, userData: userData)
- }
- } else {
- FIRAuth.auth()?.createUser(withEmail: email, password: pwd, completion: { (user, error) in
- if error != nil {
- print("JETT: Unable to authenticate with Firebase using email")
- } else {
- print("JETT: Successfully Authenticated with Firebase")
- if let user = user {
- let userData = ["provider": user.providerID,
- "uid": user.uid]
- self.completeSignIn(id: user.uid, userData: userData)
- }
- }
- })
- }
- })
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement