mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-07-15 22:57:20 +02:00
identity: add support for disabling 2fa
This commit is contained in:
@@ -79,9 +79,12 @@ namespace Streetwriters.Identity.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
public IActionResult Disable2FA()
|
||||
public async Task<IActionResult> Disable2FA()
|
||||
{
|
||||
return BadRequest("2FA is mandatory and cannot be disabled.");
|
||||
var user = await UserManager.GetUserAsync(User) ?? throw new Exception("User not found.");
|
||||
if (!await UserManager.GetTwoFactorEnabledAsync(user)) return Ok();
|
||||
await MFAService.DisableMFAAsync(user);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[HttpGet("codes")]
|
||||
|
||||
Reference in New Issue
Block a user