handleFirebaseAuthError function
Implementation
String handleFirebaseAuthError(FirebaseAuthException e) {
switch (e.code) {
case 'invalid-phone-number':
return "The phone number entered is invalid. Please check and try again.";
case 'invalid-verification-code':
return "The OTP entered is incorrect. Please check and try again.";
case 'user-disabled':
return "This account has been disabled. Contact support for help.";
case 'email-already-in-use':
return "The email is already in use by another account.";
case 'weak-password':
return "The password provided is too weak. Please use a stronger password.";
case 'wrong-password':
return "The password is incorrect. Please try again.";
case 'operation-not-allowed':
return "This operation is not allowed. Please contact support.";
case 'invalid-credential':
return "The credential provided is malformed or expired.";
case 'user-not-found':
return "No user found with this email. Please sign up first.";
case 'provider-already-linked':
return 'This phone number is already linked to another account. Please use a different number or sign in with the linked account';
default:
return "An unknown error occurred. Please try again later. " +
e.toString();
}
}