Fixed change password issue. API refactoring. Closes #1592.

This commit is contained in:
Mike Cao 2022-10-25 10:45:56 -07:00
parent 994cf950c8
commit ac070d3ce9
24 changed files with 74 additions and 111 deletions

View file

@ -1,5 +1,5 @@
import { ok, unauthorized, badRequest, checkPassword, createSecureToken } from 'next-basics';
import { getAccountByUsername } from 'queries/admin/account/getAccountByUsername';
import { getAccount } from 'queries';
import { secret } from 'lib/crypto';
export default async (req, res) => {
@ -9,7 +9,7 @@ export default async (req, res) => {
return badRequest(res);
}
const account = await getAccountByUsername(username);
const account = await getAccount({ username });
if (account && checkPassword(password, account.password)) {
const { id, username, isAdmin, accountUuid } = account;