Implémentation complète du ticket #47 : - Mise à jour de l'URL API vers app.ptits-pas.fr - Ajout du champ changement_mdp_obligatoire au modèle AppUser - Ajout des endpoints /auth/me et /auth/change-password-required - Implémentation de la vraie logique de connexion dans AuthService - Création de la modale ChangePasswordDialog non-dismissible - Connexion du bouton de connexion avec gestion de la modale - Ajout des routes admin-dashboard et parent-dashboard La modale s'affiche automatiquement après connexion si changement_mdp_obligatoire = true et bloque l'utilisateur jusqu'au changement de mot de passe.
39 lines
1.0 KiB
Dart
39 lines
1.0 KiB
Dart
class AppUser {
|
|
final String id;
|
|
final String email;
|
|
final String role;
|
|
final DateTime createdAt;
|
|
final DateTime updatedAt;
|
|
final bool changementMdpObligatoire;
|
|
|
|
AppUser({
|
|
required this.id,
|
|
required this.email,
|
|
required this.role,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
this.changementMdpObligatoire = false,
|
|
});
|
|
|
|
factory AppUser.fromJson(Map<String, dynamic> json) {
|
|
return AppUser(
|
|
id: json['id'] as String,
|
|
email: json['email'] as String,
|
|
role: json['role'] as String,
|
|
createdAt: DateTime.parse(json['createdAt'] as String),
|
|
updatedAt: DateTime.parse(json['updatedAt'] as String),
|
|
changementMdpObligatoire: json['changement_mdp_obligatoire'] as bool? ?? false,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {
|
|
'id': id,
|
|
'email': email,
|
|
'role': role,
|
|
'createdAt': createdAt.toIso8601String(),
|
|
'updatedAt': updatedAt.toIso8601String(),
|
|
'changement_mdp_obligatoire': changementMdpObligatoire,
|
|
};
|
|
}
|
|
} |