mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-07-26 07:29:46 +03:00
merge to original django-rest-auth
This commit is contained in:
commit
9710249411
77
.gitignore
vendored
77
.gitignore
vendored
|
@ -1,26 +1,35 @@
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
.Python
|
.Python
|
||||||
env/
|
|
||||||
bin/
|
|
||||||
build/
|
build/
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
dist/
|
dist/
|
||||||
|
downloads/
|
||||||
eggs/
|
eggs/
|
||||||
|
.eggs/
|
||||||
lib/
|
lib/
|
||||||
lib64/
|
lib64/
|
||||||
parts/
|
parts/
|
||||||
sdist/
|
sdist/
|
||||||
var/
|
var/
|
||||||
|
wheels/
|
||||||
*.egg-info/
|
*.egg-info/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.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
|
# Installer logs
|
||||||
pip-log.txt
|
pip-log.txt
|
||||||
|
@ -30,28 +39,66 @@ pip-delete-this-directory.txt
|
||||||
htmlcov/
|
htmlcov/
|
||||||
.tox/
|
.tox/
|
||||||
.coverage
|
.coverage
|
||||||
|
.coverage.*
|
||||||
.cache
|
.cache
|
||||||
nosetests.xml
|
nosetests.xml
|
||||||
coverage.xml
|
coverage.xml
|
||||||
coverage_html
|
*.cover
|
||||||
|
.hypothesis/
|
||||||
|
.pytest_cache/
|
||||||
|
|
||||||
# Mr Developer
|
# Translations
|
||||||
.mr.developer.cfg
|
*.mo
|
||||||
.project
|
*.pot
|
||||||
.pydevproject
|
|
||||||
|
|
||||||
# Rope
|
|
||||||
.ropeproject
|
|
||||||
|
|
||||||
# Django stuff:
|
# Django stuff:
|
||||||
*.log
|
*.log
|
||||||
*.pot
|
local_settings.py
|
||||||
|
db.sqlite3
|
||||||
|
|
||||||
|
# Flask stuff:
|
||||||
|
instance/
|
||||||
|
.webassets-cache
|
||||||
|
|
||||||
|
# Scrapy stuff:
|
||||||
|
.scrapy
|
||||||
|
|
||||||
# Sphinx documentation
|
# Sphinx documentation
|
||||||
docs/_build/
|
docs/_build/
|
||||||
|
|
||||||
.DS_Store
|
# PyBuilder
|
||||||
db.sqlite3
|
target/
|
||||||
|
|
||||||
# IntelliJ IDE files
|
# Jupyter Notebook
|
||||||
.idea
|
.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.5"
|
||||||
- "3.6"
|
- "3.6"
|
||||||
env:
|
env:
|
||||||
- DJANGO=1.8.* DRF=3.6.*
|
|
||||||
- DJANGO=1.11.* DRF=3.7.*
|
- DJANGO=1.11.* DRF=3.7.*
|
||||||
|
- DJANGO=1.11.* DRF=3.8.*
|
||||||
- DJANGO=2.0.* DRF=3.7.*
|
- DJANGO=2.0.* DRF=3.7.*
|
||||||
|
- DJANGO=2.0.* DRF=3.8.*
|
||||||
install:
|
install:
|
||||||
- pip install -q Django==$DJANGO djangorestframework==$DRF
|
- pip install -q Django==$DJANGO djangorestframework==$DRF
|
||||||
- pip install coveralls
|
- pip install coveralls
|
||||||
|
@ -21,3 +22,5 @@ matrix:
|
||||||
exclude:
|
exclude:
|
||||||
- python: "2.7"
|
- python: "2.7"
|
||||||
env: DJANGO=2.0.* DRF=3.7.*
|
env: DJANGO=2.0.* DRF=3.7.*
|
||||||
|
- python: "2.7"
|
||||||
|
env: DJANGO=2.0.* DRF=3.8.*
|
||||||
|
|
|
@ -44,16 +44,16 @@ master_doc = 'index'
|
||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = u'django-rest-auth'
|
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
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.3.0'
|
version = '0.9.3'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.3.0'
|
release = '0.9.3'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
|
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."
|
|
@ -21,11 +21,14 @@ class LoginSerializer(serializers.Serializer):
|
||||||
email = serializers.EmailField(required=False, allow_blank=True)
|
email = serializers.EmailField(required=False, allow_blank=True)
|
||||||
password = serializers.CharField(style={'input_type': 'password'})
|
password = serializers.CharField(style={'input_type': 'password'})
|
||||||
|
|
||||||
|
def authenticate(self, **kwargs):
|
||||||
|
return authenticate(self.context['request'], **kwargs)
|
||||||
|
|
||||||
def _validate_email(self, email, password):
|
def _validate_email(self, email, password):
|
||||||
user = None
|
user = None
|
||||||
|
|
||||||
if email and password:
|
if email and password:
|
||||||
user = authenticate(email=email, password=password)
|
user = self.authenticate(email=email, password=password)
|
||||||
try:
|
try:
|
||||||
username = UserModel.objects.get(email__iexact=email).get_username()
|
username = UserModel.objects.get(email__iexact=email).get_username()
|
||||||
user = authenticate(username=username, password=password)
|
user = authenticate(username=username, password=password)
|
||||||
|
@ -42,7 +45,7 @@ class LoginSerializer(serializers.Serializer):
|
||||||
user = None
|
user = None
|
||||||
|
|
||||||
if username and password:
|
if username and password:
|
||||||
user = authenticate(username=username, password=password)
|
user = self.authenticate(username=username, password=password)
|
||||||
else:
|
else:
|
||||||
msg = _('Must include "username" and "password".')
|
msg = _('Must include "username" and "password".')
|
||||||
raise exceptions.ValidationError(msg)
|
raise exceptions.ValidationError(msg)
|
||||||
|
@ -53,7 +56,7 @@ class LoginSerializer(serializers.Serializer):
|
||||||
user = None
|
user = None
|
||||||
|
|
||||||
if email and password:
|
if email and password:
|
||||||
user = authenticate(email=email, password=password)
|
user = self.authenticate(email=email, password=password)
|
||||||
try:
|
try:
|
||||||
username = UserModel.objects.get(email__iexact=email).get_username()
|
username = UserModel.objects.get(email__iexact=email).get_username()
|
||||||
user = authenticate(username=username, password=password)
|
user = authenticate(username=username, password=password)
|
||||||
|
@ -61,7 +64,7 @@ class LoginSerializer(serializers.Serializer):
|
||||||
msg = _('Unable to log in with provided credentials.')
|
msg = _('Unable to log in with provided credentials.')
|
||||||
raise exceptions.ValidationError(msg)
|
raise exceptions.ValidationError(msg)
|
||||||
elif username and password:
|
elif username and password:
|
||||||
user = authenticate(username=username, password=password)
|
user = self.authenticate(username=username, password=password)
|
||||||
else:
|
else:
|
||||||
msg = _('Must include either "username" or "email" and "password".')
|
msg = _('Must include either "username" or "email" and "password".')
|
||||||
raise exceptions.ValidationError(msg)
|
raise exceptions.ValidationError(msg)
|
||||||
|
|
|
@ -1,8 +1,21 @@
|
||||||
# .coveragerc to control coverage.py
|
[bdist_wheel]
|
||||||
[run]
|
universal = 1
|
||||||
|
|
||||||
|
|
||||||
|
[metadata]
|
||||||
|
license_file = LICENSE
|
||||||
|
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
max-line-length = 120
|
||||||
|
exclude = docs/*,demo/*
|
||||||
|
ignore = F403
|
||||||
|
|
||||||
|
|
||||||
|
[coverage:run]
|
||||||
omit=*site-packages*,*distutils*,*migrations*
|
omit=*site-packages*,*distutils*,*migrations*
|
||||||
|
|
||||||
[report]
|
[coverage:report]
|
||||||
# Regexes for lines to exclude from consideration
|
# Regexes for lines to exclude from consideration
|
||||||
exclude_lines =
|
exclude_lines =
|
||||||
# Have to re-enable the standard pragma
|
# Have to re-enable the standard pragma
|
||||||
|
@ -22,5 +35,5 @@ exclude_lines =
|
||||||
|
|
||||||
ignore_errors = True
|
ignore_errors = True
|
||||||
|
|
||||||
[html]
|
[coverage:html]
|
||||||
directory = coverage_html
|
directory = coverage_html
|
10
setup.py
10
setup.py
|
@ -1,14 +1,8 @@
|
||||||
#!/usr/bin/env python
|
#!/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
|
import os
|
||||||
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
|
|
||||||
here = os.path.dirname(os.path.abspath(__file__))
|
here = os.path.dirname(os.path.abspath(__file__))
|
||||||
f = open(os.path.join(here, 'README.rst'))
|
f = open(os.path.join(here, 'README.rst'))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user