Finish MFA v1 and refactor all tokens into separate TokenService with modified collection

This commit is contained in:
Tuan Dang
2023-01-23 22:10:15 +07:00
parent 00fee63ff3
commit 5cadb9e2f9
25 changed files with 692 additions and 98 deletions
+6
View File
@@ -1,4 +1,5 @@
import { Schema, model, Types } from 'mongoose';
import { MFA_METHOD_EMAIL } from '../variables';
export interface IUser {
_id: Types.ObjectId;
@@ -12,6 +13,7 @@ export interface IUser {
salt?: string;
verifier?: string;
refreshVersion?: number;
isMfaEnabled: boolean;
}
const userSchema = new Schema<IUser>(
@@ -54,6 +56,10 @@ const userSchema = new Schema<IUser>(
type: Number,
default: 0,
select: false
},
isMfaEnabled: {
type: Boolean,
default: false
}
},
{