mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 15:17:23 +01:00
Change to synchronous password hashing.
This commit is contained in:
parent
756beb2cf5
commit
b2d04c00ac
5 changed files with 12 additions and 12 deletions
|
|
@ -18,7 +18,7 @@ export default async (req, res) => {
|
|||
const data = {};
|
||||
|
||||
if (password) {
|
||||
data.password = await hashPassword(password);
|
||||
data.password = hashPassword(password);
|
||||
}
|
||||
|
||||
// Only admin can change these fields
|
||||
|
|
@ -51,7 +51,7 @@ export default async (req, res) => {
|
|||
return badRequest(res, 'Account already exists');
|
||||
}
|
||||
|
||||
const created = await createAccount({ username, password: await hashPassword(password) });
|
||||
const created = await createAccount({ username, password: hashPassword(password) });
|
||||
|
||||
return ok(res, created);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ export default async (req, res) => {
|
|||
|
||||
if (req.method === 'POST') {
|
||||
const account = await getAccountById(user_id);
|
||||
const valid = await checkPassword(current_password, account.password);
|
||||
const valid = checkPassword(current_password, account.password);
|
||||
|
||||
if (!valid) {
|
||||
return badRequest(res, 'Current password is incorrect');
|
||||
}
|
||||
|
||||
const password = await hashPassword(new_password);
|
||||
const password = hashPassword(new_password);
|
||||
|
||||
const updated = await updateAccount(user_id, { password });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue