public virtual async Task <ApiResult> PostPasswordHintAsync(PasswordHintRequest requestObj) { if (!Connectivity.IsConnected) { return(HandledNotConnected()); } using (var client = HttpService.Client) { var requestMessage = new TokenHttpRequestMessage(requestObj) { Method = HttpMethod.Post, RequestUri = new Uri(client.BaseAddress, string.Concat(ApiRoute, "/password-hint")), }; try { var response = await client.SendAsync(requestMessage).ConfigureAwait(false); if (!response.IsSuccessStatusCode) { return(await HandleErrorAsync(response).ConfigureAwait(false)); } return(ApiResult.Success(response.StatusCode)); } catch (WebException) { return(HandledWebException()); } } }
private async Task SubmitAsync() { if (string.IsNullOrWhiteSpace(EmailCell.Entry.Text)) { await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, AppResources.EmailAddress), AppResources.Ok); return; } var request = new PasswordHintRequest { Email = EmailCell.Entry.Text }; _userDialogs.ShowLoading("Submitting...", MaskType.Black); var response = await _accountApiRepository.PostPasswordHintAsync(request); _userDialogs.HideLoading(); if (!response.Succeeded) { await DisplayAlert(AppResources.AnErrorHasOccurred, response.Errors.FirstOrDefault()?.Message, AppResources.Ok); return; } else { await DisplayAlert(null, "We've sent you an email with your master password hint. ", AppResources.Ok); } await Navigation.PopAsync(); }
private async Task SubmitAsync() { if (string.IsNullOrWhiteSpace(EmailCell.Entry.Text)) { await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired, AppResources.EmailAddress), AppResources.Ok); return; } var request = new PasswordHintRequest { Email = EmailCell.Entry.Text }; await _deviceActionService.ShowLoadingAsync(AppResources.Submitting); var response = await _accountApiRepository.PostPasswordHintAsync(request); await _deviceActionService.HideLoadingAsync(); if (!response.Succeeded) { await DisplayAlert(AppResources.AnErrorHasOccurred, response.Errors.FirstOrDefault()?.Message, AppResources.Ok); return; } else { await DisplayAlert(null, AppResources.PasswordHintAlert, AppResources.Ok); } await Navigation.PopAsync(); }
public Task SendHint(string email) { var requ = new PasswordHintRequest { Email = email, }; return(_apiService.PostPasswordHintAsync(requ)); }
public Task PostPasswordHintAsync(PasswordHintRequest request) { return(SendAsync <PasswordHintRequest, object>(HttpMethod.Post, "/accounts/password-hint", request, false, false)); }