Skip to content

Commit

Permalink
feat: deny login from banned user
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Jul 20, 2022
1 parent 8b8247b commit 869abac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions GZCTF/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ public async Task<IActionResult> LogIn([FromBody] LoginModel model)
if (user is null)
return Unauthorized(new RequestResponse("用户名或密码错误", 401));

if (user.Role == Role.Banned)
return Unauthorized(new RequestResponse("用户已被禁用", 401));

user.LastSignedInUTC = DateTimeOffset.UtcNow;
user.UpdateByHttpContext(HttpContext);

Expand Down

0 comments on commit 869abac

Please sign in to comment.