1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00
pigallery2/backend/model/PasswordHelper.ts

13 lines
328 B
TypeScript
Raw Normal View History

2017-07-11 09:01:59 +02:00
import * as bcrypt from "bcryptjs";
2017-07-09 22:36:25 +02:00
export class PasswordHelper {
2017-07-11 09:01:59 +02:00
public static cryptPassword(password) {
const salt = bcrypt.genSaltSync(10);
return bcrypt.hashSync(password, salt);
2017-07-09 22:36:25 +02:00
}
2017-07-11 09:01:59 +02:00
public static comparePassword(password, encryptedPassword) {
return bcrypt.compareSync(password, encryptedPassword);
2017-07-09 22:36:25 +02:00
}
}