This commit is contained in:
2020-06-13 18:12:13 +00:00
parent 0f1a529ec4
commit dd4a4cb68c
2 changed files with 26 additions and 21 deletions

View File

@@ -98,7 +98,7 @@ namespace AyaNova.Api.Controllers
[HttpPost]
public async Task<IActionResult> FetchLicense()
{
if (serverState.IsClosed)
if (serverState.IsClosed)
{
//Exception for SuperUser account to handle licensing issues
if (UserIdFromContext.Id(HttpContext.Items) != 1)
@@ -116,7 +116,11 @@ namespace AyaNova.Api.Controllers
try
{
await AyaNova.Core.License.FetchKeyAsync(serverState, ct, log);
var ret = await AyaNova.Core.License.FetchKeyAsync(serverState, ct, log, false);
//Log
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.License, AyaEvent.LicenseFetch), ct);
return Ok(ret);
}
catch (Exception ex)
{
@@ -126,7 +130,6 @@ namespace AyaNova.Api.Controllers
rootex = rootex.InnerException;
}
if (rootex.Message.Contains("E1020"))
{
return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, "LICENSE_KEY", rootex.Message));
@@ -137,11 +140,6 @@ namespace AyaNova.Api.Controllers
}
}
var ret = AyaNova.Core.License.LicenseInfoAsJson;
//Log
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.License, AyaEvent.LicenseFetch), ct);
return Ok(ApiOkResponse.Response(ret));
}
@@ -210,7 +208,7 @@ namespace AyaNova.Api.Controllers
[HttpPost("permanently-erase-all-data")]
public async Task<IActionResult> RemoveAllData([FromBody] string acceptCode)
{
if (serverState.IsClosed)
if (serverState.IsClosed)
{
//Exception for SuperUser account to handle licensing issues
if (UserIdFromContext.Id(HttpContext.Items) != 1)
@@ -243,7 +241,7 @@ namespace AyaNova.Api.Controllers
//------------------------------------------------------