mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Refactor database queries.
This commit is contained in:
parent
a248f35db2
commit
f4ca353b5c
24 changed files with 371 additions and 329 deletions
|
|
@ -1,13 +1,13 @@
|
|||
import { serialize } from 'cookie';
|
||||
import { checkPassword, createSecureToken } from 'lib/crypto';
|
||||
import { getAccount } from 'lib/db';
|
||||
import { getAccountByUsername } from 'lib/queries';
|
||||
import { AUTH_COOKIE_NAME } from 'lib/constants';
|
||||
import { ok, unauthorized } from 'lib/response';
|
||||
|
||||
export default async (req, res) => {
|
||||
const { username, password } = req.body;
|
||||
|
||||
const account = await getAccount({ username });
|
||||
const account = await getAccountByUsername(username);
|
||||
|
||||
if (account && (await checkPassword(password, account.password))) {
|
||||
const { user_id, username, is_admin } = account;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue