public async Task <IActionResult> ChangePassword([FromBody] ChangePassViewmodel model) { if (User.Identity.IsAuthenticated) { var accountName = HttpContext.GetUsername(); var response = await _requestService.ChangePassword(accountName, model.CurrentPassword.ToL2Password(), model.NewPassword.ToL2Password()); if (response.ResponseCode == 200) { return(Content("ok")); } return(Content(response.ResponseMessage)); } return(Unauthorized()); }
public async Task <IActionResult> ChangePassword([FromBody] ChangePassViewmodel model) { if (User.Identity.IsAuthenticated) { var accountName = HttpContext.GetUsername(); var response = await _requestService.ChangePassword(accountName, model.CurrentPassword.ToLegacyL2Password(), model.NewPassword.ToL2Password()); switch (response.ResponseCode) { case 200: return(Content("ok")); case 500: return(Content(_localizer["Something went wrong!"])); case 501: return(Content(_localizer["Invalid password!"])); } } return(Unauthorized()); }