mirror of
https://github.com/gnmyt/LicenseAPI.git
synced 2026-01-11 02:31:46 +00:00
Fix validation controller expiration date
This commit is contained in:
@ -19,7 +19,7 @@ export const validateLicense = async (validationKey: string, licenseKey: string)
|
|||||||
const license = await License.findOne({ projectId: String(project.id), key: licenseKey });
|
const license = await License.findOne({ projectId: String(project.id), key: licenseKey });
|
||||||
if (license === null) return { status: ResponseStatus.INVALID, message: "The provided license key is invalid" };
|
if (license === null) return { status: ResponseStatus.INVALID, message: "The provided license key is invalid" };
|
||||||
|
|
||||||
if (license.expirationDate && license.expirationDate < new Date())
|
if (license.expirationDate && license.expirationDate < new Date() && new Date(license.expirationDate).getTime() !== 0)
|
||||||
return { status: ResponseStatus.EXPIRED, message: "The provided license key has expired" };
|
return { status: ResponseStatus.EXPIRED, message: "The provided license key has expired" };
|
||||||
|
|
||||||
if (license.maxUses && license.maxUses !== -1 && license.maxUses <= license.currentUses)
|
if (license.maxUses && license.maxUses !== -1 && license.maxUses <= license.currentUses)
|
||||||
|
|||||||
Reference in New Issue
Block a user