Skip to content
Snippets Groups Projects
Unverified Commit 55d319b5 authored by Timothy Carambat's avatar Timothy Carambat Committed by GitHub
Browse files

Rehash password for admin-user pwd updates (#398)

resolved #397
parent 29d3c603
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,14 @@ const User = {
update: async function (userId, updates = {}) {
try {
// Rehash new password if it exists as update
// will be given to us as plaintext.
if (updates.hasOwnProperty("password") && updates.password.length >= 8) {
updates.password = bcrypt.hashSync(updates.password, 10);
} else {
delete updates.password;
}
await prisma.users.update({
where: { id: parseInt(userId) },
data: updates,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment