summary refs log tree commit diff
path: root/src/api/routes/users/@me/mfa/totp
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/routes/users/@me/mfa/totp')
-rw-r--r--src/api/routes/users/@me/mfa/totp/enable.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/api/routes/users/@me/mfa/totp/enable.ts b/src/api/routes/users/@me/mfa/totp/enable.ts
index 19836e4d..5471e0b5 100644
--- a/src/api/routes/users/@me/mfa/totp/enable.ts
+++ b/src/api/routes/users/@me/mfa/totp/enable.ts
@@ -18,6 +18,7 @@
 
 import { route } from "@spacebar/api";
 import {
+	AuthenticatorType,
 	TotpEnableSchema,
 	User,
 	generateMfaBackupCodes,
@@ -74,7 +75,14 @@ router.post(
 		await Promise.all(backup_codes.map((x) => x.save()));
 		await User.update(
 			{ id: req.user_id },
-			{ mfa_enabled: true, totp_secret: body.secret },
+			{
+				mfa_enabled: true,
+				totp_secret: body.secret,
+				authenticator_types: [
+					...user.authenticator_types,
+					AuthenticatorType.TOTP,
+				],
+			},
 		);
 
 		res.send({