This commit is contained in:
Juan Felipe Duarte
2023-05-29 10:45:28 -05:00
parent 3f2404dc9a
commit 083f79bd89
2 changed files with 99 additions and 25 deletions
+13
View File
@@ -245,6 +245,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
await FirebaseAuth.instance.currentUser!.updateDisplayName(newName);
await FirebaseFirestore.instance.collection('users').doc(uid).update({
'name': newName,
'lowerName': newName.toLowerCase(),
});
print('Nombre actualizado correctamente');
} catch (e) {
@@ -254,6 +255,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
if (currentUser?.email != newEmail) {
if (newPassword.isNotEmpty) {
await FirebaseFirestore.instance.collection('users').doc(uid).update({
'email': newEmail,
});
updateEmailAndPassword(newEmail, newPassword);
} else {
Get.snackbar(
@@ -439,6 +443,15 @@ class _ProfileScreenState extends State<ProfileScreen> {
: TextFormField(
controller: _passwordController,
obscureText: _obscureText,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Porfavor ingrese una contraseña.';
}
if (value.length < 5) {
return 'Debe tener al menos 5 caracteres.';
}
return null;
},
decoration: InputDecoration(
prefixIcon: const Icon(Icons.lock_outline),
suffixIcon: IconButton(