Skip to content

Commit

Permalink
Added __all__ statements to the relevant files
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianKreuzberger committed Mar 24, 2019
1 parent 92f8f6e commit 6a0b4c8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
clear_expired(now_minus_expiry_time)
6 changes: 6 additions & 0 deletions django_rest_passwordreset/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 6 additions & 1 deletion django_rest_passwordreset/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

from rest_framework import serializers

__all__ = [
'EmailSerializer',
'PasswordTokenSerializer',
]


class EmailSerializer(serializers.Serializer):
email = serializers.EmailField()


class PasswordTokenSerializer(serializers.Serializer):
password = serializers.CharField(label=_("Password"), style={'input_type': 'password'})
token = serializers.CharField()
token = serializers.CharField()
6 changes: 6 additions & 0 deletions django_rest_passwordreset/signals.py
Original file line number Diff line number Diff line change
@@ -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"],
)
Expand Down
13 changes: 12 additions & 1 deletion django_rest_passwordreset/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@

User = get_user_model()

__all__ = [
'ResetPasswordConfirm',
'ResetPasswordRequestToken',
'reset_password_confirm',
'reset_password_request_token'
]


class ResetPasswordConfirm(GenericAPIView):
"""
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 6a0b4c8

Please sign in to comment.