This commit is contained in:
@@ -67,7 +67,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
if (serverState.IsClosed && AyaNova.Core.License.ActiveKey.KeyDoesNotNeedAttention)
|
||||
{
|
||||
{
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
}
|
||||
|
||||
@@ -169,11 +169,13 @@ namespace AyaNova.Api.Controllers
|
||||
//check if server closed
|
||||
//if it is it means we got here only because there is no license
|
||||
//and only *the* SuperUser account can login now
|
||||
if(serverState.IsClosed){
|
||||
if (serverState.IsClosed)
|
||||
{
|
||||
//if not SuperUser account then boot closed
|
||||
//SuperUser account is always ID 1
|
||||
if(u.Id!=1){
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (u.Id != 1)
|
||||
{
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
}
|
||||
}
|
||||
//Restrict auth due to server state?
|
||||
@@ -222,9 +224,16 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
//save auth token to ensure single sign on only
|
||||
u.CurrentAuthToken = token;
|
||||
|
||||
u.LastLogin = DateTime.UtcNow;
|
||||
|
||||
await ct.SaveChangesAsync();
|
||||
|
||||
log.LogDebug($"User number \"{u.Id}\" logged in from \"{Util.StringUtil.MaskIPAddress(HttpContext.Connection.RemoteIpAddress.ToString())}\" ok");
|
||||
//KEEP this, masked version of IP address
|
||||
//Not sure if this is necessary or not but if it turns out to be then make it a boot option
|
||||
// log.LogInformation($"User number \"{u.Id}\" logged in from \"{Util.StringUtil.MaskIPAddress(HttpContext.Connection.RemoteIpAddress.ToString())}\" ok");
|
||||
|
||||
log.LogInformation($"User \"{u.Name}\" logged in from \"{HttpContext.Connection.RemoteIpAddress.ToString()}\" ok");
|
||||
|
||||
|
||||
return Ok(ApiOkResponse.Response(new
|
||||
|
||||
Reference in New Issue
Block a user