mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-04-09 03:14:24 +03:00
Compare commits
56 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cdd04aa9be | ||
|
146777283e | ||
|
3c36004c44 | ||
|
0ad457cea6 | ||
|
624ad01afb | ||
|
04c692bba6 | ||
|
4cf813262f | ||
|
bd843f9460 | ||
|
07d2bd5c56 | ||
|
998b2b1fbc | ||
|
c7ff94ced7 | ||
|
ac44fbe07a | ||
|
39252820f7 | ||
|
043cb85374 | ||
|
f39d93042e | ||
|
d2cd31a560 | ||
|
11e877ba50 | ||
|
64b5572172 | ||
|
bb3b082895 | ||
|
5c556cd09a | ||
|
22a76d91ac | ||
|
51d6bf4542 | ||
|
c7cc41e07c | ||
|
a3d38f4c59 | ||
|
e891a76c3f | ||
|
25b94db0cc | ||
|
c437ca22ff | ||
|
9913f8eb03 | ||
|
ca39ba7ea9 | ||
|
f5fe62ce91 | ||
|
5d318b3a4b | ||
|
479a40d2cc | ||
|
25263b3e4a | ||
|
834e4c4747 | ||
|
f5fcf9f083 | ||
|
4b07c3ca92 | ||
|
691c73d556 | ||
|
f0941b4cc2 | ||
|
033ee8f483 | ||
|
53f901b3c8 | ||
|
3af4f1a343 | ||
|
b778a5085b | ||
|
98212a83f5 | ||
|
fa3000e8bd | ||
|
b9fd4aba96 | ||
|
a1845aef43 | ||
|
db60e43397 | ||
|
90760548f6 | ||
|
95fafe5e0f | ||
|
801bad7c61 | ||
|
a3057b7aa1 | ||
|
46fd16700a | ||
|
2672263100 | ||
|
18e98d333b | ||
|
6da0703b0d | ||
|
3f7035eb68 |
77
.gitignore
vendored
77
.gitignore
vendored
|
@ -1,26 +1,35 @@
|
|||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
bin/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
@ -30,28 +39,66 @@ pip-delete-this-directory.txt
|
|||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
coverage_html
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Mr Developer
|
||||
.mr.developer.cfg
|
||||
.project
|
||||
.pydevproject
|
||||
|
||||
# Rope
|
||||
.ropeproject
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
*.pot
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
.DS_Store
|
||||
db.sqlite3
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# IntelliJ IDE files
|
||||
.idea
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
|
|
@ -4,9 +4,10 @@ python:
|
|||
- "3.5"
|
||||
- "3.6"
|
||||
env:
|
||||
- DJANGO=1.8.* DRF=3.6.*
|
||||
- DJANGO=1.11.* DRF=3.7.*
|
||||
- DJANGO=1.11.* DRF=3.8.*
|
||||
- DJANGO=2.0.* DRF=3.7.*
|
||||
- DJANGO=2.0.* DRF=3.8.*
|
||||
install:
|
||||
- pip install -q Django==$DJANGO djangorestframework==$DRF
|
||||
- pip install coveralls
|
||||
|
@ -21,3 +22,5 @@ matrix:
|
|||
exclude:
|
||||
- python: "2.7"
|
||||
env: DJANGO=2.0.* DRF=3.7.*
|
||||
- python: "2.7"
|
||||
env: DJANGO=2.0.* DRF=3.8.*
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
===========
|
||||
Deprecated
|
||||
===========
|
||||
Please use https://github.com/iMerica/dj-rest-auth as this project is no longer maintained. Thanks!
|
||||
|
||||
|
||||
Welcome to django-rest-auth
|
||||
===========================
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
django>=1.9.0
|
||||
django-rest-auth==0.9.3
|
||||
django-rest-auth==0.9.5
|
||||
djangorestframework>=3.7.0
|
||||
django-allauth>=0.24.1
|
||||
six==1.9.0
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
--editable .
|
||||
responses>=0.5.0
|
||||
djangorestframework-jwt
|
||||
django-allauth
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
0.9.5
|
||||
-----
|
||||
- fixed package distribution issue
|
||||
|
||||
0.9.4
|
||||
-----
|
||||
- Compatibility fixes (#437, #506)
|
||||
- JWT auth cookie fix (#345)
|
||||
- config & packaging fixes
|
||||
- updated docs
|
||||
- added new translations (Czech, Chinese, Turkish, Korean)
|
||||
|
||||
0.9.3
|
||||
-----
|
||||
- added social connect views
|
||||
|
|
|
@ -44,16 +44,16 @@ master_doc = 'index'
|
|||
|
||||
# General information about the project.
|
||||
project = u'django-rest-auth'
|
||||
copyright = u'2014, Tivix Inc.'
|
||||
copyright = u'2018, Tivix Inc.'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.3.0'
|
||||
version = '0.9.5'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.3.0'
|
||||
release = '0.9.5'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -131,7 +131,7 @@ Twitter
|
|||
|
||||
If you are using Twitter for your social authentication, it is a bit different since Twitter uses OAuth 1.0.
|
||||
|
||||
3. Create new view as a subclass of ``rest_auth.views.LoginView`` with ``TwitterOAuthAdapter`` adapter and ``TwitterLoginSerializer`` as an attribute:
|
||||
3. Create new view as a subclass of ``rest_auth.registration.views.SocialLoginView`` with ``TwitterOAuthAdapter`` adapter and ``TwitterLoginSerializer`` as an attribute:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -154,6 +154,34 @@ If you are using Twitter for your social authentication, it is a bit different s
|
|||
|
||||
.. note:: Starting from v0.21.0, django-allauth has dropped support for context processors. Check out http://django-allauth.readthedocs.org/en/latest/changelog.html#from-0-21-0 for more details.
|
||||
|
||||
|
||||
GitHub
|
||||
######
|
||||
|
||||
If you are using GitHub for your social authentication, it uses code and not AccessToken directly.
|
||||
|
||||
3. Create new view as a subclass of ``rest_auth.views.SocialLoginView`` with ``GitHubOAuth2Adapter`` adapter, an ``OAuth2Client`` and a callback_url as attributes:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter
|
||||
from allauth.socialaccount.providers.oauth2.client import OAuth2Client
|
||||
from rest_auth.registration.views import SocialLoginView
|
||||
|
||||
class GithubLogin(SocialLoginView):
|
||||
adapter_class = GitHubOAuth2Adapter
|
||||
callback_url = CALLBACK_URL_YOU_SET_ON_GITHUB
|
||||
client_class = OAuth2Client
|
||||
|
||||
4. Create url for GitHubLogin view:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
urlpatterns += [
|
||||
...,
|
||||
url(r'^rest-auth/github/$', GitHubLogin.as_view(), name='github_login')
|
||||
]
|
||||
|
||||
Additional Social Connect Views
|
||||
###############################
|
||||
|
||||
|
@ -162,6 +190,9 @@ If you want to allow connecting existing accounts in addition to login, you can
|
|||
.. code-block:: python
|
||||
|
||||
from allauth.socialaccount.providers.facebook.views import FacebookOAuth2Adapter
|
||||
from allauth.socialaccount.providers.github.views import GitHubOAuth2Adapter
|
||||
from allauth.socialaccount.providers.twitter.views import TwitterOAuthAdapter
|
||||
from allauth.socialaccount.providers.oauth2.client import OAuth2Client
|
||||
from rest_auth.registration.views import SocialConnectView
|
||||
from rest_auth.social_serializers import TwitterConnectSerializer
|
||||
|
||||
|
@ -172,6 +203,12 @@ If you want to allow connecting existing accounts in addition to login, you can
|
|||
serializer_class = TwitterConnectSerializer
|
||||
adapter_class = TwitterOAuthAdapter
|
||||
|
||||
class GithubConnect(SocialConnectView):
|
||||
adapter_class = GitHubOAuth2Adapter
|
||||
callback_url = CALLBACK_URL_YOU_SET_ON_GITHUB
|
||||
client_class = OAuth2Client
|
||||
|
||||
|
||||
In urls.py:
|
||||
|
||||
.. code-block:: python
|
||||
|
@ -180,6 +217,7 @@ In urls.py:
|
|||
...,
|
||||
url(r'^rest-auth/facebook/connect/$', FacebookConnect.as_view(), name='fb_connect')
|
||||
url(r'^rest-auth/twitter/connect/$', TwitterConnect.as_view(), name='twitter_connect')
|
||||
url(r'^rest-auth/github/connect/$', GithubConnect.as_view(), name='github_connect')
|
||||
]
|
||||
|
||||
You can also use the following views to check all social accounts attached to the current authenticated user and disconnect selected social accounts:
|
||||
|
@ -205,13 +243,13 @@ You can also use the following views to check all social accounts attached to th
|
|||
]
|
||||
|
||||
|
||||
JWT Support (optional)
|
||||
----------------------
|
||||
JSON Web Token (JWT) Support (optional)
|
||||
---------------------------------------
|
||||
|
||||
By default ``django-rest-auth`` uses Django's Token-based authentication. If you want to use JWT authentication, follow these steps:
|
||||
|
||||
1. Install `django-rest-framework-jwt <http://getblimp.github.io/django-rest-framework-jwt/>`_
|
||||
- ``django-rest-framework-jwt`` is currently the only supported JWT library.
|
||||
1. Install `djangorestframework-jwt <http://getblimp.github.io/django-rest-framework-jwt/>`_
|
||||
- ``djangorestframework-jwt`` is currently the only supported JWT library.
|
||||
2. The ``JWT_PAYLOAD_HANDLER`` and ``JWT_ENCODE_HANDLER`` settings are imported from the ``django-rest-framework-jwt`` settings object.
|
||||
- Refer to `the library's documentation <http://getblimp.github.io/django-rest-framework-jwt/#additional-settings>`_ for information on using different encoders.
|
||||
|
||||
|
|
4
flake8
4
flake8
|
@ -1,4 +0,0 @@
|
|||
[flake8]
|
||||
max-line-length = 120
|
||||
exclude = docs/*,demo/*
|
||||
ignore = F403
|
BIN
rest_auth/locale/cs/LC_MESSAGES/django.mo
Normal file
BIN
rest_auth/locale/cs/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
102
rest_auth/locale/cs/LC_MESSAGES/django.po
Normal file
102
rest_auth/locale/cs/LC_MESSAGES/django.po
Normal file
|
@ -0,0 +1,102 @@
|
|||
# Czech translations of Tivix/django-rest-auth
|
||||
#
|
||||
# This file is distributed under the same license as the Tivix/django-rest-auth package.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Tivix/django-rest-auth\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/Tivix/django-rest-auth/issues\n"
|
||||
"POT-Creation-Date: 2018-06-27 23:05+0200\n"
|
||||
"PO-Revision-Date: 2018-06-27 23:22+0200\n"
|
||||
"Language: cs\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
|
||||
"Last-Translator: Václav Dohnal <vaclav.dohnal@gmail.com>\n"
|
||||
"Language-Team: N/A\n"
|
||||
"X-Generator: Poedit 2.0.8\n"
|
||||
|
||||
#: .\registration\serializers.py:67
|
||||
msgid "View is not defined, pass it as a context variable"
|
||||
msgstr "View není definováno, předejte jej jako proměnnou kontextu"
|
||||
|
||||
#: .\registration\serializers.py:72
|
||||
msgid "Define adapter_class in view"
|
||||
msgstr "Definujte adapter_class ve view"
|
||||
|
||||
#: .\registration\serializers.py:91
|
||||
msgid "Define callback_url in view"
|
||||
msgstr "Definujte callback_url ve view"
|
||||
|
||||
#: .\registration\serializers.py:95
|
||||
msgid "Define client_class in view"
|
||||
msgstr "Definujte client_class ve view"
|
||||
|
||||
#: .\registration\serializers.py:116
|
||||
msgid "Incorrect input. access_token or code is required."
|
||||
msgstr "Nesprávný vstup. access_token je povinný."
|
||||
|
||||
#: .\registration\serializers.py:125
|
||||
msgid "Incorrect value"
|
||||
msgstr "Nesprávná hodnota"
|
||||
|
||||
#: .\registration\serializers.py:139
|
||||
msgid "User is already registered with this e-mail address."
|
||||
msgstr "Uživatel s touto adresou je již registrován."
|
||||
|
||||
#: .\registration\serializers.py:185
|
||||
msgid "A user is already registered with this e-mail address."
|
||||
msgstr "Uživatel s touto adresou je již registrován."
|
||||
|
||||
#: .\registration\serializers.py:193
|
||||
msgid "The two password fields didn't match."
|
||||
msgstr "Zadaná hesla se neshodují."
|
||||
|
||||
#: .\registration\views.py:51
|
||||
msgid "Verification e-mail sent."
|
||||
msgstr "Ověřovací e-mail odeslán."
|
||||
|
||||
#: .\registration\views.py:98
|
||||
msgid "ok"
|
||||
msgstr "ok"
|
||||
|
||||
#: .\serializers.py:30
|
||||
msgid "Must include \"email\" and \"password\"."
|
||||
msgstr "Musí obsahovat \"e-mail\" a \"heslo\"."
|
||||
|
||||
#: .\serializers.py:41
|
||||
msgid "Must include \"username\" and \"password\"."
|
||||
msgstr "Musí obsahovat \"uživatelské jméno\" a \"heslo\"."
|
||||
|
||||
#: .\serializers.py:54
|
||||
msgid "Must include either \"username\" or \"email\" and \"password\"."
|
||||
msgstr "Musí obsahovat \"uživatelské jméno\" nebo \"e-mail\" a \"heslo\"."
|
||||
|
||||
#: .\serializers.py:95
|
||||
msgid "User account is disabled."
|
||||
msgstr "Uživatelský účet je zakázán."
|
||||
|
||||
#: .\serializers.py:98
|
||||
msgid "Unable to log in with provided credentials."
|
||||
msgstr "Pomocí zadaných údajů se nelze přihlásit."
|
||||
|
||||
#: .\serializers.py:107
|
||||
msgid "E-mail is not verified."
|
||||
msgstr "E-mail není ověřený."
|
||||
|
||||
#: .\views.py:127
|
||||
msgid "Successfully logged out."
|
||||
msgstr "Byli jste úspěšně odhlášeni."
|
||||
|
||||
#: .\views.py:175
|
||||
msgid "Password reset e-mail has been sent."
|
||||
msgstr "E-mail pro resetování hesla byl odeslán."
|
||||
|
||||
#: .\views.py:201
|
||||
msgid "Password has been reset with the new password."
|
||||
msgstr "Vaše heslo bylo resetováno."
|
||||
|
||||
#: .\views.py:223
|
||||
msgid "New password has been saved."
|
||||
msgstr "Nové heslo bylo uloženo."
|
BIN
rest_auth/locale/fr/LC_MESSAGES/django.mo
Normal file
BIN
rest_auth/locale/fr/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
98
rest_auth/locale/fr/LC_MESSAGES/django.po
Normal file
98
rest_auth/locale/fr/LC_MESSAGES/django.po
Normal file
|
@ -0,0 +1,98 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-12-22 11:37-0800\n"
|
||||
"PO-Revision-Date: 2017-02-14 13:27+0100\n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"X-Generator: Poedit 1.8.11\n"
|
||||
|
||||
#: registration/serializers.py:53
|
||||
msgid "View is not defined, pass it as a context variable"
|
||||
msgstr "La “View” n’est pas définie, passez la en variable contextuelle"
|
||||
|
||||
#: registration/serializers.py:58
|
||||
msgid "Define adapter_class in view"
|
||||
msgstr "Définissez “adapter_class” dans la vue"
|
||||
|
||||
#: registration/serializers.py:77
|
||||
msgid "Define callback_url in view"
|
||||
msgstr "Définissez “callback_url” dans la vue"
|
||||
|
||||
#: registration/serializers.py:81
|
||||
msgid "Define client_class in view"
|
||||
msgstr "Définissez “client_class” dans la vue"
|
||||
|
||||
#: registration/serializers.py:102
|
||||
msgid "Incorrect input. access_token or code is required."
|
||||
msgstr "Paramètres incorrects. Il faut “access_token” ou “code”."
|
||||
|
||||
#: registration/serializers.py:111
|
||||
msgid "Incorrect value"
|
||||
msgstr "Paramètre incorrect"
|
||||
|
||||
#: registration/serializers.py:140
|
||||
msgid "A user is already registered with this e-mail address."
|
||||
msgstr "Un utilisateur existe déjà avec cette adresse email."
|
||||
|
||||
#: registration/serializers.py:148
|
||||
msgid "The two password fields didn't match."
|
||||
msgstr "Les deux mots de passes ne sont pas les mêmes."
|
||||
|
||||
#: registration/views.py:82
|
||||
msgid "ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: serializers.py:30
|
||||
msgid "Must include \"email\" and \"password\"."
|
||||
msgstr "Doit inclure “email” et “password”."
|
||||
|
||||
#: serializers.py:41
|
||||
msgid "Must include \"username\" and \"password\"."
|
||||
msgstr "Doit inclure “username” et “password”."
|
||||
|
||||
#: serializers.py:54
|
||||
msgid "Must include either \"username\" or \"email\" and \"password\"."
|
||||
msgstr "Doit inclure un “username” ou “email”, et un “password”."
|
||||
|
||||
#: serializers.py:95
|
||||
msgid "User account is disabled."
|
||||
msgstr "Le compte utilisateur est désactivé."
|
||||
|
||||
#: serializers.py:98
|
||||
msgid "Unable to log in with provided credentials."
|
||||
msgstr "Connexion impossible avec les informations fournies."
|
||||
|
||||
#: serializers.py:107
|
||||
msgid "E-mail is not verified."
|
||||
msgstr "L’adresse email n’a pas été vérifiée."
|
||||
|
||||
#: views.py:114
|
||||
msgid "Successfully logged out."
|
||||
msgstr "Déconnexion effectuée avec succès."
|
||||
|
||||
#: views.py:162
|
||||
msgid "Password reset e-mail has been sent."
|
||||
msgstr "L’email de réinitialisation du mot de passe a été envoyé."
|
||||
|
||||
#: views.py:184
|
||||
msgid "Password has been reset with the new password."
|
||||
msgstr "Le mot de passe a été réinitialisé."
|
||||
|
||||
#: views.py:202
|
||||
msgid "New password has been saved."
|
||||
msgstr "Le nouveau mot de passe est sauvé."
|
||||
|
||||
#~ msgid "Error"
|
||||
#~ msgstr "Fehler"
|
BIN
rest_auth/locale/ko/LC_MESSAGES/django.mo
Normal file
BIN
rest_auth/locale/ko/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
99
rest_auth/locale/ko/LC_MESSAGES/django.po
Normal file
99
rest_auth/locale/ko/LC_MESSAGES/django.po
Normal file
|
@ -0,0 +1,99 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-03-05 21:56-0800\n"
|
||||
"PO-Revision-Date: 2018-03-20 17:52+0900\n"
|
||||
"Last-Translator: Jeonsgoo Park <toracle@gmail.com>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: ko\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: registration/serializers.py:53
|
||||
msgid "View is not defined, pass it as a context variable"
|
||||
msgstr "View가 정의되지 않았습니다. 컨텍스트 변수에 포함해주세요"
|
||||
|
||||
#: registration/serializers.py:58
|
||||
msgid "Define adapter_class in view"
|
||||
msgstr "view에 adapter_class를 정의하세요"
|
||||
|
||||
#: registration/serializers.py:77
|
||||
msgid "Define callback_url in view"
|
||||
msgstr "view에 callback_url을 정의하세요"
|
||||
|
||||
#: registration/serializers.py:81
|
||||
msgid "Define client_class in view"
|
||||
msgstr "view에 client_class를 정의하세요"
|
||||
|
||||
#: registration/serializers.py:102
|
||||
msgid "Incorrect input. access_token or code is required."
|
||||
msgstr "올바르지 않은 입력입니다. access_token이나 code가 필요합니다."
|
||||
|
||||
#: registration/serializers.py:111
|
||||
msgid "Incorrect value"
|
||||
msgstr "올바르지 않은 값"
|
||||
|
||||
#: registration/serializers.py:140
|
||||
msgid "A user is already registered with this e-mail address."
|
||||
msgstr "이미 이 이메일 주소로 등록된 사용자가 있습니다."
|
||||
|
||||
#: registration/serializers.py:148
|
||||
msgid "The two password fields didn't match."
|
||||
msgstr "두 개의 패스워드 필드가 서로 맞지 않습니다."
|
||||
|
||||
#: registration/views.py:44
|
||||
msgid "Verification e-mail sent."
|
||||
msgstr "확인 이메일을 발송했습니다."
|
||||
|
||||
#: registration/views.py:91
|
||||
msgid "ok"
|
||||
msgstr "ok"
|
||||
|
||||
#: serializers.py:30
|
||||
msgid "Must include \"email\" and \"password\"."
|
||||
msgstr "\"email\"과 \"password\"를 반드시 포함해야 합니다."
|
||||
|
||||
#: serializers.py:41
|
||||
msgid "Must include \"username\" and \"password\"."
|
||||
msgstr "\"username\"과 \"password\"를 반드시 포함해야 합니다."
|
||||
|
||||
#: serializers.py:54
|
||||
msgid "Must include either \"username\" or \"email\" and \"password\"."
|
||||
msgstr "\"username\"이나 \"email\", 그리고 \"password\"를 반드시 포함해야 합니다."
|
||||
|
||||
#: serializers.py:95
|
||||
msgid "User account is disabled."
|
||||
msgstr "사용자 계정이 비활성화 되어있습니다."
|
||||
|
||||
#: serializers.py:98
|
||||
msgid "Unable to log in with provided credentials."
|
||||
msgstr "주어진 자격 증명으로 로그인이 불가능합니다."
|
||||
|
||||
#: serializers.py:107
|
||||
msgid "E-mail is not verified."
|
||||
msgstr "이메일 주소가 확인되지 않았습니다."
|
||||
|
||||
#: views.py:126
|
||||
msgid "Successfully logged out."
|
||||
msgstr "로그아웃되었습니다."
|
||||
|
||||
#: views.py:174
|
||||
msgid "Password reset e-mail has been sent."
|
||||
msgstr "패스워드 초기화 이메일이 발송되었습니다."
|
||||
|
||||
#: views.py:200
|
||||
msgid "Password has been reset with the new password."
|
||||
msgstr "새로운 패스워드로 패스워드가 초기화 되었습니다."
|
||||
|
||||
#: views.py:222
|
||||
msgid "New password has been saved."
|
||||
msgstr "새로운 패스워드가 저장되었습니다."
|
99
rest_auth/locale/pt_BR/LC_MESSAGES/django.po
Normal file
99
rest_auth/locale/pt_BR/LC_MESSAGES/django.po
Normal file
|
@ -0,0 +1,99 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# Bruno Barreto Freitas <brunobarretofreitas@outlook.com>, 2019.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-04-16 09:48-0800\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: Bruno Barreto Freitas <brunobarretofreitas@outlook.com>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: registration/serializers.py:53
|
||||
msgid "View is not defined, pass it as a context variable"
|
||||
msgstr "\"View\" não está definida, passe-a como uma variável de contexto"
|
||||
|
||||
#: registration/serializers.py:58
|
||||
msgid "Define adapter_class in view"
|
||||
msgstr "Defina \"adapter_class\" na view"
|
||||
|
||||
#: registration/serializers.py:77
|
||||
msgid "Define callback_url in view"
|
||||
msgstr "Defina \"callback_url\" na view"
|
||||
|
||||
#: registration/serializers.py:81
|
||||
msgid "Define client_class in view"
|
||||
msgstr "Defina \"client_class\" na view"
|
||||
|
||||
#: registration/serializers.py:102
|
||||
msgid "Incorrect input. access_token or code is required."
|
||||
msgstr "Entrada incorreta. \"access_token\" ou \"code\" são obrigatórios."
|
||||
|
||||
#: registration/serializers.py:111
|
||||
msgid "Incorrect value"
|
||||
msgstr "Valor incorreto"
|
||||
|
||||
#: registration/serializers.py:140
|
||||
msgid "A user is already registered with this e-mail address."
|
||||
msgstr "Já existe um usuário cadastrado com este endereço de e-mail."
|
||||
|
||||
#: registration/serializers.py:148
|
||||
msgid "The two password fields didn't match."
|
||||
msgstr "Os dois campos de senha não correspondem."
|
||||
|
||||
#: registration/views.py:44
|
||||
msgid "Verification e-mail sent."
|
||||
msgstr "E-mail de verificação enviado."
|
||||
|
||||
#: registration/views.py:91
|
||||
msgid "ok"
|
||||
msgstr "Ok"
|
||||
|
||||
#: serializers.py:30
|
||||
msgid "Must include \"email\" and \"password\"."
|
||||
msgstr "Deve-se incluir \"email\" e \"password\"."
|
||||
|
||||
#: serializers.py:41
|
||||
msgid "Must include \"username\" and \"password\"."
|
||||
msgstr "Deve-se incluir \"username\" e \"password\"."
|
||||
|
||||
#: serializers.py:54
|
||||
msgid "Must include either \"username\" or \"email\" and \"password\"."
|
||||
msgstr "Deve-se incluir \"username\" ou \"email\" e \"password\"."
|
||||
|
||||
#: serializers.py:95
|
||||
msgid "User account is disabled."
|
||||
msgstr "Conta de usuário está desativada"
|
||||
|
||||
#: serializers.py:98
|
||||
msgid "Unable to log in with provided credentials."
|
||||
msgstr "Não foi possível realizar o login com as credenciais fornecidas."
|
||||
|
||||
#: serializers.py:107
|
||||
msgid "E-mail is not verified."
|
||||
msgstr "E-mail não foi verificado."
|
||||
|
||||
#: views.py:126
|
||||
msgid "Successfully logged out."
|
||||
msgstr "Logout realizado com sucesso."
|
||||
|
||||
#: views.py:174
|
||||
msgid "Password reset e-mail has been sent."
|
||||
msgstr "E-mail de redefinição de senha foi enviado."
|
||||
|
||||
#: views.py:200
|
||||
msgid "Password has been reset with the new password."
|
||||
msgstr "Senha foi redefinida com a nova senha."
|
||||
|
||||
#: views.py:222
|
||||
msgid "New password has been saved."
|
||||
msgstr "Nova senha foi salva com sucesso."
|
95
rest_auth/locale/tr/LC_MESSAGES/django.po
Normal file
95
rest_auth/locale/tr/LC_MESSAGES/django.po
Normal file
|
@ -0,0 +1,95 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-03-05 21:56-0800\n"
|
||||
"PO-Revision-Date: 2018-10-13 19:37+0300\n"
|
||||
"Language: tr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"X-Generator: Poedit 2.2\n"
|
||||
|
||||
#: registration/serializers.py:67
|
||||
msgid "View is not defined, pass it as a context variable"
|
||||
msgstr "“View” tanımlanmadı, “context” değişkeni olarak tanımla"
|
||||
|
||||
#: registration/serializers.py:72
|
||||
msgid "Define adapter_class in view"
|
||||
msgstr "“view” içerisinde “adapter_class” tanımla"
|
||||
|
||||
#: registration/serializers.py:91
|
||||
msgid "Define callback_url in view"
|
||||
msgstr "“view” içerisinde “callback_url” tanımla"
|
||||
|
||||
#: registration/serializers.py:95
|
||||
msgid "Define client_class in view"
|
||||
msgstr "“view” içerisinde “client_class” tanımla"
|
||||
|
||||
#: registration/serializers.py:116
|
||||
msgid "Incorrect input. access_token or code is required."
|
||||
msgstr "Geçersiz girdi. “access_token” veya “code” gerekli."
|
||||
|
||||
#: registration/serializers.py:125
|
||||
msgid "Incorrect value"
|
||||
msgstr "Geçersiz değer"
|
||||
|
||||
#: registration/serializers.py:185
|
||||
msgid "A user is already registered with this e-mail address."
|
||||
msgstr "Bu e-posta adresi ile bir kullanıcı zaten kayıt olmuştu."
|
||||
|
||||
#: registration/serializers.py:193
|
||||
msgid "The two password fields didn't match."
|
||||
msgstr "İki şifre alanı eşleşmiyor."
|
||||
|
||||
#: registration/views.py:98
|
||||
msgid "ok"
|
||||
msgstr "tamam"
|
||||
|
||||
#: serializers.py:33
|
||||
msgid "Must include \"email\" and \"password\"."
|
||||
msgstr "\"email\" ve \"password\" içermelidir."
|
||||
|
||||
#: serializers.py:44
|
||||
msgid "Must include \"username\" and \"password\"."
|
||||
msgstr "“username\" und \"password\" içermelidir."
|
||||
|
||||
#: serializers.py:57
|
||||
msgid "Must include either \"username\" or \"email\" and \"password\"."
|
||||
msgstr "Ya ”username\" yada \"email\" ve \"password\" içermelidir."
|
||||
|
||||
#: serializers.py:98
|
||||
msgid "User account is disabled."
|
||||
msgstr "Kullanıcı hesap pasiftir."
|
||||
|
||||
#: serializers.py:101
|
||||
msgid "Unable to log in with provided credentials."
|
||||
msgstr "Sağlanan kimlik bilgileri ile giriş yapılamıyor."
|
||||
|
||||
#: serializers.py:110
|
||||
msgid "E-mail is not verified."
|
||||
msgstr "E-posta adresi doğrulanmadı."
|
||||
|
||||
#: views.py:127
|
||||
msgid "Successfully logged out."
|
||||
msgstr "Başarılı bir şekilde çıkış yapıldı."
|
||||
|
||||
#: views.py:175
|
||||
msgid "Password reset e-mail has been sent."
|
||||
msgstr "Şifre sıfırlama e-postası gönderildi."
|
||||
|
||||
#: views.py:201
|
||||
msgid "Password has been reset with the new password."
|
||||
msgstr "Yeni şifre ile şifre sıfırlandı."
|
||||
|
||||
#: views.py:223
|
||||
msgid "New password has been saved."
|
||||
msgstr "Yeni şifre kaydedildi."
|
BIN
rest_auth/locale/zh_Hans/LC_MESSAGES/django.mo
Normal file
BIN
rest_auth/locale/zh_Hans/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
104
rest_auth/locale/zh_Hans/LC_MESSAGES/django.po
Normal file
104
rest_auth/locale/zh_Hans/LC_MESSAGES/django.po
Normal file
|
@ -0,0 +1,104 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-10-28 11:41+0800\n"
|
||||
"PO-Revision-Date: 2018-10-28 11:45+0806\n"
|
||||
"Last-Translator: b' <admin@xx.com>'\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Translated-Using: django-rosetta 0.9.0\n"
|
||||
|
||||
#: registration/serializers.py:67
|
||||
msgid "View is not defined, pass it as a context variable"
|
||||
msgstr "View未定义,请通过context变量传入"
|
||||
|
||||
#: registration/serializers.py:72
|
||||
msgid "Define adapter_class in view"
|
||||
msgstr "请在View中定义adapter_class"
|
||||
|
||||
#: registration/serializers.py:91
|
||||
msgid "Define callback_url in view"
|
||||
msgstr "请在view中定义callback_url"
|
||||
|
||||
#: registration/serializers.py:95
|
||||
msgid "Define client_class in view"
|
||||
msgstr "请在view中定义client_class"
|
||||
|
||||
#: registration/serializers.py:116
|
||||
msgid "Incorrect input. access_token or code is required."
|
||||
msgstr "输入错误。access_token或code是必填项。"
|
||||
|
||||
#: registration/serializers.py:125
|
||||
msgid "Incorrect value"
|
||||
msgstr "错误的值"
|
||||
|
||||
#: registration/serializers.py:139
|
||||
msgid "User is already registered with this e-mail address."
|
||||
msgstr "该邮箱地址已被注册。"
|
||||
|
||||
#: registration/serializers.py:185
|
||||
msgid "A user is already registered with this e-mail address."
|
||||
msgstr "该邮箱地址已被注册。"
|
||||
|
||||
#: registration/serializers.py:193
|
||||
msgid "The two password fields didn't match."
|
||||
msgstr "两次输入的密码不相同"
|
||||
|
||||
#: registration/views.py:51
|
||||
msgid "Verification e-mail sent."
|
||||
msgstr "验证邮件已发送。"
|
||||
|
||||
#: registration/views.py:98
|
||||
msgid "ok"
|
||||
msgstr "好的"
|
||||
|
||||
#: serializers.py:33
|
||||
msgid "Must include \"email\" and \"password\"."
|
||||
msgstr "比如包含\"email\"和\"password\"。"
|
||||
|
||||
#: serializers.py:44
|
||||
msgid "Must include \"username\" and \"password\"."
|
||||
msgstr "比如包含\"username\"和\"password\"。"
|
||||
|
||||
#: serializers.py:57
|
||||
msgid "Must include either \"username\" or \"email\" and \"password\"."
|
||||
msgstr "比如包含\"username\",\"email\",\"password\"其中一个。"
|
||||
|
||||
#: serializers.py:98
|
||||
msgid "User account is disabled."
|
||||
msgstr "用户账号已被禁用。"
|
||||
|
||||
#: serializers.py:101
|
||||
msgid "Unable to log in with provided credentials."
|
||||
msgstr "无法使用提供的信息登录。"
|
||||
|
||||
#: serializers.py:110
|
||||
msgid "E-mail is not verified."
|
||||
msgstr "邮箱未验证。"
|
||||
|
||||
#: views.py:127
|
||||
msgid "Successfully logged out."
|
||||
msgstr "已成功登出。"
|
||||
|
||||
#: views.py:175
|
||||
msgid "Password reset e-mail has been sent."
|
||||
msgstr "密码重置邮件已发送。"
|
||||
|
||||
#: views.py:201
|
||||
msgid "Password has been reset with the new password."
|
||||
msgstr "密码重置成功。"
|
||||
|
||||
#: views.py:223
|
||||
msgid "New password has been saved."
|
||||
msgstr "新密码已设置成功。"
|
BIN
rest_auth/locale/zh_Hant/LC_MESSAGES/django.mo
Normal file
BIN
rest_auth/locale/zh_Hant/LC_MESSAGES/django.mo
Normal file
Binary file not shown.
103
rest_auth/locale/zh_Hant/LC_MESSAGES/django.po
Normal file
103
rest_auth/locale/zh_Hant/LC_MESSAGES/django.po
Normal file
|
@ -0,0 +1,103 @@
|
|||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-10-28 11:41+0800\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#: registration/serializers.py:67
|
||||
msgid "View is not defined, pass it as a context variable"
|
||||
msgstr ""
|
||||
|
||||
#: registration/serializers.py:72
|
||||
msgid "Define adapter_class in view"
|
||||
msgstr ""
|
||||
|
||||
#: registration/serializers.py:91
|
||||
msgid "Define callback_url in view"
|
||||
msgstr ""
|
||||
|
||||
#: registration/serializers.py:95
|
||||
msgid "Define client_class in view"
|
||||
msgstr ""
|
||||
|
||||
#: registration/serializers.py:116
|
||||
msgid "Incorrect input. access_token or code is required."
|
||||
msgstr ""
|
||||
|
||||
#: registration/serializers.py:125
|
||||
msgid "Incorrect value"
|
||||
msgstr ""
|
||||
|
||||
#: registration/serializers.py:139
|
||||
msgid "User is already registered with this e-mail address."
|
||||
msgstr ""
|
||||
|
||||
#: registration/serializers.py:185
|
||||
msgid "A user is already registered with this e-mail address."
|
||||
msgstr ""
|
||||
|
||||
#: registration/serializers.py:193
|
||||
msgid "The two password fields didn't match."
|
||||
msgstr ""
|
||||
|
||||
#: registration/views.py:51
|
||||
msgid "Verification e-mail sent."
|
||||
msgstr ""
|
||||
|
||||
#: registration/views.py:98
|
||||
msgid "ok"
|
||||
msgstr ""
|
||||
|
||||
#: serializers.py:33
|
||||
msgid "Must include \"email\" and \"password\"."
|
||||
msgstr ""
|
||||
|
||||
#: serializers.py:44
|
||||
msgid "Must include \"username\" and \"password\"."
|
||||
msgstr ""
|
||||
|
||||
#: serializers.py:57
|
||||
msgid "Must include either \"username\" or \"email\" and \"password\"."
|
||||
msgstr ""
|
||||
|
||||
#: serializers.py:98
|
||||
msgid "User account is disabled."
|
||||
msgstr ""
|
||||
|
||||
#: serializers.py:101
|
||||
msgid "Unable to log in with provided credentials."
|
||||
msgstr ""
|
||||
|
||||
#: serializers.py:110
|
||||
msgid "E-mail is not verified."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:127
|
||||
msgid "Successfully logged out."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:175
|
||||
msgid "Password reset e-mail has been sent."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:201
|
||||
msgid "Password has been reset with the new password."
|
||||
msgstr ""
|
||||
|
||||
#: views.py:223
|
||||
msgid "New password has been saved."
|
||||
msgstr ""
|
|
@ -1,5 +1,4 @@
|
|||
from django.http import HttpRequest
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
|
|
|
@ -21,11 +21,14 @@ class LoginSerializer(serializers.Serializer):
|
|||
email = serializers.EmailField(required=False, allow_blank=True)
|
||||
password = serializers.CharField(style={'input_type': 'password'})
|
||||
|
||||
def authenticate(self, **kwargs):
|
||||
return authenticate(self.context['request'], **kwargs)
|
||||
|
||||
def _validate_email(self, email, password):
|
||||
user = None
|
||||
|
||||
if email and password:
|
||||
user = authenticate(email=email, password=password)
|
||||
user = self.authenticate(email=email, password=password)
|
||||
else:
|
||||
msg = _('Must include "email" and "password".')
|
||||
raise exceptions.ValidationError(msg)
|
||||
|
@ -36,7 +39,7 @@ class LoginSerializer(serializers.Serializer):
|
|||
user = None
|
||||
|
||||
if username and password:
|
||||
user = authenticate(username=username, password=password)
|
||||
user = self.authenticate(username=username, password=password)
|
||||
else:
|
||||
msg = _('Must include "username" and "password".')
|
||||
raise exceptions.ValidationError(msg)
|
||||
|
@ -47,9 +50,9 @@ class LoginSerializer(serializers.Serializer):
|
|||
user = None
|
||||
|
||||
if email and password:
|
||||
user = authenticate(email=email, password=password)
|
||||
user = self.authenticate(email=email, password=password)
|
||||
elif username and password:
|
||||
user = authenticate(username=username, password=password)
|
||||
user = self.authenticate(username=username, password=password)
|
||||
else:
|
||||
msg = _('Must include either "username" or "email" and "password".')
|
||||
raise exceptions.ValidationError(msg)
|
||||
|
@ -253,7 +256,8 @@ class PasswordChangeSerializer(serializers.Serializer):
|
|||
)
|
||||
|
||||
if all(invalid_password_conditions):
|
||||
raise serializers.ValidationError('Invalid password')
|
||||
err_msg = _("Your old password was entered incorrectly. Please enter it again.")
|
||||
raise serializers.ValidationError(err_msg)
|
||||
return value
|
||||
|
||||
def validate(self, attrs):
|
||||
|
|
|
@ -84,7 +84,17 @@ class LoginView(GenericAPIView):
|
|||
serializer = serializer_class(instance=self.token,
|
||||
context={'request': self.request})
|
||||
|
||||
return Response(serializer.data, status=status.HTTP_200_OK)
|
||||
response = Response(serializer.data, status=status.HTTP_200_OK)
|
||||
if getattr(settings, 'REST_USE_JWT', False):
|
||||
from rest_framework_jwt.settings import api_settings as jwt_settings
|
||||
if jwt_settings.JWT_AUTH_COOKIE:
|
||||
from datetime import datetime
|
||||
expiration = (datetime.utcnow() + jwt_settings.JWT_EXPIRATION_DELTA)
|
||||
response.set_cookie(jwt_settings.JWT_AUTH_COOKIE,
|
||||
self.token,
|
||||
expires=expiration,
|
||||
httponly=True)
|
||||
return response
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
self.request = request
|
||||
|
@ -121,11 +131,16 @@ class LogoutView(APIView):
|
|||
request.user.auth_token.delete()
|
||||
except (AttributeError, ObjectDoesNotExist):
|
||||
pass
|
||||
if getattr(settings, 'REST_SESSION_LOGIN', True):
|
||||
django_logout(request)
|
||||
|
||||
django_logout(request)
|
||||
|
||||
return Response({"detail": _("Successfully logged out.")},
|
||||
status=status.HTTP_200_OK)
|
||||
response = Response({"detail": _("Successfully logged out.")},
|
||||
status=status.HTTP_200_OK)
|
||||
if getattr(settings, 'REST_USE_JWT', False):
|
||||
from rest_framework_jwt.settings import api_settings as jwt_settings
|
||||
if jwt_settings.JWT_AUTH_COOKIE:
|
||||
response.delete_cookie(jwt_settings.JWT_AUTH_COOKIE)
|
||||
return response
|
||||
|
||||
|
||||
class UserDetailsView(RetrieveUpdateAPIView):
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
# .coveragerc to control coverage.py
|
||||
[run]
|
||||
[bdist_wheel]
|
||||
universal = 1
|
||||
|
||||
|
||||
[metadata]
|
||||
license_file = LICENSE
|
||||
|
||||
|
||||
[flake8]
|
||||
max-line-length = 120
|
||||
exclude = docs/*,demo/*
|
||||
ignore = F403
|
||||
|
||||
|
||||
[coverage:run]
|
||||
omit=*site-packages*,*distutils*,*migrations*
|
||||
|
||||
[report]
|
||||
[coverage:report]
|
||||
# Regexes for lines to exclude from consideration
|
||||
exclude_lines =
|
||||
# Have to re-enable the standard pragma
|
||||
|
@ -22,5 +35,5 @@ exclude_lines =
|
|||
|
||||
ignore_errors = True
|
||||
|
||||
[html]
|
||||
directory = coverage_html
|
||||
[coverage:html]
|
||||
directory = coverage_html
|
12
setup.py
12
setup.py
|
@ -1,14 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
try:
|
||||
from setuptools import setup, find_packages
|
||||
except ImportError:
|
||||
from ez_setup import use_setuptools
|
||||
use_setuptools()
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
import os
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
f = open(os.path.join(here, 'README.rst'))
|
||||
|
@ -18,7 +12,7 @@ f.close()
|
|||
|
||||
setup(
|
||||
name='django-rest-auth',
|
||||
version='0.9.3',
|
||||
version='0.9.5',
|
||||
author='Sumit Chachra',
|
||||
author_email='chachra@tivix.com',
|
||||
url='http://github.com/Tivix/django-rest-auth',
|
||||
|
|
Loading…
Reference in New Issue
Block a user