Enhance user authentication handling by adding authMethod to UserModel and updating ProfileContent to display authentication method details.

This commit is contained in:
Van Leemput Dayron
2025-11-13 14:46:21 +01:00
parent dd8de46e71
commit 0971b4cb3d
3 changed files with 105 additions and 13 deletions

View File

@@ -72,15 +72,19 @@ class UserModel {
/// User's last name (optional).
final String? nom;
/// Platform used for authentication (e.g., 'google', 'apple', 'email').
final String? authMethod;
/// Creates a new [UserModel] instance.
///
/// [id], [email], and [prenom] are required fields.
/// [nom] is optional and can be null.
/// [nom] and [authMethod] are optional and can be null.
UserModel({
required this.id,
required this.email,
required this.prenom,
this.nom,
this.authMethod,
});
/// Creates a [UserModel] instance from a JSON map.
@@ -93,6 +97,7 @@ class UserModel {
email: json['email'] ?? '',
prenom: json['prenom'] ?? 'Voyageur',
nom: json['nom'],
authMethod: json['authMethod'] ?? json['platform'],
);
}
@@ -105,6 +110,7 @@ class UserModel {
'email': email,
'prenom': prenom,
'nom': nom,
'authMethod': authMethod,
};
}
}