Esempio n. 1
0
        public async Task <IActionResult> Put([FromBody] UpdateUserRequest request)
        {
            CreditUnionUser currentUser = await _userManager.GetUserAsync(_httpContextAccessor.HttpContext.User);

            IdentityResult result = await _userManager.UpdateContactInformation(currentUser, request);

            if (!result.Succeeded)
            {
                ModelState.AddIdentityErrorsToModelState(result);
                return(BadRequest(ModelState));
            }

            return(Ok());
        }
Esempio n. 2
0
        public async Task <IActionResult> ChangePassword([FromBody] ChangePasswordRequest request)
        {
            CreditUnionUser currentUser = await _userManager.GetUserAsync(_httpContextAccessor.HttpContext.User);

            IdentityResult result = await _userManager.ChangePasswordAsync(currentUser, request.CurrentPassword, request.NewPassword);

            if (!result.Succeeded)
            {
                ModelState.AddIdentityErrorsToModelState(result);
                return(BadRequest(ModelState));
            }

            return(Ok());
        }