Added a default token to the Session.ts model
This commit is contained in:
parent
379bbbcd9f
commit
08b7bd5373
@ -1,6 +1,6 @@
|
||||
import {model, ObjectId, Schema, Types} from "mongoose";
|
||||
import { fieldEncryption } from "mongoose-field-encryption";
|
||||
import process from "process";
|
||||
import crypto from "crypto";
|
||||
|
||||
interface ISession {
|
||||
id: ObjectId,
|
||||
@ -18,7 +18,7 @@ const SessionSchema = new Schema<ISession>({
|
||||
},
|
||||
token: {
|
||||
type: String,
|
||||
required: true
|
||||
default: () => crypto.randomBytes(48).toString('hex')
|
||||
},
|
||||
ip: String,
|
||||
userAgent: String,
|
||||
|
Loading…
x
Reference in New Issue
Block a user