Skip to content

Commit 238f735

Browse files
committed
fix: remove redundant user existence checks in password reset and registration validation
1 parent cdb493e commit 238f735

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

apps/users/serializers/user.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,11 +1050,6 @@ class Meta:
10501050

10511051
def is_valid(self, *, raise_exception=False):
10521052
super().is_valid(raise_exception=raise_exception)
1053-
user_exists = QuerySet(User).filter(email=self.data.get('email')).exists()
1054-
if not user_exists and self.data.get('type') == 'reset_password':
1055-
raise ExceptionCodeConstants.SEND_EMAIL_ERROR.value.to_app_api_exception()
1056-
elif user_exists and self.data.get('type') == 'register':
1057-
raise ExceptionCodeConstants.SEND_EMAIL_ERROR.value.to_app_api_exception()
10581053
code_cache_key = self.data.get('email') + ":" + self.data.get("type")
10591054
code_cache_key_lock = code_cache_key + "_lock"
10601055
ttl = cache.ttl(code_cache_key_lock, version=version)

0 commit comments

Comments
 (0)