mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-13 06:29:25 +00:00
Add docs for MFA
This commit is contained in:
@@ -68,6 +68,15 @@ export const updateMyMfaEnabled = async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { isMfaEnabled }: { isMfaEnabled: boolean } = req.body;
|
||||
req.user.isMfaEnabled = isMfaEnabled;
|
||||
|
||||
if (isMfaEnabled) {
|
||||
// TODO: adapt this route/controller
|
||||
// to work for different forms of MFA
|
||||
req.user.mfaMethods = ['email'];
|
||||
} else {
|
||||
req.user.mfaMethods = [];
|
||||
}
|
||||
|
||||
await req.user.save();
|
||||
|
||||
user = req.user;
|
||||
|
||||
@@ -17,7 +17,8 @@ export interface IUser {
|
||||
verifier?: string;
|
||||
refreshVersion?: number;
|
||||
isMfaEnabled: boolean;
|
||||
seenIps: [string];
|
||||
mfaMethods: boolean;
|
||||
seenIps: [string]; // TODO 1: email for unseen IPs, TODO 2: move to a central alerting system
|
||||
}
|
||||
|
||||
const userSchema = new Schema<IUser>(
|
||||
@@ -82,8 +83,14 @@ const userSchema = new Schema<IUser>(
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
seenIps: [String]
|
||||
},
|
||||
mfaMethods: [{
|
||||
type: String
|
||||
}],
|
||||
seenIps: {
|
||||
type: [String],
|
||||
default: []
|
||||
}
|
||||
},
|
||||
{
|
||||
timestamps: true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user