Skip to content

Commit

Permalink
Add docs for MFA
Browse files Browse the repository at this point in the history
  • Loading branch information
dangtony98 committed Feb 21, 2023
1 parent 469d042 commit 7cb6aee
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 5 deletions.
9 changes: 9 additions & 0 deletions backend/src/controllers/v2/usersController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 10 additions & 3 deletions backend/src/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>(
Expand Down Expand Up @@ -82,8 +83,14 @@ const userSchema = new Schema<IUser>(
type: Boolean,
default: false
},
seenIps: [String]
},
mfaMethods: [{
type: String
}],
seenIps: {
type: [String],
default: []
}
},
{
timestamps: true
}
Expand Down
2 changes: 0 additions & 2 deletions docs/getting-started/dashboard/integrations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ description: "How to sync your secrets among various 3rd-party services with Inf

Integrations allow environment variables to be synced across your entire infrastructure from local development to CI/CD and production.

We're still relatively early with integrations. 6+ integrations are already avaiable but expect more coming very soon.

<Card title="View integrations" icon="link" href="/integrations/overview">
View all available integrations and their guides
</Card>
Expand Down
18 changes: 18 additions & 0 deletions docs/getting-started/dashboard/mfa.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: "MFA"
description: "Secure your Infisical account with MFA"
---

MFA requires users to provide multiple forms of identification to access their account. Currently, this means logging in with your password and a 6-digit code sent to your email.

## Email 2FA

Check the box in Personal Settings > Two-factor Authentication to enable email-based 2FA.

![Email-based MFA](../../images/mfa-email.png)

<Note>
Infisical currently supports email-based 2FA. We're actively working on
building support for other forms of identification via SMS and Authenticator
App.
</Note>
Binary file added docs/images/mfa-email.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"getting-started/dashboard/pit-recovery",
"getting-started/dashboard/secret-versioning",
"getting-started/dashboard/audit-logs",
"getting-started/dashboard/mfa",
"getting-started/dashboard/token"
]
},
Expand Down

0 comments on commit 7cb6aee

Please sign in to comment.