diff options
author | bobzel <zzzman@gmail.com> | 2025-06-26 10:53:54 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2025-06-26 10:53:54 -0400 |
commit | baae27b205356898c5866a0f095e4ec056e02459 (patch) | |
tree | 1b62de5579b8de8be81b6d342a9767f0f379bb91 /src/server/authentication/DashUserModel.ts | |
parent | ccfdf905400cd4b81d8cde0f16bb0e15cd65621b (diff) | |
parent | 0093370a04348ef38b91252d02ab850f25d753b2 (diff) |
Merge branch 'master' into agent-paper-main
Diffstat (limited to 'src/server/authentication/DashUserModel.ts')
-rw-r--r-- | src/server/authentication/DashUserModel.ts | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/server/authentication/DashUserModel.ts b/src/server/authentication/DashUserModel.ts index debeef60c..6fd8dd593 100644 --- a/src/server/authentication/DashUserModel.ts +++ b/src/server/authentication/DashUserModel.ts @@ -2,9 +2,10 @@ import * as bcrypt from 'bcrypt-nodejs'; import * as mongoose from 'mongoose'; import { Utils } from '../../Utils'; -type comparePasswordFunction = (candidatePassword: string, cb: (err: any, isMatch: any) => void) => void; -export type DashUserModel = mongoose.Document & { - email: String; +type comparePasswordFunction = (candidatePassword: string, cb: (err: Error, isMatch: boolean) => void) => void; +type mongooseDocument = { id: string }; // & mongoose.Document; +export type DashUserModel = mongooseDocument & { + email: string; password: string; passwordResetToken?: string; passwordResetExpires?: Date; @@ -65,12 +66,13 @@ const userSchema = new mongoose.Schema( /** * Password hash middleware. */ -userSchema.pre('save', function save(next) { +// eslint-disable-next-line @typescript-eslint/no-explicit-any +userSchema.pre('save', function save(next: any) { const user = this; if (!user.isModified('password')) { return next(); } - bcrypt.genSalt(10, (err: any, salt: string) => { + bcrypt.genSalt(10, (err: Error, salt: string) => { if (err) { return next(err); } @@ -102,7 +104,7 @@ const comparePassword: comparePasswordFunction = function (this: DashUserModel, userSchema.methods.comparePassword = comparePassword; -const User: any = mongoose.model('User', userSchema); +const User = mongoose.model('User', userSchema); export function initializeGuest() { new User({ email: 'guest', |