/// <summary> /// Change User password /// </summary> /// <param name="inputDto"></param> /// <returns></returns> public async Task ChangePassword(UserPasswordChangeInputDTO inputDto) { UserEntity foundUser = await this.userRepository.GetUser(inputDto.UserId); byte[] passwordHash, passwordSalt; this.authService.CreatePasswordHash(inputDto.Password, out passwordHash, out passwordSalt); foundUser.passwordSalt = passwordSalt; foundUser.passwordHash = passwordHash; foundUser.PasswordChanged = true; await this.userRepository.UpdateUser(foundUser); }
public async Task <ActionResult <CommonSuccessMessageOutputDTO> > ChangePassword([FromBody] UserPasswordChangeInputDTO inputDto) { try { await this.userService.ChangePassword(inputDto); return(new CommonSuccessMessageOutputDTO() { Success = true }); } catch (Exception ex) { return(BadRequest(new { message = new List <string> { ex.Message } })); } }