From b7783357faec136162c68cbd72765c06e9715cf3 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Mon, 16 Dec 2024 09:07:34 -0800 Subject: [PATCH] Decrease timeout limit for verification codes to 5 minutes --- src/khoj/database/adapters/__init__.py | 2 +- src/khoj/interface/email/magic_link.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/khoj/database/adapters/__init__.py b/src/khoj/database/adapters/__init__.py index 140680a4..82f3cda4 100644 --- a/src/khoj/database/adapters/__init__.py +++ b/src/khoj/database/adapters/__init__.py @@ -240,7 +240,7 @@ async def aget_or_create_user_by_email(email: str) -> tuple[KhojUser, bool]: if user: # Generate a secure 6-digit numeric code user.email_verification_code = f"{secrets.randbelow(1000000):06}" - user.email_verification_code_expiry = datetime.now(tz=timezone.utc) + timedelta(minutes=30) + user.email_verification_code_expiry = datetime.now(tz=timezone.utc) + timedelta(minutes=5) await user.asave() user_subscription = await Subscription.objects.filter(user=user).afirst() diff --git a/src/khoj/interface/email/magic_link.html b/src/khoj/interface/email/magic_link.html index f553a815..72a65679 100644 --- a/src/khoj/interface/email/magic_link.html +++ b/src/khoj/interface/email/magic_link.html @@ -18,7 +18,7 @@

Hi!

-

Use this code (valid for 30 minutes) to login to Khoj:

+

Use this code (valid for 5 minutes) to login to Khoj:

{{ code }}