private async Task OnContinue()
        {
            try
            {
                IsBusy = true;
                if (string.IsNullOrWhiteSpace(_phone))
                {
                    await Alert.ShowMessage(nameof(AppResources.PleaseEnterPhone).Translate());

                    return;
                }
#if DEBUG
                await Nav.NavigateTo(new PasswordResetCodeConfirmationPage(_phone, Guid.NewGuid()));
#endif
                var context = new PasswordResetPhoneQueryContext
                {
                    PhoneNumber = _phone
                };
                var result = await Api.SendPasswordResetPhone(context);

                if (!result.Successful.GetValueOrDefault() || result.ValidationErrors.Any())
                {
                    await Alert.DisplayApiCallError(result.ExceptionMessage, result.ValidationErrors);

                    return;
                }
                if (!result.Data.HasValue)
                {
                    await Alert.ShowMessage(nameof(AppResources.PhoneNotVerified).Translate());

                    return;
                }

                var confirmationGuid = result.Data.Value;


                await Nav.NavigateTo(new PasswordResetCodeConfirmationPage(_phone, confirmationGuid));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #2
0
        private async Task OnContinue()
        {
            try
            {
                IsBusy = true;
                if (string.IsNullOrWhiteSpace(_verificationCode))
                {
                    await Alert.ShowMessage(nameof(AppResources.PleaseEnterVerificationCode).Translate());

                    return;
                }
                if (string.IsNullOrWhiteSpace(_password))
                {
                    await Alert.ShowMessage(nameof(AppResources.PleaseEnterPassword).Translate());

                    return;
                }
                if (string.IsNullOrWhiteSpace(_confirmPassword))
                {
                    await Alert.ShowMessage(nameof(AppResources.PleaseEnterPassordVerification).Translate());

                    return;
                }

                if (_password != _confirmPassword)
                {
                    await Alert.ShowMessage(nameof(AppResources.PasswordAndConfirmationDontMatch).Translate());

                    return;
                }

                var context = new PasswordResetPhoneQueryContext
                {
                    PhoneNumber  = _phone,
                    Verification = new VerifyCodeQueryContext
                    {
                        Code = _verificationCode,
                        VerificationCodeId = _confirmationGuid
                    }
                };
                var result = await Api.ResetPasswordPhone(context);

                if (!result.Successful.GetValueOrDefault())
                {
                    await Alert.DisplayApiCallError(result.ExceptionMessage, result.ValidationErrors);

                    return;
                }

                if (!result.Data.GetValueOrDefault())
                {
                    await Alert.ShowMessage(nameof(AppResources.PhoneNotVerified).Translate());

                    return;
                }

                await Nav.Nav.PopToRootAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #3
0
 public async Task <ApiResponseOfGuid> SendPasswordResetPhone(
     PasswordResetPhoneQueryContext context)
 {
     return(await AXClient.Instance.SendPasswordResetPhoneAsync(context).ConfigureAwait(false));
 }