@@ -60,9 +60,7 @@ async def setup_totp(
6060 - Microsoft Authenticator
6161 - Any TOTP-compatible authenticator app
6262 """
63- from uuid import UUID
64-
65- command = SetupTOTPCommand (user_id = UUID (current_user_id ))
63+ command = SetupTOTPCommand (user_id = int (current_user_id ))
6664 result = await handler .execute (command )
6765
6866 return SuccessResponse (
@@ -88,10 +86,8 @@ async def verify_totp_setup(
8886 After scanning the QR code, submit the 6-digit code from your authenticator app
8987 to complete the setup. This will return backup codes - store them safely!
9088 """
91- from uuid import UUID
92-
9389 command = VerifyTOTPSetupCommand (
94- user_id = UUID (current_user_id ),
90+ user_id = int (current_user_id ),
9591 code = request .code ,
9692 )
9793 result = await handler .execute (command )
@@ -118,10 +114,8 @@ async def disable_totp(
118114
119115 Requires either a current TOTP code or a backup code to verify identity.
120116 """
121- from uuid import UUID
122-
123117 command = DisableTOTPCommand (
124- user_id = UUID (current_user_id ),
118+ user_id = int (current_user_id ),
125119 code = request .code ,
126120 )
127121 result = await handler .execute (command )
@@ -152,9 +146,7 @@ async def send_email_2fa_code(
152146 Alternative to TOTP for users who prefer email-based verification.
153147 The code will expire in 10 minutes.
154148 """
155- from uuid import UUID
156-
157- command = SendEmail2FACodeCommand (user_id = UUID (current_user_id ))
149+ command = SendEmail2FACodeCommand (user_id = int (current_user_id ))
158150 result = await handler .execute (command )
159151
160152 if result :
@@ -179,10 +171,8 @@ async def verify_email_2fa_code(
179171 handler : VerifyEmail2FACodeHandler = Depends (get_verify_email_2fa_code_handler ),
180172):
181173 """Verify an email-based 2FA code."""
182- from uuid import UUID
183-
184174 command = VerifyEmail2FACodeCommand (
185- user_id = UUID (current_user_id ),
175+ user_id = int (current_user_id ),
186176 code = request .code ,
187177 )
188178 result = await handler .execute (command )
@@ -215,10 +205,8 @@ async def regenerate_backup_codes(
215205 This will invalidate all previous backup codes and generate new ones.
216206 Requires a current TOTP code for verification.
217207 """
218- from uuid import UUID
219-
220208 command = RegenerateBackupCodesCommand (
221- user_id = UUID (current_user_id ),
209+ user_id = int (current_user_id ),
222210 verify_code = request .verify_code ,
223211 )
224212 result = await handler .execute (command )
@@ -246,10 +234,8 @@ async def verify_2fa(
246234 Used in the login flow when 2FA is required.
247235 Supports TOTP, email, and backup code methods.
248236 """
249- from uuid import UUID
250-
251237 command = Verify2FACommand (
252- user_id = UUID (current_user_id ),
238+ user_id = int (current_user_id ),
253239 code = request .code ,
254240 method = request .method ,
255241 )
0 commit comments