Mudanças em criar conta
This commit is contained in:
@@ -19,6 +19,8 @@ class AuthService {
|
||||
static Future<UserCredential?> signUpWithEmailAndPassword({
|
||||
required String email,
|
||||
required String password,
|
||||
String? displayName,
|
||||
String? role,
|
||||
}) async {
|
||||
try {
|
||||
print('DEBUG: Tentando criar conta para email: $email');
|
||||
@@ -33,6 +35,18 @@ class AuthService {
|
||||
print('DEBUG: User ID: ${result.user?.uid}');
|
||||
print('DEBUG: Email verified: ${result.user?.emailVerified}');
|
||||
|
||||
// Update user profile with display name
|
||||
if (displayName != null && displayName.isNotEmpty) {
|
||||
await result.user?.updateDisplayName(displayName);
|
||||
print('DEBUG: Display name atualizado para: $displayName');
|
||||
}
|
||||
|
||||
// Store user role in custom claims or Firestore (simplified for now)
|
||||
if (role != null) {
|
||||
print('DEBUG: Papel do usuário: $role');
|
||||
// TODO: Store role in Firestore for future use
|
||||
}
|
||||
|
||||
// Verificar se o email foi verificado
|
||||
if (result.user != null && !result.user!.emailVerified) {
|
||||
print('DEBUG: Email não verificado, tentando enviar verificação...');
|
||||
@@ -73,6 +87,12 @@ class AuthService {
|
||||
print('DEBUG: Login realizado com sucesso para: ${result.user?.email}');
|
||||
print('DEBUG: User ID: ${result.user?.uid}');
|
||||
print('DEBUG: Email verified: ${result.user?.emailVerified}');
|
||||
print('DEBUG: Display name: ${result.user?.displayName}');
|
||||
|
||||
// Reload user data to ensure we have the latest information
|
||||
await result.user?.reload();
|
||||
print('DEBUG: User data reloaded');
|
||||
print('DEBUG: Display name after reload: ${result.user?.displayName}');
|
||||
|
||||
return result;
|
||||
} on FirebaseAuthException catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user