Commit 582ab86e authored by Michael Fladischer's avatar Michael Fladischer

Import djoser_0.4.3.orig.tar.gz

parent bd8569ee
Metadata-Version: 1.1
Name: djoser
Version: 0.4.2
Version: 0.4.3
Summary: REST version of Django authentication system.
Home-page: https://github.com/sunscrapers/djoser
Author: SUNSCRAPERS
......
Metadata-Version: 1.1
Name: djoser
Version: 0.4.2
Version: 0.4.3
Summary: REST version of Django authentication system.
Home-page: https://github.com/sunscrapers/djoser
Author: SUNSCRAPERS
......
......@@ -3,6 +3,7 @@ from django.utils.translation import ugettext_lazy as _
INVALID_CREDENTIALS_ERROR = _('Unable to login with provided credentials.')
INACTIVE_ACCOUNT_ERROR = _('User account is disabled.')
INVALID_TOKEN_ERROR = _('Invalid token for given user.')
INVALID_UID_ERROR = _('Invalid user id or user doesn\'t exist.')
STALE_TOKEN_ERROR = _('Stale token for given user.')
PASSWORD_MISMATCH_ERROR = _('The two password fields didn\'t match.')
USERNAME_MISMATCH_ERROR = _('The two {0} fields didn\'t match.')
......
......@@ -33,7 +33,11 @@ class UserRegistrationSerializer(serializers.ModelSerializer):
)
def create(self, validated_data):
return User.objects.create_user(**validated_data)
user = User.objects.create_user(**validated_data)
if settings.get('SEND_ACTIVATION_EMAIL'):
user.is_active = False
user.save(update_fields=['is_active'])
return user
class LoginSerializer(serializers.Serializer):
......@@ -69,6 +73,7 @@ class UidAndTokenSerializer(serializers.Serializer):
default_error_messages = {
'invalid_token': constants.INVALID_TOKEN_ERROR,
'invalid_uid': constants.INVALID_UID_ERROR,
}
def validate_uid(self, value):
......@@ -76,7 +81,7 @@ class UidAndTokenSerializer(serializers.Serializer):
uid = utils.decode_uid(value)
self.user = User.objects.get(pk=uid)
except (User.DoesNotExist, ValueError, TypeError, OverflowError) as error:
raise serializers.ValidationError(str(error))
raise serializers.ValidationError(self.error_messages['invalid_uid'])
return value
def validate(self, attrs):
......
[egg_info]
tag_build =
tag_svn_revision = 0
tag_date = 0
tag_svn_revision = 0
......@@ -22,7 +22,7 @@ def get_requirements(file_name):
setup(
name='djoser',
version='0.4.2',
version='0.4.3',
packages=get_packages('djoser'),
license='MIT',
author='SUNSCRAPERS',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment