diff --git a/.travis.yml b/.travis.yml index 20d3e82..7abff7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ env: - DJANGO=1.11 - DJANGO=2.0 - DJANGO=2.1 + - DJANGO=2.2 - DJANGO=master matrix: exclude: @@ -19,13 +20,14 @@ matrix: - { python: "pypy", env: DJANGO=2.0 } - { python: "2.7", env: DJANGO=2.1 } - { python: "pypy", env: DJANGO=2.1 } + - { python: "2.7", env: DJANGO=2.2 } + - { python: "pypy", env: DJANGO=2.2 } - { python: "2.7", env: DJANGO=master } - { python: "pypy", env: DJANGO=master } # Django >= 2.1 does not support Python3.4 anymore - { python: "3.4", env: DJANGO=2.1 } + - { python: "3.4", env: DJANGO=2.2 } - { python: "3.4", env: DJANGO=master } - # Django >= 2.2 does not support Python 3.5 anymore - - { python: "3.5", env: DJANGO=master } allow_failures: # newer python versions aswell as pypy may also always break our build - python: "pypy" diff --git a/django_rest_passwordreset/management/commands/clearresetpasswodtokens.py b/django_rest_passwordreset/management/commands/clearresetpasswodtokens.py index b5f258e..dc97514 100644 --- a/django_rest_passwordreset/management/commands/clearresetpasswodtokens.py +++ b/django_rest_passwordreset/management/commands/clearresetpasswodtokens.py @@ -10,4 +10,4 @@ class Command(BaseCommand): def handle(self, *args, **options): # datetime.now minus expiry hours now_minus_expiry_time = timezone.now() - timedelta(hours=get_password_reset_token_expiry_time()) - clear_expired(now_minus_expiry_time) \ No newline at end of file + clear_expired(now_minus_expiry_time) diff --git a/django_rest_passwordreset/models.py b/django_rest_passwordreset/models.py index b788624..870df52 100644 --- a/django_rest_passwordreset/models.py +++ b/django_rest_passwordreset/models.py @@ -15,6 +15,12 @@ # get the token generator class TOKEN_GENERATOR_CLASS = get_token_generator() +__all__ = [ + 'ResetPasswordToken', + 'get_password_reset_token_expiry_time', + 'clear_expired', +] + @python_2_unicode_compatible class ResetPasswordToken(models.Model): diff --git a/django_rest_passwordreset/serializers.py b/django_rest_passwordreset/serializers.py index 81f5460..315dcf3 100644 --- a/django_rest_passwordreset/serializers.py +++ b/django_rest_passwordreset/serializers.py @@ -2,6 +2,11 @@ from rest_framework import serializers +__all__ = [ + 'EmailSerializer', + 'PasswordTokenSerializer', +] + class EmailSerializer(serializers.Serializer): email = serializers.EmailField() @@ -9,4 +14,4 @@ class EmailSerializer(serializers.Serializer): class PasswordTokenSerializer(serializers.Serializer): password = serializers.CharField(label=_("Password"), style={'input_type': 'password'}) - token = serializers.CharField() \ No newline at end of file + token = serializers.CharField() diff --git a/django_rest_passwordreset/signals.py b/django_rest_passwordreset/signals.py index 53e7d79..7ded02c 100644 --- a/django_rest_passwordreset/signals.py +++ b/django_rest_passwordreset/signals.py @@ -1,5 +1,11 @@ import django.dispatch +__all__ = [ + 'reset_password_token_created', + 'pre_password_reset', + 'post_password_reset', +] + reset_password_token_created = django.dispatch.Signal( providing_args=["reset_password_token"], ) diff --git a/django_rest_passwordreset/views.py b/django_rest_passwordreset/views.py index a379a6c..69df07e 100644 --- a/django_rest_passwordreset/views.py +++ b/django_rest_passwordreset/views.py @@ -16,6 +16,13 @@ User = get_user_model() +__all__ = [ + 'ResetPasswordConfirm', + 'ResetPasswordRequestToken', + 'reset_password_confirm', + 'reset_password_request_token' +] + class ResetPasswordConfirm(GenericAPIView): """ @@ -52,7 +59,11 @@ def post(self, request, *args, **kwargs): if reset_password_token.user.has_usable_password(): pre_password_reset.send(sender=self.__class__, user=reset_password_token.user) try: - validate_password(password, user=reset_password_token.user, password_validators=get_password_validators(settings.AUTH_PASSWORD_VALIDATORS)) + validate_password( + password, + user=reset_password_token.user, + password_validators=get_password_validators(settings.AUTH_PASSWORD_VALIDATORS) + ) except ValidationError as e: raise serializers.ValidationError(e.messages) diff --git a/setup.cfg b/setup.cfg index f48fdad..b17cb20 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,9 @@ [metadata] description-file = README.md license_file = LICENSE + + +[pycodestyle] +ignore = E402,E722 +max-line-length = 120 +exclude = *migrations*, *tests*, *settings* diff --git a/setup.py b/setup.py index 348170a..ac25528 100644 --- a/setup.py +++ b/setup.py @@ -10,11 +10,11 @@ setup( name='django-rest-passwordreset', - version='1.0.0alpha1', + version='1.0.0alpha2', packages=find_packages(), include_package_data=True, license='BSD License', - description='An extension of django rest framework, providing a password reset strategy', + description='An extension of django rest framework, providing a configurable password reset strategy', long_description=README, long_description_content_type='text/markdown', # This is important for README.md in markdown format url='https://github.com/anx-ckreuzberger/django-rest-passwordreset', @@ -27,6 +27,7 @@ 'Framework :: Django :: 1.11', 'Framework :: Django :: 2.0', 'Framework :: Django :: 2.1', + 'Framework :: Django :: 2.2', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', diff --git a/tox.ini b/tox.ini index 1f57b7a..00ba49a 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ envlist = {py27,py34,py35,py36,pypy,pypy3}-django111-{drf35,drf36,drf37,drf38,drf39}, {py34,py35,py36,pypy3}-django20-{drf37,drf38,drf39}, {py35,py36,pypy3}-django21-{drf37,drf38,drf39}, + {py35,py36,pypy3}-django22-{drf38,drf39}, {py35,py36,pypy3}-djangomaster-{drf38,drf39} [travis:env] @@ -10,6 +11,7 @@ DJANGO = 1.11: django111 2.0: django20 2.1: django21 + 2.2: django22 master: djangomaster [testenv] @@ -30,5 +32,5 @@ deps = django111: Django>=1.11,<2.0 django20: Django>=2.0,<2.1 django21: Django>=2.1,<2.2 - django22: Django>=2.2,<3 + django22: Django>=2.2rc1,<3 djangomaster: https://github.com/django/django/archive/master.tar.gz