Merge branch 'feature/redirect' into develop
# Conflicts: # apps/account/views/common.py # project/templates/account/password_reset_email.html # project/templates/authorization/confirm_email.html
This commit is contained in:
commit
a0ca5ab964
|
|
@ -34,8 +34,7 @@ class ChangePasswordView(JWTUpdateAPIView):
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
"""Overridden get_object method."""
|
"""Overridden get_object method."""
|
||||||
if not self.request.user.is_authenticated():
|
if not self.request.user.is_authenticated:
|
||||||
queryset = self.filter_queryset(self.get_queryset())
|
|
||||||
uidb64 = self.kwargs.get('uidb64')
|
uidb64 = self.kwargs.get('uidb64')
|
||||||
|
|
||||||
user_id = force_text(urlsafe_base64_decode(uidb64))
|
user_id = force_text(urlsafe_base64_decode(uidb64))
|
||||||
|
|
@ -47,7 +46,8 @@ class ChangePasswordView(JWTUpdateAPIView):
|
||||||
if not GMTokenGenerator(GMTokenGenerator.RESET_PASSWORD).check_token(
|
if not GMTokenGenerator(GMTokenGenerator.RESET_PASSWORD).check_token(
|
||||||
user=password_reset_obj.user, token=token):
|
user=password_reset_obj.user, token=token):
|
||||||
raise utils_exceptions.NotValidAccessTokenError()
|
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
|
obj = password_reset_obj.user
|
||||||
else:
|
else:
|
||||||
obj = self.request.user
|
obj = self.request.user
|
||||||
|
|
@ -58,7 +58,8 @@ class ChangePasswordView(JWTUpdateAPIView):
|
||||||
|
|
||||||
def patch(self, request, *args, **kwargs):
|
def patch(self, request, *args, **kwargs):
|
||||||
"""Implement PUT method"""
|
"""Implement PUT method"""
|
||||||
serializer = self.get_serializer(instance=self.request.user,
|
instance = self.get_object()
|
||||||
|
serializer = self.get_serializer(instance=instance,
|
||||||
data=request.data)
|
data=request.data)
|
||||||
serializer.is_valid(raise_exception=True)
|
serializer.is_valid(raise_exception=True)
|
||||||
serializer.save()
|
serializer.save()
|
||||||
|
|
|
||||||
|
|
@ -137,8 +137,8 @@ class WrongAuthCredentials(AuthErrorMixin):
|
||||||
|
|
||||||
class FavoritesError(exceptions.APIException):
|
class FavoritesError(exceptions.APIException):
|
||||||
"""
|
"""
|
||||||
The exception should be thrown when you item that user
|
The exception should be thrown when item that user
|
||||||
want add to favorites already exists.
|
want to add to favorites is already exists.
|
||||||
"""
|
"""
|
||||||
status_code = status.HTTP_400_BAD_REQUEST
|
status_code = status.HTTP_400_BAD_REQUEST
|
||||||
default_detail = _('Item is already in favorites.')
|
default_detail = _('Item is already in favorites.')
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,7 @@
|
||||||
{% blocktrans %}You're receiving this email because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %}
|
{% 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:" %}
|
{% trans "Please go to the following page and choose a new password:" %}
|
||||||
{% block reset_link %}
|
<a href="https://{{ country_code }}.{{ domain_uri }}/recovery/{{ uidb64 }}/{{ token }}/">https://{{ country_code }}.{{ domain_uri }}/recovery/{{ uidb64 }}/{{ token }}/</a>
|
||||||
<a href="https://{{ country_code }}.{{ domain_uri }}/recovery/{{ uidb64 }}/{{ token }}/">Reset link.</a>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% trans "Thanks for using our site!" %}
|
{% trans "Thanks for using our site!" %}
|
||||||
|
|
||||||
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
|
{% blocktrans %}The {{ site_name }} team{% endblocktrans %}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
{% trans "Please confirm your email address to complete the registration:" %}
|
{% trans "Please confirm your email address to complete the registration:" %}
|
||||||
|
|
||||||
<a href="https://{{ country_code }}.{{ domain_uri }}/registered/{{ uidb64 }}/{{ token }}/">Confirmation link.</a>
|
<a href="https://{{ country_code }}.{{ domain_uri }}/registered/{{ uidb64 }}/{{ token }}/">https://{{ country_code }}.{{ domain_uri }}/registered/{{ uidb64 }}/{{ token }}/</a>
|
||||||
|
|
||||||
{% trans "Thanks for using our site!" %}
|
{% trans "Thanks for using our site!" %}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user