mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 07:04:54 +00:00
password_changes&_routine_changes
This commit is contained in:
@ -237,22 +237,26 @@ class AuthCubit extends Cubit<AuthState> {
|
||||
}
|
||||
}
|
||||
|
||||
sendOtp() async {
|
||||
sendOtp({bool? isforget}) async {
|
||||
try {
|
||||
emit(AuthLoading());
|
||||
await AuthenticationAPI.sendOtp(
|
||||
body: {'email': email, 'type': 'VERIFICATION'});
|
||||
await AuthenticationAPI.sendOtp(body: {
|
||||
'email': email,
|
||||
'type': isforget == true ? 'PASSWORD' : 'VERIFICATION'
|
||||
});
|
||||
emit(AuthSignUpSuccess());
|
||||
} catch (_) {
|
||||
emit(AuthLoginError(message: 'Something went wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> reSendOtp() async {
|
||||
Future<bool> reSendOtp({bool? forget}) async {
|
||||
try {
|
||||
emit(AuthLoading());
|
||||
await AuthenticationAPI.sendOtp(
|
||||
body: {'email': email, 'type': 'VERIFICATION'});
|
||||
await AuthenticationAPI.sendOtp(body: {
|
||||
'email': email,
|
||||
'type': forget == true ? 'PASSWORD' : 'VERIFICATION'
|
||||
});
|
||||
emit(ResendOtpSuccess());
|
||||
return true;
|
||||
} catch (_) {
|
||||
@ -264,8 +268,11 @@ class AuthCubit extends Cubit<AuthState> {
|
||||
verifyOtp(bool isForgotPass) async {
|
||||
emit(AuthLoginLoading());
|
||||
try {
|
||||
final response = await AuthenticationAPI.verifyPassCode(
|
||||
body: {'email': email, 'type': 'VERIFICATION', 'otpCode': otpCode});
|
||||
final response = await AuthenticationAPI.verifyPassCode(body: {
|
||||
'email': email,
|
||||
'type': isForgotPass == true ? 'PASSWORD' : 'VERIFICATION',
|
||||
'otpCode': otpCode
|
||||
});
|
||||
if (response['statusCode'] == 200) {
|
||||
if (!isForgotPass) {
|
||||
emailController.text = email;
|
||||
@ -340,7 +347,9 @@ class AuthCubit extends Cubit<AuthState> {
|
||||
sendToForgetPassword({required String password}) async {
|
||||
try {
|
||||
emit(AuthForgetPassLoading());
|
||||
await AuthenticationAPI.forgetPassword(email: email, password: password);
|
||||
|
||||
await AuthenticationAPI.forgetPassword(
|
||||
email: email, password: password, otpCode: otpCode);
|
||||
emit(AuthForgetPassSuccess());
|
||||
} catch (_) {
|
||||
emit(AuthForgetPassError(message: 'Something went wrong'));
|
||||
|
||||
Reference in New Issue
Block a user