Block API login if approval is required
This commit is contained in:
parent
6d8b87246e
commit
9cc11fd666
1 changed files with 3 additions and 0 deletions
|
@ -156,6 +156,9 @@ namespace LANCommander.Controllers.Api
|
||||||
{
|
{
|
||||||
if (user != null && await UserManager.CheckPasswordAsync(user, password))
|
if (user != null && await UserManager.CheckPasswordAsync(user, password))
|
||||||
{
|
{
|
||||||
|
if (Settings.Authentication.RequireApproval && !user.Approved)
|
||||||
|
throw new Exception("Account must be approved by an administrator");
|
||||||
|
|
||||||
var userRoles = await UserManager.GetRolesAsync(user);
|
var userRoles = await UserManager.GetRolesAsync(user);
|
||||||
|
|
||||||
var authClaims = new List<Claim>
|
var authClaims = new List<Claim>
|
||||||
|
|
Loading…
Add table
Reference in a new issue