mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 08:37:13 +01:00
Added lib/password. Small tweaks.
Some checks failed
Node.js CI / build (postgresql, 18.18) (push) Has been cancelled
Some checks failed
Node.js CI / build (postgresql, 18.18) (push) Has been cancelled
This commit is contained in:
parent
9ccafc390a
commit
baba06c692
6 changed files with 28 additions and 19 deletions
11
src/lib/password.ts
Normal file
11
src/lib/password.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import bcrypt from 'bcryptjs';
|
||||
|
||||
const SALT_ROUNDS = 10;
|
||||
|
||||
export function hashPassword(password: string, rounds = SALT_ROUNDS) {
|
||||
return bcrypt.hashSync(password, rounds);
|
||||
}
|
||||
|
||||
export function checkPassword(password: string, passwordHash: string) {
|
||||
return bcrypt.compareSync(password, passwordHash);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue