Skip to content

Commit

Permalink
small improvment
Browse files Browse the repository at this point in the history
  • Loading branch information
pbgc committed Sep 14, 2020
1 parent b52c7f3 commit 2414999
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
6 changes: 4 additions & 2 deletions jwt_auth/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ def get_jwt_value(request):

if not auth:
if settings.JWT_AUTH_COOKIE:
return request.COOKIES.get(settings.JWT_AUTH_COOKIE)
raise exceptions.AuthenticationFailed()
auth = request.COOKIES.get(settings.JWT_AUTH_COOKIE, None)
if auth is not None:
return auth
raise exceptions.AuthenticationFailed(_("Invalid authorization data."))

if auth[0].lower().decode("utf-8") != auth_header_prefix:
raise exceptions.AuthenticationFailed()
Expand Down
24 changes: 14 additions & 10 deletions locale/pt_PT/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-21 15:36+0100\n"
"POT-Creation-Date: 2020-08-20 18:00+0100\n"
"PO-Revision-Date: 2020-07-21 15:42+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -33,45 +33,49 @@ msgstr "Não foi possível efectuar o login com as credenciais indicadas"
msgid "Must include \"username\" and \"password\""
msgstr "Necessário incluir o \"utilizador\" e a \"password\""

#: jwt_auth/mixins.py:56
#: jwt_auth/mixins.py:52
msgid "Invalid authorization data."
msgstr "Dados de autorização inválidos"

#: jwt_auth/mixins.py:59
msgid "Invalid Authorization header. No credentials provided."
msgstr "Header de autorização inválido. Sem credenciais"

#: jwt_auth/mixins.py:60
#: jwt_auth/mixins.py:63
msgid ""
"Invalid Authorization header. Credentials string should not contain spaces."
msgstr "Header de autorização inválido. Credenciais não podem conter espaços"

#: jwt_auth/mixins.py:68
#: jwt_auth/mixins.py:71
#, fuzzy
msgid "Invalid Token!"
msgstr "Token Inválido!"

#: jwt_auth/mixins.py:72
#: jwt_auth/mixins.py:75
msgid "Signature has expired."
msgstr "A assinatura digital expirou"

#: jwt_auth/mixins.py:74
#: jwt_auth/mixins.py:77
msgid "Error decoding signature."
msgstr "Erro a decodificar a assinatura digital"

#: jwt_auth/mixins.py:89
#: jwt_auth/mixins.py:92
msgid "Invalid payload"
msgstr "Dados inválidos"

#: jwt_auth/mixins.py:91
#: jwt_auth/mixins.py:94
msgid "Invalid signature"
msgstr "Assinatura digital inválida"

#: jwt_auth/views.py:25 jwt_auth/views.py:31
msgid "Improperly formatted request"
msgstr "Request mal formatada"

#: jwt_auth/views.py:94
#: jwt_auth/views.py:95
msgid "Refresh has expired."
msgstr "O tempo de Refresh expirou"

#: jwt_auth/views.py:96
#: jwt_auth/views.py:97
#, fuzzy
msgid "iat field is required."
msgstr "O campo iat é necessário"

0 comments on commit 2414999

Please sign in to comment.