mirror of
https://github.com/lemeow125/DocManagerBackend.git
synced 2025-04-27 18:21:23 +08:00
Minor fixes to registration and emails
This commit is contained in:
parent
463e33d219
commit
65662aeb45
2 changed files with 5 additions and 3 deletions
|
@ -46,9 +46,9 @@ class CustomUserRegistrationSerializer(serializers.ModelSerializer):
|
|||
raise serializers.ValidationError({"password": errors[0]})
|
||||
else:
|
||||
raise serializers.ValidationError({"password": errors})
|
||||
if self.Meta.model.objects.filter(username=attrs.get("username")).exists():
|
||||
if self.Meta.model.objects.filter(username=attrs.get("email")).exists():
|
||||
raise serializers.ValidationError(
|
||||
"A user with that username already exists."
|
||||
"A user with that email already exists."
|
||||
)
|
||||
return super().validate(attrs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue