From 1b58ebd4dbdbff1d04418215041adf61b7da2831 Mon Sep 17 00:00:00 2001 From: i701 Date: Sun, 8 Jun 2025 14:39:52 +0500 Subject: [PATCH] Add user existence check before sending verification token in update_alias_verification --- djangopasswordlessknox/signals.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/djangopasswordlessknox/signals.py b/djangopasswordlessknox/signals.py index 381dfdb..a7b39f8 100644 --- a/djangopasswordlessknox/signals.py +++ b/djangopasswordlessknox/signals.py @@ -76,6 +76,7 @@ def update_alias_verification(sender, instance, **kwargs): if ( api_settings.PASSWORDLESS_AUTO_SEND_VERIFICATION_TOKEN is True + and User.objects.filter(id=instance.id).exists() ): email_subject = ( api_settings.PASSWORDLESS_EMAIL_VERIFICATION_SUBJECT @@ -133,6 +134,7 @@ def update_alias_verification(sender, instance, **kwargs): if ( api_settings.PASSWORDLESS_AUTO_SEND_VERIFICATION_TOKEN is True + and User.objects.filter(id=instance.id).exists() ): mobile_message = api_settings.PASSWORDLESS_MOBILE_MESSAGE message_payload = {"mobile_message": mobile_message}