'Email'에 해당되는 글 1건

  1. 2020.03.30 [ios]swift firebase auth email login방법
ios,swift2020. 3. 30. 10:51

[ios]swift firebase auth email login방법

 

private func loadFireBaseSignIn(email : String , password : String)

    {

        Auth.auth().signIn(withEmail: email, password: password) { authResult, error in

            if let error = error

            {

                if let errorCode : AuthErrorCode = AuthErrorCode(rawValue: error._code)

                {

                    print("-> error -> \(error.localizedDescription) -> code -> \(errorCode.rawValue)")

                    

                    switch errorCode.rawValue

                    {

                    case AuthErrorCode.invalidEmail.rawValue:

                        self.makeAlert(title: "error", msg: "이메일 양식이 맞지 않습니다.")

                        return

                    case AuthErrorCode.wrongPassword.rawValue:

                        self.makeAlert(title: "error", msg: "페스워드가 틀렸습니다.")

                        return

                    case AuthErrorCode.userNotFound.rawValue:

                        self.makeAlert(title: "error", msg: "회원등록 되지 않았습니다.")

                        return

                    case AuthErrorCode.operationNotAllowed.rawValue:

                        self.makeAlert(title: "error", msg: "error -> operationNotAllowed")

                        return

                    case AuthErrorCode.userDisabled.rawValue:

                        self.makeAlert(title: "error", msg: "error -> userDisabled")

                        return

                    default:

                        self.makeAlert(title: "error", msg: "error -> \(error.localizedDescription) -> code -> \(errorCode.rawValue)")

                        return

                    }

                }

            }

            else

            {

                //success login

                if let user = authResult?.user

                {

                }

                else

                {

                }

            }

        }

    }

Posted by thdeodls85