Fix ORM API usages in Token subclasses

This commit is contained in:
2026-07-22 22:26:26 -04:00
parent e11e39c23a
commit 1ef868e23c
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -95,7 +95,7 @@ class OtpToken extends Token {
}
static async issue(uid, method) {
const existing = await this.find({uid});
const existing = await this.list({where: {uid}});
for (const t of existing) {
if (t.is_valid) await t.update({is_valid: false});
}
@@ -104,7 +104,7 @@ class OtpToken extends Token {
}
static async verify(uid, code) {
const tokens = await this.listDetail({uid});
const tokens = await this.list({where: {uid}});
const match = tokens.find(t => t.is_valid && !t.isExpired && t.code === code);
if (!match) return null;
await match.update({is_valid: false});