diff options
Diffstat (limited to 'server/queries/link.ts')
-rw-r--r-- | server/queries/link.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/server/queries/link.ts b/server/queries/link.ts index 38c9a0e..e892df8 100644 --- a/server/queries/link.ts +++ b/server/queries/link.ts @@ -180,6 +180,11 @@ export const batchRemove = async (match: Match<Link>) => { }; export const update = async (match: Partial<Link>, update: Partial<Link>) => { + if (update.password) { + const salt = await bcrypt.genSalt(12); + update.password = await bcrypt.hash(update.password, salt); + } + const links = await knex<Link>("links") .where(match) .update({ ...update, updated_at: new Date().toISOString() }, "*"); |