Initialized Auth pages for future work

Implemented Login functionality
This commit is contained in:
Mohammad Salameh
2024-03-07 10:29:19 +03:00
parent 4087f9c71c
commit f734801e94
28 changed files with 728 additions and 110 deletions

View File

@ -6,19 +6,26 @@ class UserModel {
final String? phoneNumber;
final bool? isAnonymous;
final bool? isEmailVerified;
final bool? isAgreementAccepted;
//token decoded with jwt
//{
// "email": "Test@Test.com",
// "userId": 2,
// "uuid": "e145438c-4c62-4535-a0f4-f77958f9f9f4",
// "sessionId": "0409a7a1-6ef5-42c5-b3a1-1f15c639b301",
// "iat": 1709711675,
// "exp": 1709711975
// }
UserModel({
required this.id,
required this.email,
required this.name,
required this.photoUrl,
required this.phoneNumber,
required this.isAnonymous,
required this.isEmailVerified,
required this.isAgreementAccepted,
});
@ -30,12 +37,24 @@ class UserModel {
name: json['name'],
photoUrl: json['photoUrl'],
phoneNumber: json['phoneNumber'],
isAnonymous: json['isAnonymous'],
isEmailVerified: json['isEmailVerified'],
isAgreementAccepted: json['isAgreementAccepted'],
);
}
//from token
factory UserModel.fromToken(Map<String, dynamic> json) {
return UserModel(
id: json['userId'].toString(),
email: json['email'],
name: null,
photoUrl: null,
phoneNumber: null,
isEmailVerified: null,
isAgreementAccepted: null,
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
@ -43,7 +62,6 @@ class UserModel {
'name': name,
'photoUrl': photoUrl,
'phoneNumber': phoneNumber,
'isAnonymous': isAnonymous,
'isEmailVerified': isEmailVerified,
'isAgreementAccepted': isAgreementAccepted,
};