diff --git a/apps/account/views/common.py b/apps/account/views/common.py index 360a1e5a..66ad3fa0 100644 --- a/apps/account/views/common.py +++ b/apps/account/views/common.py @@ -34,8 +34,7 @@ class ChangePasswordView(JWTUpdateAPIView): def get_object(self): """Overridden get_object method.""" - if not self.request.user.is_authenticated(): - queryset = self.filter_queryset(self.get_queryset()) + if not self.request.user.is_authenticated: uidb64 = self.kwargs.get('uidb64') user_id = force_text(urlsafe_base64_decode(uidb64)) @@ -47,7 +46,8 @@ class ChangePasswordView(JWTUpdateAPIView): if not GMTokenGenerator(GMTokenGenerator.RESET_PASSWORD).check_token( user=password_reset_obj.user, token=token): raise utils_exceptions.NotValidAccessTokenError() - # todo: Add is_valid check status + if not password_reset_obj.user.is_active: + raise utils_exceptions.UserNotFoundError() obj = password_reset_obj.user else: obj = self.request.user @@ -58,7 +58,8 @@ class ChangePasswordView(JWTUpdateAPIView): def patch(self, request, *args, **kwargs): """Implement PUT method""" - serializer = self.get_serializer(instance=self.request.user, + instance = self.get_object() + serializer = self.get_serializer(instance=instance, data=request.data) serializer.is_valid(raise_exception=True) serializer.save() diff --git a/apps/utils/exceptions.py b/apps/utils/exceptions.py index b2730b97..5251c4e4 100644 --- a/apps/utils/exceptions.py +++ b/apps/utils/exceptions.py @@ -137,8 +137,8 @@ class WrongAuthCredentials(AuthErrorMixin): class FavoritesError(exceptions.APIException): """ - The exception should be thrown when you item that user - want add to favorites already exists. + The exception should be thrown when item that user + want to add to favorites is already exists. """ status_code = status.HTTP_400_BAD_REQUEST default_detail = _('Item is already in favorites.') diff --git a/project/templates/account/password_reset_email.html b/project/templates/account/password_reset_email.html index b743d71c..c32469f7 100644 --- a/project/templates/account/password_reset_email.html +++ b/project/templates/account/password_reset_email.html @@ -2,10 +2,7 @@ {% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} {% trans "Please go to the following page and choose a new password:" %} -{% block reset_link %} -Reset link. -{% endblock %} - +https://{{ country_code }}.{{ domain_uri }}/recovery/{{ uidb64 }}/{{ token }}/ {% trans "Thanks for using our site!" %} {% blocktrans %}The {{ site_name }} team{% endblocktrans %} diff --git a/project/templates/authorization/confirm_email.html b/project/templates/authorization/confirm_email.html index 9056525d..f3bbd50e 100644 --- a/project/templates/authorization/confirm_email.html +++ b/project/templates/authorization/confirm_email.html @@ -3,7 +3,7 @@ {% trans "Please confirm your email address to complete the registration:" %} -Confirmation link. +https://{{ country_code }}.{{ domain_uri }}/registered/{{ uidb64 }}/{{ token }}/ {% trans "Thanks for using our site!" %}