mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 10:17:55 +00:00
forget password added
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user