Fixed logic errors, removed dev leftovers

Fixed a logic error where a comma was used instead of an or, also
removed leftover console.logs from testing.

Date picker is now dissabled when don't expire is checked.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
pull/2558/head
Matthew Nickson 2 years ago
parent d553c4c4f7
commit 01c71a0242
No known key found for this signature in database
GPG Key ID: BF229DCFD4748E05

@ -47,14 +47,16 @@ async function validateAPIKey(key) {
let index = key.substring(0, key.indexOf("-")); let index = key.substring(0, key.indexOf("-"));
let clear = key.substring(key.indexOf("-") + 1, key.length); let clear = key.substring(key.indexOf("-") + 1, key.length);
console.log(index);
console.log(clear);
let hash = await R.findOne("api_key", " id=? ", [ index ]); let hash = await R.findOne("api_key", " id=? ", [ index ]);
if (hash === null) {
return false;
}
let current = dayjs(); let current = dayjs();
let expiry = dayjs(hash.expires); let expiry = dayjs(hash.expires);
if (expiry.diff(current) < 0, !hash.active) { if (expiry.diff(current) < 0 || !hash.active) {
return false; return false;
} }

@ -711,5 +711,6 @@
"apiKey-inactive": "Inactive", "apiKey-inactive": "Inactive",
"Expires": "Expires", "Expires": "Expires",
"disableAPIKeyMsg": "Are you sure you want to disable this API key?", "disableAPIKeyMsg": "Are you sure you want to disable this API key?",
"deleteAPIKeyMsg": "Are you sure you want to delete this API key?" "deleteAPIKeyMsg": "Are you sure you want to delete this API key?",
"Generate": "Generate"
} }

@ -28,6 +28,7 @@
format="yyyy-MM-dd HH:mm" format="yyyy-MM-dd HH:mm"
modelType="yyyy-MM-dd HH:mm:ss" modelType="yyyy-MM-dd HH:mm:ss"
:required="!noExpire" :required="!noExpire"
:disabled="noExpire"
/> />
<div class="form-check mb-2"> <div class="form-check mb-2">
@ -46,7 +47,7 @@
id="monitor-submit-btn" class="btn btn-primary" type="submit" id="monitor-submit-btn" class="btn btn-primary" type="submit"
:disabled="processing" :disabled="processing"
> >
{{ $t("Save") }} {{ $t("Generate") }}
</button> </button>
</div> </div>
</div> </div>

Loading…
Cancel
Save