otp: added missing tests

This commit is contained in:
dswbx
2025-11-10 10:17:16 +01:00
parent c2f4f92d1a
commit c57f3e8070
2 changed files with 381 additions and 13 deletions
+2 -2
View File
@@ -5,13 +5,13 @@ import {
enumm,
Exception,
text,
DatabaseEvents,
type App,
type AppPlugin,
type DB,
type FieldSchema,
type MaybePromise,
type EntityConfig,
DatabaseEvents,
} from "bknd";
import { invariant, s, jsc, HttpStatus, threwAsync, randomString, $console } from "bknd/utils";
import { Hono } from "hono";
@@ -342,7 +342,7 @@ async function invalidateAllUserCodes(app: App, entityName: string, email: strin
await em
.mutator(entityName)
.updateWhere(
{ expires_at: new Date(Date.now() - ttl * 1000) },
{ expires_at: new Date(Date.now() - 1000) },
{ email, used_at: { $isnull: true } },
);
}