Skip to content

Commit

Permalink
Add missed ugettext_lazys (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
hakancelikdev committed Jan 2, 2023
1 parent 35b534b commit f3ad806
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions dj_rest_auth/jwt_auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.conf import settings
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from rest_framework import exceptions, serializers
from rest_framework.authentication import CSRFCheck
from rest_framework_simplejwt.authentication import JWTAuthentication
Expand Down Expand Up @@ -64,7 +65,7 @@ def unset_jwt_cookies(response):


class CookieTokenRefreshSerializer(TokenRefreshSerializer):
refresh = serializers.CharField(required=False, help_text='WIll override cookie.')
refresh = serializers.CharField(required=False, help_text=_('WIll override cookie.'))

def extract_refresh_token(self):
request = self.context['request']
Expand All @@ -75,7 +76,7 @@ def extract_refresh_token(self):
return request.COOKIES.get(cookie_name)
else:
from rest_framework_simplejwt.exceptions import InvalidToken
raise InvalidToken('No valid refresh token found.')
raise InvalidToken(_('No valid refresh token found.'))

def validate(self, attrs):
attrs['refresh'] = self.extract_refresh_token()
Expand Down
4 changes: 2 additions & 2 deletions dj_rest_auth/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ def validate(self, attrs):
uid = force_str(uid_decoder(attrs['uid']))
self.user = UserModel._default_manager.get(pk=uid)
except (TypeError, ValueError, OverflowError, UserModel.DoesNotExist):
raise ValidationError({'uid': ['Invalid value']})
raise ValidationError({'uid': [_('Invalid value')]})

if not default_token_generator.check_token(self.user, attrs['token']):
raise ValidationError({'token': ['Invalid value']})
raise ValidationError({'token': [_('Invalid value')]})

self.custom_validation(attrs)
# Construct SetPasswordForm instance
Expand Down

0 comments on commit f3ad806

Please sign in to comment.