cambiar numero de telefono

This commit is contained in:
Juan Felipe Duarte
2023-04-04 10:31:27 -05:00
parent 50737e03dd
commit de3d85f997
5 changed files with 133 additions and 25 deletions
@@ -52,6 +52,17 @@ class AuthenticationRepository extends GetxController {
);
}
Future<void> updatePhoneNumber(String verificationId, String smsCode) async {
try {
PhoneAuthCredential credential = PhoneAuthProvider.credential(
verificationId: verificationId, smsCode: smsCode);
await FirebaseAuth.instance.currentUser!.updatePhoneNumber(credential);
print("Phone number updated successfully");
} catch (e) {
print("Error updating phone number: $e");
}
}
Future<bool> verifyOTP(String otp) async {
var credentials = await _auth.signInWithCredential(
PhoneAuthProvider.credential(
@@ -132,15 +143,4 @@ class AuthenticationRepository extends GetxController {
}
return city;
}
Future<void> updatePhoneNumber(String verificationId, String smsCode) async {
try {
PhoneAuthCredential credential = PhoneAuthProvider.credential(
verificationId: verificationId, smsCode: smsCode);
await FirebaseAuth.instance.currentUser!.updatePhoneNumber(credential);
print("Phone number updated successfully");
} catch (e) {
print("Error updating phone number: $e");
}
}
}