인프런 커뮤니티 질문&답변
[개선코드]signinAndSignup()의 else문 보완
작성
·
152
2
fun signinAndSignup() {
auth?.createUserWithEmailAndPassword(email_edittext.text.toString(), password_edittext.text.toString())
?.addOnCompleteListener {
task ->
if (task.isSuccessful) { //계정 만들기에 성공했을 때
//Creating a user account
moveMainPage(task.result?.user)
} else {
//Login if you have account
if (task.exception?.message.equals("The email address is already in use by another account."))
signinEmail()
//Show the error message
else Toast.makeText(this, task.exception?.message, Toast.LENGTH_LONG).show()
}
}
}
동일 계정 존재로 인한 exception일 경우 signinEmail() 함수를 호출하도록 했습니다. (그 외 이메일 형식 오류 또는 비밀번호 형식 오류일 경우 Toast로 에러 메시지를 보여줍니다.)
답변
답변을 기다리고 있는 질문이에요
첫번째 답변을 남겨보세요!





