refactor: little light renaming

This commit is contained in:
Andy Burke 2025-06-24 16:17:00 -07:00
parent eef7b29223
commit 6f69695758
7 changed files with 31 additions and 31 deletions

View file

@ -1,11 +1,11 @@
import { PASSWORD_ENTRY_STORE } from '../../../models/password_entry.ts';
import { USER, USER_STORE } from '../../../models/user.ts';
import { PASSWORD_ENTRIES } from '../../../models/password_entry.ts';
import { USER, USERS } from '../../../models/user.ts';
import { generateSecret } from 'jsr:@stdext/crypto/utils';
import { encodeBase32 } from 'jsr:@std/encoding';
import { verify } from 'jsr:@stdext/crypto/hash';
import lurid from 'jsr:@andyburke/lurid';
import { SESSION, SESSIONS } from '../../../models/session.ts';
import { TOTP_ENTRY_STORE } from '../../../models/totp_entry.ts';
import { TOTP_ENTRIES } from '../../../models/totp_entry.ts';
import { verifyTotp } from 'jsr:@stdext/crypto/totp';
import { encodeBase64 } from 'jsr:@std/encoding/base64';
import parse_body from '../../../utils/bodyparser.ts';
@ -52,11 +52,11 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
let user: USER | undefined = undefined;
if (email.length) {
user = (await USER_STORE.find({
user = (await USERS.find({
email
})).shift();
} else if (username.length) {
user = (await USER_STORE.find({
user = (await USERS.find({
username
})).shift();
}
@ -72,7 +72,7 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
});
}
const password_entry = await PASSWORD_ENTRY_STORE.get(user.id);
const password_entry = await PASSWORD_ENTRIES.get(user.id);
if (!password_entry) {
return Response.json({
error: {
@ -96,7 +96,7 @@ export async function POST(req: Request, meta: Record<string, any>): Promise<Res
});
}
const totp_entry = await TOTP_ENTRY_STORE.get(user.id);
const totp_entry = await TOTP_ENTRIES.get(user.id);
if (totp_entry) {
if (typeof totp !== 'string' || !totp.length) {
return Response.json({