aboutsummaryrefslogtreecommitdiff
path: root/src/server/authentication/DashUserModel.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/authentication/DashUserModel.ts')
-rw-r--r--src/server/authentication/DashUserModel.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/authentication/DashUserModel.ts b/src/server/authentication/DashUserModel.ts
index a1883beab..dbb7a79ed 100644
--- a/src/server/authentication/DashUserModel.ts
+++ b/src/server/authentication/DashUserModel.ts
@@ -2,6 +2,7 @@
import * as bcrypt from 'bcrypt-nodejs';
//@ts-ignore
import * as mongoose from 'mongoose';
+import { Utils } from '../../Utils';
export type DashUserModel = mongoose.Document & {
email: String;
@@ -25,7 +26,7 @@ export type DashUserModel = mongoose.Document & {
comparePassword: comparePasswordFunction;
};
-type comparePasswordFunction = (candidatePassword: string, cb: (err: any, isMatch: any) => {}) => void;
+type comparePasswordFunction = (candidatePassword: string, cb: (err: any, isMatch: any) => void) => void;
export type AuthToken = {
accessToken: string;
@@ -63,7 +64,7 @@ const userSchema = new mongoose.Schema(
* Password hash middleware.
*/
userSchema.pre('save', function save(next) {
- const user = this as DashUserModel;
+ const user = this as any as DashUserModel;
if (!user.isModified('password')) {
return next();
}
@@ -101,7 +102,7 @@ export function initializeGuest() {
new User({
email: 'guest',
password: 'guest',
- userDocumentId: '__guest__',
+ userDocumentId: Utils.GuestID(),
sharingDocumentId: '2',
linkDatabaseId: '3',
cacheDocumentIds: '',