forget password added

This commit is contained in:
mohammad
2024-06-25 10:54:42 +03:00
parent bc3cd66096
commit 08d3ff3e0f
9 changed files with 445 additions and 4 deletions
+29
View File
@@ -22,11 +22,14 @@ class AuthCubit extends Cubit<AuthState> {
String fullName = '';
String email = '';
String forgetPasswordEmail = '';
String signUpPassword = '';
String newPassword = '';
String maskedEmail = '';
String otpCode = '';
final loginFormKey = GlobalKey<FormState>();
final signUpFormKey = GlobalKey<FormState>();
final checkemailFormKey = GlobalKey<FormState>();
bool isPasswordVisible = false;
bool showValidationMessage = false;
@@ -107,6 +110,18 @@ class AuthCubit extends Cubit<AuthState> {
}
}
String? reEnterPasswordCheckForgetPass(String? value) {
passwordValidator(value);
if (newPassword == value) {
// if (signUpFormKey.currentState != null) {
// signUpFormKey.currentState!.save();
// }
return null;
} else {
return 'Passwords do not match';
}
}
String? emailAddressValidator(String? value) {
if (value != null && value.isNotEmpty && value != "") {
if (checkValidityOfEmail(value)) {
@@ -303,4 +318,18 @@ class AuthCubit extends Cubit<AuthState> {
emit(AuthTokenError(message: "Something went wrong"));
}
}
sendToForgetPassword({required String password}) async {
try {
emit(AuthForgetPassLoading());
await AuthenticationAPI.forgetPassword(email:email ,password: password);
emit(AuthForgetPassSuccess());
} catch (_) {
emit(AuthForgetPassError(message: 'Something went wrong'));
}
}
}
+13
View File
@@ -51,3 +51,16 @@ class AuthTokenSuccess extends AuthSuccess {}
class AuthTokenError extends AuthError {
AuthTokenError({required super.message, super.code});
}
//ForgetPassword log states
class AuthForgetPassLoading extends AuthLoading {}
class AuthForgetPassSuccess extends AuthSuccess {}
class AuthForgetPassError extends AuthError {
AuthForgetPassError({required super.message, super.code});
}