public Task <IsCurrentPasswordExistResponse> IsCurrentPasswordExistAsync(string password, CancellationToken cancellationToken = default(CancellationToken)) => Task <IsCurrentPasswordExistResponse> .Run(async() => { IsCurrentPasswordExistResponse completion = null; try { string url = string.Format(BaseSingleton <GlobalSetting> .Instance.RestEndpoints.IdentityEndpoints.IsCurrentPasswordExist, password); completion = await _requestProvider.GetAsync <IsCurrentPasswordExistResponse>(url, BaseSingleton <GlobalSetting> .Instance.UserProfile.AccesToken, cancellationToken); } catch (ConnectivityException ex) { throw ex; } catch (HttpRequestExceptionEx ex) { completion = JsonConvert.DeserializeObject <IsCurrentPasswordExistResponse>(ex.Message); throw new InvalidOperationException(completion.Message, ex); } catch (Exception ex) { Debug.WriteLine($"ERROR:{ex.Message}"); Debugger.Break(); } return(completion); }, cancellationToken);
protected async override void OnStepCommand() { if (ValidateForm()) { Guid busyKey = Guid.NewGuid(); SetBusy(busyKey, true); ResetCancellationTokenSource(ref _isCurrentPasswordExistCancellationTokenSource); CancellationTokenSource cancellationTokenSource = _isCurrentPasswordExistCancellationTokenSource; try { IsCurrentPasswordExistResponse isValidPasswordExist = await _identityService.IsCurrentPasswordExistAsync(MainInput.Value, cancellationTokenSource.Token); SetBusy(busyKey, false); if (isValidPasswordExist.IsRequestSuccess && (bool)isValidPasswordExist.Data) { await NavigationService.NavigateToAsync <EditPasswordSecondStepViewModel>(new ChangePasswordArgs { CurrentPassword = MainInput.Value }); } else { ServerError = isValidPasswordExist.Message; } } catch (OperationCanceledException) { } catch (ObjectDisposedException) { } catch (ServiceAuthenticationException) { } catch (System.Exception exc) { ServerError = exc.Message; SetBusy(busyKey, false); } } }