Added mechanism of required password change of new user's first login (#272)

* Deprecate login scenarios that support pre-web era

* refactor and simplify setup

* Added user info to change password form

* change isFistLogin column to shouldChangePassword

* Implemented change user password

* Implement the change password page for mobile

* Change label

* Added changes log and up minor version

* Fixed typo in the release note

* Up server version
This commit is contained in:
Alex
2022-06-27 15:13:07 -05:00
committed by GitHub
parent 2e85e18020
commit 5f00d8b9c6
33 changed files with 738 additions and 562 deletions

View File

@@ -11,7 +11,7 @@ class AuthenticationState {
final String firstName;
final String lastName;
final bool isAdmin;
final bool isFirstLogin;
final bool shouldChangePassword;
final String profileImagePath;
final DeviceInfoRemote deviceInfo;
@@ -24,7 +24,7 @@ class AuthenticationState {
required this.firstName,
required this.lastName,
required this.isAdmin,
required this.isFirstLogin,
required this.shouldChangePassword,
required this.profileImagePath,
required this.deviceInfo,
});
@@ -38,7 +38,7 @@ class AuthenticationState {
String? firstName,
String? lastName,
bool? isAdmin,
bool? isFirstLoggedIn,
bool? shouldChangePassword,
String? profileImagePath,
DeviceInfoRemote? deviceInfo,
}) {
@@ -51,17 +51,12 @@ class AuthenticationState {
firstName: firstName ?? this.firstName,
lastName: lastName ?? this.lastName,
isAdmin: isAdmin ?? this.isAdmin,
isFirstLogin: isFirstLoggedIn ?? isFirstLogin,
shouldChangePassword: shouldChangePassword ?? this.shouldChangePassword,
profileImagePath: profileImagePath ?? this.profileImagePath,
deviceInfo: deviceInfo ?? this.deviceInfo,
);
}
@override
String toString() {
return 'AuthenticationState(deviceId: $deviceId, deviceType: $deviceType, userId: $userId, userEmail: $userEmail, isAuthenticated: $isAuthenticated, firstName: $firstName, lastName: $lastName, isAdmin: $isAdmin, isFirstLoggedIn: $isFirstLogin, profileImagePath: $profileImagePath, deviceInfo: $deviceInfo)';
}
Map<String, dynamic> toMap() {
final result = <String, dynamic>{};
@@ -73,7 +68,7 @@ class AuthenticationState {
result.addAll({'firstName': firstName});
result.addAll({'lastName': lastName});
result.addAll({'isAdmin': isAdmin});
result.addAll({'isFirstLogin': isFirstLogin});
result.addAll({'shouldChangePassword': shouldChangePassword});
result.addAll({'profileImagePath': profileImagePath});
result.addAll({'deviceInfo': deviceInfo.toMap()});
@@ -90,7 +85,7 @@ class AuthenticationState {
firstName: map['firstName'] ?? '',
lastName: map['lastName'] ?? '',
isAdmin: map['isAdmin'] ?? false,
isFirstLogin: map['isFirstLogin'] ?? false,
shouldChangePassword: map['shouldChangePassword'] ?? false,
profileImagePath: map['profileImagePath'] ?? '',
deviceInfo: DeviceInfoRemote.fromMap(map['deviceInfo']),
);
@@ -101,6 +96,11 @@ class AuthenticationState {
factory AuthenticationState.fromJson(String source) =>
AuthenticationState.fromMap(json.decode(source));
@override
String toString() {
return 'AuthenticationState(deviceId: $deviceId, deviceType: $deviceType, userId: $userId, userEmail: $userEmail, isAuthenticated: $isAuthenticated, firstName: $firstName, lastName: $lastName, isAdmin: $isAdmin, shouldChangePassword: $shouldChangePassword, profileImagePath: $profileImagePath, deviceInfo: $deviceInfo)';
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
@@ -114,7 +114,7 @@ class AuthenticationState {
other.firstName == firstName &&
other.lastName == lastName &&
other.isAdmin == isAdmin &&
other.isFirstLogin == isFirstLogin &&
other.shouldChangePassword == shouldChangePassword &&
other.profileImagePath == profileImagePath &&
other.deviceInfo == deviceInfo;
}
@@ -129,7 +129,7 @@ class AuthenticationState {
firstName.hashCode ^
lastName.hashCode ^
isAdmin.hashCode ^
isFirstLogin.hashCode ^
shouldChangePassword.hashCode ^
profileImagePath.hashCode ^
deviceInfo.hashCode;
}