1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 00:22:50 -05:00

get recovery code api

This commit is contained in:
Kyle Spearrin
2017-06-24 17:16:05 -04:00
parent a0fb1e0907
commit eea2ae30b4
3 changed files with 33 additions and 1 deletions

View File

@ -253,9 +253,17 @@ namespace Bit.Api.Controllers
return response;
}
[HttpPost("get-recover")]
public async Task<TwoFactorRecoverResponseModel> GetRecover([FromBody]TwoFactorRequestModel model)
{
var user = await CheckPasswordAsync(model.MasterPasswordHash);
var response = new TwoFactorRecoverResponseModel(user);
return response;
}
[HttpPost("recover")]
[AllowAnonymous]
public async Task PostTwoFactorRecover([FromBody]TwoFactorRecoveryRequestModel model)
public async Task PostRecover([FromBody]TwoFactorRecoveryRequestModel model)
{
if(!await _userService.RecoverTwoFactorAsync(model.Email, model.MasterPasswordHash, model.RecoveryCode))
{