Move to bcryptjs from bcrypt
This commit is contained in:
parent
88277d2d3f
commit
051da89b4d
3 changed files with 68 additions and 471 deletions
|
|
@ -1,7 +1,16 @@
|
|||
import bcrypt from 'bcrypt'
|
||||
import bcrypt from 'bcryptjs'
|
||||
import { Document, model, Schema, Types } from 'mongoose'
|
||||
|
||||
const UserSchema = new Schema({
|
||||
export type UserModel = Document & {
|
||||
username: string,
|
||||
password: string,
|
||||
configs: string[],
|
||||
generateHash: (password: string) => string,
|
||||
validPassword: (password: string) => string,
|
||||
changePassword: (password: string, newPassword: string) => void
|
||||
}
|
||||
|
||||
const UserSchema: Schema<UserModel> = new Schema({
|
||||
username: String,
|
||||
password: String,
|
||||
configs: [{
|
||||
|
|
@ -23,13 +32,4 @@ UserSchema.methods.changePassword = function (password: string, newPassword: str
|
|||
}
|
||||
}
|
||||
|
||||
export type UserModel = Document & {
|
||||
username: string,
|
||||
password: string,
|
||||
configs: string[],
|
||||
generateHash: (password: string) => string,
|
||||
validPassword: (password: string) => string,
|
||||
changePassword: (password: string, newPassword: string) => void
|
||||
}
|
||||
|
||||
export default model<UserModel>('users', UserSchema, 'users')
|
||||
Loading…
Reference in a new issue