mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
[Reset Password v1] Update Temporary Password API (#1481)
* [Reset Password v1] Update Temporary Password API * Fixed Noop interface
This commit is contained in:
@ -797,5 +797,28 @@ namespace Bit.Api.Controllers
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("update-temp-password")]
|
||||
public async Task PostUpdateTempPasswordAsync([FromBody]UpdateTempPasswordRequestModel model)
|
||||
{
|
||||
var user = await _userService.GetUserByPrincipalAsync(User);
|
||||
if (user == null)
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
|
||||
var result = await _userService.UpdateTempPasswordAsync(user, model.NewMasterPasswordHash, model.Key);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var error in result.Errors)
|
||||
{
|
||||
ModelState.AddModelError(string.Empty, error.Description);
|
||||
}
|
||||
|
||||
throw new BadRequestException(ModelState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user