login con email
This commit is contained in:
@@ -75,14 +75,6 @@ class AuthenticationRepository extends GetxController {
|
||||
Future<void> createUserWithEmailAndPassword(
|
||||
String email, String password) async {
|
||||
try {
|
||||
// try {
|
||||
// await firebase.collection('Users').doc().set({
|
||||
// "Email": email,
|
||||
// "Password": password,
|
||||
// });
|
||||
// } catch (e) {
|
||||
// print('Error $e');
|
||||
// }
|
||||
await _auth.createUserWithEmailAndPassword(
|
||||
email: email, password: password);
|
||||
|
||||
@@ -91,7 +83,11 @@ class AuthenticationRepository extends GetxController {
|
||||
: Get.to(LoginScreen());
|
||||
} on FirebaseAuthException catch (e) {
|
||||
final ex = SignUpWithEmailAndPasswordFailure.code(e.code);
|
||||
print('FIREBASE AUTH EXCEPTION - ${ex.message}');
|
||||
Get.snackbar(
|
||||
'Correo Invalido',
|
||||
'Por favor pruebe con otro.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
} catch (_) {
|
||||
const ex = SignUpWithEmailAndPasswordFailure();
|
||||
print('EXCEPTION - ${ex.message}');
|
||||
@@ -103,6 +99,27 @@ class AuthenticationRepository extends GetxController {
|
||||
try {
|
||||
await _auth.signInWithEmailAndPassword(email: email, password: password);
|
||||
} on FirebaseAuthException catch (e) {
|
||||
if (e.code == 'wrong-password') {
|
||||
Get.snackbar(
|
||||
'Contraseña incorrecta',
|
||||
'Por favor intentelo de nuevo.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
}
|
||||
if (e.code == 'invalid-email') {
|
||||
Get.snackbar(
|
||||
'Ingrese un email valido',
|
||||
'Por favor pruebe con otro.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
}
|
||||
if (e.code == 'user-not-found') {
|
||||
Get.snackbar(
|
||||
'Email no encontrado',
|
||||
'Este correo no se encuentra registrado.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user