mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-10-03 17:30:11 +02:00
parent
29d3c603f2
commit
55d319b527
@ -21,6 +21,14 @@ const User = {
|
|||||||
|
|
||||||
update: async function (userId, updates = {}) {
|
update: async function (userId, updates = {}) {
|
||||||
try {
|
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({
|
await prisma.users.update({
|
||||||
where: { id: parseInt(userId) },
|
where: { id: parseInt(userId) },
|
||||||
data: updates,
|
data: updates,
|
||||||
|
Loading…
Reference in New Issue
Block a user