doResetPassword method
Reset password with token.
Implementation
Future<void> doResetPassword({
required String token,
required String email,
required String password,
required String passwordConfirmation,
}) async {
if (_isSubmitting) return;
_isSubmitting = true;
setLoading();
clearErrors();
try {
final response = await Http.post(
'/auth/reset-password',
data: {
'token': token,
'email': email,
'password': password,
'password_confirmation': passwordConfirmation,
},
);
if (!response.successful) {
handleApiError(response, fallback: trans('auth.password_reset_failed'));
return;
}
setSuccess(true);
} catch (e, stackTrace) {
Log.error('[MagicStarterAuthController.doResetPassword] $e\n$stackTrace');
setError(trans('errors.unexpected'));
} finally {
_isSubmitting = false;
}
}