Decrease timeout limit for verification codes to 5 minutes

This commit is contained in:
sabaimran 2024-12-16 09:07:34 -08:00
parent 5d3da3340f
commit b7783357fa
2 changed files with 2 additions and 2 deletions
src/khoj
database/adapters
interface/email

View file

@ -240,7 +240,7 @@ async def aget_or_create_user_by_email(email: str) -> tuple[KhojUser, bool]:
if user: if user:
# Generate a secure 6-digit numeric code # Generate a secure 6-digit numeric code
user.email_verification_code = f"{secrets.randbelow(1000000):06}" 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() await user.asave()
user_subscription = await Subscription.objects.filter(user=user).afirst() user_subscription = await Subscription.objects.filter(user=user).afirst()

View file

@ -18,7 +18,7 @@
<p style="font-size: 16px; color: #333; margin-bottom: 20px;">Hi!</p> <p style="font-size: 16px; color: #333; margin-bottom: 20px;">Hi!</p>
<p style="font-size: 16px; color: #333; margin-bottom: 20px;">Use this code (valid for 30 minutes) to login to Khoj:</p> <p style="font-size: 16px; color: #333; margin-bottom: 20px;">Use this code (valid for 5 minutes) to login to Khoj:</p>
<h1 style="font-size: 24px; color: #2c3e50; margin-bottom: 20px; text-align: center;">{{ code }}</h1> <h1 style="font-size: 24px; color: #2c3e50; margin-bottom: 20px; text-align: center;">{{ code }}</h1>