mirror of
https://github.com/bitwarden/server.git
synced 2024-11-23 12:25:16 +01:00
feat(NewDeviceVerification): adding method to request a new email OTP for Device Verification.
This commit is contained in:
parent
3904a38394
commit
b9e0114931
@ -961,6 +961,20 @@ public class AccountsController : Controller
|
||||
}
|
||||
}
|
||||
|
||||
[RequireFeature("new-device-verification")]
|
||||
[AllowAnonymous]
|
||||
[HttpPost("request-device-verification-otp")]
|
||||
public async Task SendDeviceVerificationEmailOTP(SecretVerificationRequestModel model){
|
||||
var user = await _userService.GetUserByPrincipalAsync(User) ?? throw new UnauthorizedAccessException();
|
||||
if (!await _userService.VerifySecretAsync(user, model.Secret))
|
||||
{
|
||||
await Task.Delay(2000);
|
||||
throw new BadRequestException(string.Empty, "User verification failed.");
|
||||
}
|
||||
|
||||
await _userService.SendOTPAsync(user);
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<Guid>> GetOrganizationIdsManagingUserAsync(Guid userId)
|
||||
{
|
||||
var organizationManagingUser = await _userService.GetOrganizationsManagingUserAsync(userId);
|
||||
|
Loading…
Reference in New Issue
Block a user