1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-16 02:28:13 -05:00

move private method to bottom

This commit is contained in:
Kyle Spearrin 2017-09-11 23:07:27 -04:00
parent e189e8cc79
commit a3a03c7974

View File

@ -10,7 +10,6 @@ using Bit.Core.Models.Table;
using Bit.Core.Enums; using Bit.Core.Enums;
using System.Linq; using System.Linq;
using Bit.Core; using Bit.Core;
using Newtonsoft.Json;
namespace Bit.Api.Controllers namespace Bit.Api.Controllers
{ {
@ -145,24 +144,6 @@ namespace Bit.Api.Controllers
return response; return response;
} }
public async Task ValidateYubiKeyAsync(User user, string name, string value)
{
if(string.IsNullOrWhiteSpace(value) || value.Length == 12)
{
return;
}
if(!await _userManager.VerifyTwoFactorTokenAsync(user, TwoFactorProviderType.YubiKey.ToString(), value))
{
await Task.Delay(2000);
throw new BadRequestException(name, $"{name} is invalid.");
}
else
{
await Task.Delay(500);
}
}
[HttpPost("get-email")] [HttpPost("get-email")]
public async Task<TwoFactorEmailResponseModel> GetEmail([FromBody]TwoFactorRequestModel model) public async Task<TwoFactorEmailResponseModel> GetEmail([FromBody]TwoFactorRequestModel model)
{ {
@ -265,5 +246,23 @@ namespace Bit.Api.Controllers
return user; return user;
} }
private async Task ValidateYubiKeyAsync(User user, string name, string value)
{
if(string.IsNullOrWhiteSpace(value) || value.Length == 12)
{
return;
}
if(!await _userManager.VerifyTwoFactorTokenAsync(user, TwoFactorProviderType.YubiKey.ToString(), value))
{
await Task.Delay(2000);
throw new BadRequestException(name, $"{name} is invalid.");
}
else
{
await Task.Delay(500);
}
}
} }
} }