getting message of throw with invalid data
This commit is contained in:
@@ -39,8 +39,10 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
|||||||
fallbackEmail: firebaseUser.email ?? email,
|
fallbackEmail: firebaseUser.email ?? email,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//TO-DO: validate that user is business role and has business account
|
||||||
|
|
||||||
} on firebase.FirebaseAuthException catch (e) {
|
} on firebase.FirebaseAuthException catch (e) {
|
||||||
if (e.code == 'user-not-found' || e.code == 'wrong-password') {
|
if (e.code == 'invalid-credential' || e.code == 'wrong-password') {
|
||||||
throw Exception('Incorrect email or password.');
|
throw Exception('Incorrect email or password.');
|
||||||
} else {
|
} else {
|
||||||
throw Exception('Authentication error: ${e.message}');
|
throw Exception('Authentication error: ${e.message}');
|
||||||
@@ -94,7 +96,7 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
|
|||||||
final newUserData = createUserResponse.data?.user_insert;
|
final newUserData = createUserResponse.data?.user_insert;
|
||||||
if (newUserData == null) {
|
if (newUserData == null) {
|
||||||
await firebaseUser.delete(); // Rollback if user profile creation fails
|
await firebaseUser.delete(); // Rollback if user profile creation fails
|
||||||
// TODO: Also delete the created Business if this fails
|
// TO-DO: Also delete the created Business if this fails
|
||||||
throw Exception('User profile creation failed after Firebase user registration.');
|
throw Exception('User profile creation failed after Firebase user registration.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user