diff --git a/account/serializers.py b/account/serializers.py index a16caa87..8061d5d8 100644 --- a/account/serializers.py +++ b/account/serializers.py @@ -49,4 +49,3 @@ class EditUserSerializer(serializers.Serializer): class ApplyResetPasswordSerializer(serializers.Serializer): email = serializers.EmailField() captcha = serializers.CharField(max_length=4, min_length=4) - diff --git a/account/urls/oj.py b/account/urls/oj.py index 899f26ac..1a663399 100644 --- a/account/urls/oj.py +++ b/account/urls/oj.py @@ -11,5 +11,5 @@ urlpatterns = [ url(r"^register$", UserRegisterAPI.as_view(), name="user_register_api"), url(r"^change_password$", UserChangePasswordAPI.as_view(), name="user_change_password_api"), url(r"^apply_reset_password$", ApplyResetPasswordAPI.as_view(), name="apply_reset_password_api"), - url(r'^reset_password$', ResetPasswordAPI.as_view(), name="apply_reset_password_api") + url(r"^reset_password$", ResetPasswordAPI.as_view(), name="apply_reset_password_api") ] diff --git a/account/urls/user.py b/account/urls/user.py index 518b9529..deba25bc 100644 --- a/account/urls/user.py +++ b/account/urls/user.py @@ -3,9 +3,9 @@ from django.conf.urls import url -from ..views.user import UserInfoAPI ,UserProfileAPI +from ..views.user import UserInfoAPI, UserProfileAPI urlpatterns = [ url(r"^user", UserInfoAPI.as_view(), name="user_info_api"), - url(r"^profile$", UserProfileAPI.as_view(), name="user_profile_api"), + url(r"^profile$", UserProfileAPI.as_view(), name="user_profile_api") ] diff --git a/account/views/oj.py b/account/views/oj.py index 6d47dcb5..1d63f0b4 100644 --- a/account/views/oj.py +++ b/account/views/oj.py @@ -1,11 +1,9 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -import codecs from datetime import timedelta from django.contrib import auth -from django.conf import settings from django.core.exceptions import MultipleObjectsReturned from django.utils.translation import ugettext as _ from django.utils.timezone import now @@ -116,7 +114,7 @@ class ApplyResetPasswordAPI(APIView): except User.DoesNotExist: return self.error(_("User does not exist")) if user.reset_password_token_expire_time and 0 < ( - user.reset_password_token_expire_time - now()).total_seconds() < 20 * 60: + user.reset_password_token_expire_time - now()).total_seconds() < 20 * 60: return self.error(_("You can only reset password once per 20 minutes")) user.reset_password_token = rand_str()