corrected serializer bug
This commit is contained in:
parent
7754722a4a
commit
b04792a828
@ -1,4 +0,0 @@
|
|||||||
COUCHDB_USER=admin
|
|
||||||
COUCHDB_PASSWORD=GoodMorning123!
|
|
||||||
COUCHDB_SECRET=GentlemanlyWarfare
|
|
||||||
NODENAME=couchdb_p00003
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
DEBUG=1
|
|
||||||
SECRET_KEY=Express.123
|
|
||||||
DJANGO_ALLOWED_HOSTS=192.168.0.234 localhost 127.0.0.1 [::1]
|
|
||||||
DJANGO_SUPERUSER_USERNAME=admin
|
|
||||||
DJANGO_SUPERUSER_PASSWORD=GoodMorning123!
|
|
||||||
POSTGRESQL_ENGINE=django.db.backends.postgresql
|
|
||||||
POSTGRESQL_DATABASE=main_db
|
|
||||||
POSTGRESQL_USER=admin
|
|
||||||
POSTGRESQL_PASSWORD=GoodMorning123!
|
|
||||||
POSTGRESQL_HOST=p00003postgres
|
|
||||||
POSTGRESQL_PORT=5432
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
PGADMIN_DEFAULT_EMAIL=admin@domeitsolutions.com
|
|
||||||
PGADMIN_DEFAULT_PASSWORD=GoodMorning123!
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
POSTGRES_USER=admin
|
|
||||||
POSTGRES_PASSWORD=GoodMorning123!
|
|
||||||
POSTGRES_DB=main_db
|
|
||||||
@ -19,9 +19,9 @@ class UserRegistrationSerializer(serializers.ModelSerializer):
|
|||||||
extra_kwargs = {'password': {'write_only': True}}
|
extra_kwargs = {'password': {'write_only': True}}
|
||||||
|
|
||||||
def validate(self, attrs):
|
def validate(self, attrs):
|
||||||
if [attrs.password1] != [attrs.password2]:
|
if attrs['password1'] != attrs['password2']:
|
||||||
raise serializers.ValidationError("Passwords must match")
|
raise serializers.ValidationError("Passwords must match")
|
||||||
password = attrs.get("password1", "")
|
password = attrs.get('password1', '')
|
||||||
if len(password) < 8:
|
if len(password) < 8:
|
||||||
raise serializers.ValidationError(
|
raise serializers.ValidationError(
|
||||||
"Passwords must be at least 8 characters")
|
"Passwords must be at least 8 characters")
|
||||||
@ -29,8 +29,8 @@ class UserRegistrationSerializer(serializers.ModelSerializer):
|
|||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
password = validated_data.pop("password1")
|
password = validated_data.pop('password1')
|
||||||
validated_data.pop("password2")
|
validated_data.pop('password2')
|
||||||
|
|
||||||
return CustomUser.objects.create_user(
|
return CustomUser.objects.create_user(
|
||||||
password=password,
|
password=password,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user