Example #1
0
        public async Task <CanChangeForgottenPassword> CanUserChangeForgottenPasswordAsync(string phoneNumber, string name, CancellationToken cancellationToken = default(CancellationToken)) =>
        await Task.Run(async() => {
            CanChangeForgottenPassword result = null;

            string url = string.Format(BaseSingleton <GlobalSetting> .Instance.RestEndpoints.IdentityEndpoints.CanUserChangeForgottenPasswordEndPoint,
                                       phoneNumber,
                                       name);
            try {
                result = await _requestProvider.GetAsync <CanChangeForgottenPassword>(url);
            }
            catch (ConnectivityException ex) {
                throw ex;
            }
            catch (HttpRequestExceptionEx ex) {
                throw ex;
            }
            catch (Exception ex) {
                Debug.WriteLine($"ERROR:{ex.Message}");
                Debugger.Break();
            }
            return(result);
        }, cancellationToken);
Example #2
0
        protected async override void OnStepCommand()
        {
            if (ValidateForm())
            {
                Guid busyKey = Guid.NewGuid();
                SetBusy(busyKey, true);

                try {
                    ResetCancellationTokenSource(ref _canUserChangeForgottenPasswordCancellationTokenSource);
                    CancellationTokenSource cancellationTokenSource = _canUserChangeForgottenPasswordCancellationTokenSource;

                    CanChangeForgottenPassword canChangeForgottenPassword = null;

                    canChangeForgottenPassword = await _identityService.CanUserChangeForgottenPasswordAsync(_forgotPasswordArgs?.PhoneNumber, MainInput.Value, cancellationTokenSource.Token);

                    if (canChangeForgottenPassword != null)
                    {
                        if (canChangeForgottenPassword.IsRequestSuccess)
                        {
                            _forgotPasswordArgs.UserName = MainInput.Value;
                            await NavigationService.NavigateToAsync <ForgotPasswordSecondStepViewModel>(_forgotPasswordArgs);
                        }
                        else
                        {
                            ServerError = canChangeForgottenPassword.Message;
                        }
                    }
                }
                catch (Exception ex) {
                    ServerError = ex.Message;
                    Debug.WriteLine($"ERROR:{ex.Message}");
                    Debugger.Break();
                }
                SetBusy(busyKey, false);
            }
        }