Add docs for MFA

This commit is contained in:
Tuan Dang
2023-02-21 16:08:09 +07:00
parent 469d042f4b
commit 7cb6aee3f7
6 changed files with 38 additions and 5 deletions
@@ -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;