mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-04-23 21:18:12 +00:00
parent
29d3c603f2
commit
55d319b527
1 changed files with 8 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue