Exemple #1
0
        public async Task ConfirmEmailAsync(EmailConfirmationDto emailConfirmationDto)
        {
            using (var response = await _httpClient.PostAsJsonAsync($"api/users/{emailConfirmationDto.Id}/confirm-email", emailConfirmationDto))
            {
                if (response.IsSuccessStatusCode)
                {
                    return;
                }

                throw await ApiException.FromHttpResponse(response);
            }
        }
Exemple #2
0
        public async Task <User> CreateUserAsync(RegistrationFormDto registrationFormDto)
        {
            using (var response = await _httpClient.PostAsJsonAsync("api/users", registrationFormDto))
            {
                if (response.IsSuccessStatusCode)
                {
                    return(await ProcessResponse <User>(response));
                }

                throw await ApiException.FromHttpResponse(response);
            }
        }
Exemple #3
0
        public async Task CompletePasswordResetAsync(string userName, string token, string password)
        {
            var body = new
            {
                Token       = token,
                UserName    = userName,
                NewPassword = password
            };

            using (var response = await _httpClient.PostAsJsonAsync($"api/users/{userName}/complete-password-reset", body))
            {
                if (response.IsSuccessStatusCode)
                {
                    return;
                }

                throw await ApiException.FromHttpResponse(response);
            }
        }
Exemple #4
0
        public async Task ResetPasswordAsync(string userName, string loginUrl)
        {
            var body = new
            {
                CompletionUrl = _actionUrlGeneratorService.GetUrl(nameof(PasswordResetController.CompletePasswordResetGet), new
                {
                    LoginUrl = loginUrl ?? string.Empty
                })
            };

            using (var response = await _httpClient.PostAsJsonAsync($"api/users/{userName}/reset-password", body))
            {
                if (response.IsSuccessStatusCode)
                {
                    return;
                }

                throw await ApiException.FromHttpResponse(response);
            }
        }