Fix bug where expiry date "0" was assigned if none was present
This commit is contained in:
parent
9e36bf75c0
commit
44786a1dd2
|
@ -44,7 +44,7 @@ export const POST: APIRoute = async({ request }) => {
|
||||||
const username = Buffer.from(data.username).toString('base64url');
|
const username = Buffer.from(data.username).toString('base64url');
|
||||||
const random = randomBytes(16).toString("base64url");
|
const random = randomBytes(16).toString("base64url");
|
||||||
const randomHashed = createHash("sha256").update(random).digest("hex");
|
const randomHashed = createHash("sha256").update(random).digest("hex");
|
||||||
const expiresIn = data.duration * 1000 ?? 86400000
|
const expiresIn = (data.duration ?? 86400) * 1000;
|
||||||
|
|
||||||
const tokenString = `A.${timestamp}.${username}.${random}`;
|
const tokenString = `A.${timestamp}.${username}.${random}`;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue