File tree Expand file tree Collapse file tree
dj_rest_auth/registration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -237,18 +237,20 @@ def validate_username(self, username):
237237
238238 def validate_email (self , email ):
239239 email = get_adapter ().clean_email (email )
240+
240241 if allauth_account_settings .UNIQUE_EMAIL :
241242 existing_email = EmailAddress .objects .filter (email = email ).first ()
243+
242244 if existing_email :
243- if existing_email .verified :
244- raise serializers .ValidationError (
245- "A user is already registered with this email address."
246- )
247- elif allauth_account_settings .EMAIL_VERIFICATION == \
245+ if not existing_email .verified and allauth_account_settings .EMAIL_VERIFICATION == \
248246 allauth_account_settings .EmailVerificationMethod .MANDATORY :
249247 raise serializers .ValidationError (
250248 "This email is already in use but has not been verified."
251249 )
250+ raise serializers .ValidationError (
251+ "A user is already registered with this email address."
252+ )
253+
252254 return email
253255
254256 def validate_password1 (self , password ):
You can’t perform that action at this time.
0 commit comments