This commit is contained in:
Felipe
2024-02-27 17:32:16 -05:00
parent 906ebb4330
commit a71fc9efb6
17 changed files with 1189 additions and 526 deletions
@@ -164,6 +164,25 @@ class FirebaseUserRepository implements UserRepository {
}
}
// Add email and password to user authenticate with phone
@override
Future<bool> addEmailAndPassword(String email, String password) async {
try {
await _firebaseAuth.currentUser!.updateEmail(email);
await _firebaseAuth.currentUser!.updatePassword(password);
return true;
} catch (e) {
log('xd -- Error add email and password ${e.toString()}');
if (e is FirebaseAuthException && e.code == 'requires-recent-login') {}
if (e is FirebaseAuthException && e.code == 'email-already-in-use') {}
return false;
}
}
// Sign out
@override
Future<void> logOut() async {
@@ -7,6 +7,8 @@ abstract class UserRepository {
Future<void> signIn(String email, String password);
Future<bool> addEmailAndPassword(String email, String password);
Future<void> logOut();
// Future<MyUser> signUp(String name, String email, String password);