mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-12-02 05:43:44 +03:00
Renames project to dj-rest-auth
This commit is contained in:
parent
624ad01afb
commit
92cc9c18ec
|
@ -11,9 +11,9 @@ env:
|
|||
install:
|
||||
- pip install -q Django==$DJANGO djangorestframework==$DRF
|
||||
- pip install coveralls
|
||||
- pip install -r rest_auth/tests/requirements.pip
|
||||
- pip install -r dj_rest_auth/tests/requirements.pip
|
||||
script:
|
||||
- coverage run --source=rest_auth setup.py test
|
||||
- coverage run --source=dj_rest_auth setup.py test
|
||||
after_success:
|
||||
- coveralls
|
||||
before_script:
|
||||
|
|
2
AUTHORS
2
AUTHORS
|
@ -1 +1 @@
|
|||
http://github.com/Tivix/django-rest-auth/contributors
|
||||
http://github.com/iMerica/dj-rest-auth/contributors
|
||||
|
|
4
LICENSE
4
LICENSE
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Tivix
|
||||
Copyright (c) 2014 iMerica
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
|
|
|
@ -2,4 +2,4 @@ include AUTHORS
|
|||
include LICENSE
|
||||
include MANIFEST.in
|
||||
include README.md
|
||||
graft rest_auth
|
||||
graft dj_rest_auth
|
||||
|
|
22
README.rst
22
README.rst
|
@ -1,31 +1,31 @@
|
|||
Welcome to django-rest-auth
|
||||
Welcome to dj-rest-auth
|
||||
===========================
|
||||
|
||||
.. image:: https://travis-ci.org/Tivix/django-rest-auth.svg
|
||||
:target: https://travis-ci.org/Tivix/django-rest-auth
|
||||
.. image:: https://travis-ci.org/iMerica/dj-rest-auth.svg
|
||||
:target: https://travis-ci.org/iMerica/dj-rest-auth
|
||||
|
||||
|
||||
.. image:: https://coveralls.io/repos/Tivix/django-rest-auth/badge.svg
|
||||
:target: https://coveralls.io/r/Tivix/django-rest-auth?branch=master
|
||||
.. image:: https://coveralls.io/repos/iMerica/dj-rest-auth/badge.svg
|
||||
:target: https://coveralls.io/r/iMerica/dj-rest-auth?branch=master
|
||||
|
||||
|
||||
.. image:: https://readthedocs.org/projects/django-rest-auth/badge/?version=latest
|
||||
:target: https://readthedocs.org/projects/django-rest-auth/?badge=latest
|
||||
.. image:: https://readthedocs.org/projects/dj-rest-auth/badge/?version=latest
|
||||
:target: https://readthedocs.org/projects/dj-rest-auth/?badge=latest
|
||||
|
||||
|
||||
Django-rest-auth provides a set of REST API endpoints for Authentication and Registration
|
||||
Django-dj-rest-auth provides a set of REST API endpoints for Authentication and Registration
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
http://django-rest-auth.readthedocs.org/en/latest/
|
||||
http://dj-rest-auth.readthedocs.org/en/latest/
|
||||
|
||||
|
||||
Source code
|
||||
-----------
|
||||
https://github.com/Tivix/django-rest-auth
|
||||
https://github.com/iMerica/dj-rest-auth
|
||||
|
||||
|
||||
Stack Overflow
|
||||
-----------
|
||||
http://stackoverflow.com/questions/tagged/django-rest-auth
|
||||
http://stackoverflow.com/questions/tagged/dj-rest-auth
|
||||
|
|
|
@ -37,11 +37,11 @@ INSTALLED_APPS = (
|
|||
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
'rest_auth',
|
||||
'dj_rest_auth',
|
||||
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'rest_auth.registration',
|
||||
'dj_rest_auth.registration',
|
||||
'allauth.socialaccount',
|
||||
'allauth.socialaccount.providers.facebook',
|
||||
'rest_framework_swagger',
|
||||
|
|
|
@ -35,8 +35,8 @@ urlpatterns = [
|
|||
TemplateView.as_view(template_name="password_reset_confirm.html"),
|
||||
name='password_reset_confirm'),
|
||||
|
||||
url(r'^rest-auth/', include('rest_auth.urls')),
|
||||
url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),
|
||||
url(r'^dj-rest-auth/', include('dj_rest_auth.urls')),
|
||||
url(r'^dj-rest-auth/registration/', include('dj_rest_auth.registration.urls')),
|
||||
url(r'^account/', include('allauth.urls')),
|
||||
url(r'^admin/', admin.site.urls),
|
||||
url(r'^accounts/profile/$', RedirectView.as_view(url='/', permanent=True), name='profile-redirect'),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
django>=1.9.0
|
||||
django-rest-auth==0.9.5
|
||||
dj-rest-auth==0.9.5
|
||||
djangorestframework>=3.7.0
|
||||
django-allauth>=0.24.1
|
||||
six==1.9.0
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="Django-rest-auth demo">
|
||||
<meta name="author" content="Tivix, Inc.">
|
||||
<meta name="description" content="Django-dj-rest-auth demo">
|
||||
<meta name="author" content="iMerica, Inc.">
|
||||
|
||||
<title>django-rest-auth demo</title>
|
||||
<title>dj-rest-auth demo</title>
|
||||
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
|
@ -53,13 +53,13 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/">django-rest-auth demo</a>
|
||||
<a class="navbar-brand" href="/">dj-rest-auth demo</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="active"><a href="/">Demo</a></li>
|
||||
<li><a target="_blank" href="http://django-rest-auth.readthedocs.org/en/latest/">Documentation</a></li>
|
||||
<li><a target="_blank" href="https://github.com/Tivix/django-rest-auth">Source code</a></li>
|
||||
<li><a target="_blank" href="http://dj-rest-auth.readthedocs.org/en/latest/">Documentation</a></li>
|
||||
<li><a target="_blank" href="https://github.com/iMerica/dj-rest-auth">Source code</a></li>
|
||||
<li><a target="_blank" href="{% url 'api_docs' %}">API Docs</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
{% block content %}
|
||||
<!-- Main jumbotron for a primary marketing message or call to action -->
|
||||
<div class="jumbotron">
|
||||
<h1>django-rest-auth demo</h1>
|
||||
<p>Welcome in django-rest-auth demo project!</p>
|
||||
<h1>dj-rest-auth demo</h1>
|
||||
<p>Welcome in dj-rest-auth demo project!</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf import settings
|
||||
|
||||
from rest_auth.serializers import (
|
||||
from dj_rest_auth.serializers import (
|
||||
TokenSerializer as DefaultTokenSerializer,
|
||||
JWTSerializer as DefaultJWTSerializer,
|
||||
UserDetailsSerializer as DefaultUserDetailsSerializer,
|
|
@ -72,7 +72,7 @@ Basing on example from installation section :doc:`Installation </installation>`
|
|||
- access_token
|
||||
- code
|
||||
|
||||
.. note:: ``access_token`` OR ``code`` can be used as standalone arguments, see https://github.com/Tivix/django-rest-auth/blob/master/rest_auth/registration/views.py
|
||||
.. note:: ``access_token`` OR ``code`` can be used as standalone arguments, see https://github.com/Tivix/django-rest-auth/blob/master/dj_rest_auth/registration/views.py
|
||||
|
||||
- /rest-auth/twitter/ (POST)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ Changelog
|
|||
|
||||
0.9.1
|
||||
-----
|
||||
- fixed import error when extending rest_auth serializers
|
||||
- fixed import error when extending dj_rest_auth serializers
|
||||
- added sensitive fields decorator
|
||||
- added Spanish translations
|
||||
|
||||
|
@ -109,7 +109,7 @@ Changelog
|
|||
-----
|
||||
|
||||
- replaced ``django-registration`` with ``django-allauth``
|
||||
- moved registration logic to separated django application (``rest_auth.registration``)
|
||||
- moved registration logic to separated django application (``dj_rest_auth.registration``)
|
||||
- added serializers customization in django settings
|
||||
- added social media authentication view
|
||||
- changed request method from GET to POST in logout endpoint
|
||||
|
|
|
@ -6,19 +6,19 @@ Configuration
|
|||
You can define your custom serializers for each endpoint without overriding urls and views by adding ``REST_AUTH_SERIALIZERS`` dictionary in your django settings.
|
||||
Possible key values:
|
||||
|
||||
- LOGIN_SERIALIZER - serializer class in ``rest_auth.views.LoginView``, default value ``rest_auth.serializers.LoginSerializer``
|
||||
- LOGIN_SERIALIZER - serializer class in ``dj_rest_auth.views.LoginView``, default value ``rest_auth.serializers.LoginSerializer``
|
||||
|
||||
- TOKEN_SERIALIZER - response for successful authentication in ``rest_auth.views.LoginView``, default value ``rest_auth.serializers.TokenSerializer``
|
||||
- TOKEN_SERIALIZER - response for successful authentication in ``dj_rest_auth.views.LoginView``, default value ``rest_auth.serializers.TokenSerializer``
|
||||
|
||||
- JWT_SERIALIZER - (Using REST_USE_JWT=True) response for successful authentication in ``rest_auth.views.LoginView``, default value ``rest_auth.serializers.JWTSerializer``
|
||||
- JWT_SERIALIZER - (Using REST_USE_JWT=True) response for successful authentication in ``dj_rest_auth.views.LoginView``, default value ``rest_auth.serializers.JWTSerializer``
|
||||
|
||||
- USER_DETAILS_SERIALIZER - serializer class in ``rest_auth.views.UserDetailsView``, default value ``rest_auth.serializers.UserDetailsSerializer``
|
||||
- USER_DETAILS_SERIALIZER - serializer class in ``dj_rest_auth.views.UserDetailsView``, default value ``rest_auth.serializers.UserDetailsSerializer``
|
||||
|
||||
- PASSWORD_RESET_SERIALIZER - serializer class in ``rest_auth.views.PasswordResetView``, default value ``rest_auth.serializers.PasswordResetSerializer``
|
||||
- PASSWORD_RESET_SERIALIZER - serializer class in ``dj_rest_auth.views.PasswordResetView``, default value ``rest_auth.serializers.PasswordResetSerializer``
|
||||
|
||||
- PASSWORD_RESET_CONFIRM_SERIALIZER - serializer class in ``rest_auth.views.PasswordResetConfirmView``, default value ``rest_auth.serializers.PasswordResetConfirmSerializer``
|
||||
- PASSWORD_RESET_CONFIRM_SERIALIZER - serializer class in ``dj_rest_auth.views.PasswordResetConfirmView``, default value ``rest_auth.serializers.PasswordResetConfirmSerializer``
|
||||
|
||||
- PASSWORD_CHANGE_SERIALIZER - serializer class in ``rest_auth.views.PasswordChangeView``, default value ``rest_auth.serializers.PasswordChangeSerializer``
|
||||
- PASSWORD_CHANGE_SERIALIZER - serializer class in ``dj_rest_auth.views.PasswordChangeView``, default value ``rest_auth.serializers.PasswordChangeSerializer``
|
||||
|
||||
|
||||
Example configuration:
|
||||
|
@ -36,13 +36,13 @@ Configuration
|
|||
You can define your custom serializers for registration endpoint.
|
||||
Possible key values:
|
||||
|
||||
- REGISTER_SERIALIZER - serializer class in ``rest_auth.registration.views.RegisterView``, default value ``rest_auth.registration.serializers.RegisterSerializer``
|
||||
- REGISTER_SERIALIZER - serializer class in ``dj_rest_auth.registration.views.RegisterView``, default value ``rest_auth.registration.serializers.RegisterSerializer``
|
||||
|
||||
.. note:: The custom REGISTER_SERIALIZER must define a ``def save(self, request)`` method that returns a user model instance
|
||||
|
||||
- **REST_AUTH_TOKEN_MODEL** - model class for tokens, default value ``rest_framework.authtoken.models``
|
||||
|
||||
- **REST_AUTH_TOKEN_CREATOR** - callable to create tokens, default value ``rest_auth.utils.default_create_token``.
|
||||
- **REST_AUTH_TOKEN_CREATOR** - callable to create tokens, default value ``dj_rest_auth.utils.default_create_token``.
|
||||
|
||||
- **REST_SESSION_LOGIN** - Enable session login in Login API view (default: True)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ FAQ
|
|||
|
||||
1. Why account_confirm_email url is defined but it is not usable?
|
||||
|
||||
In /rest_auth/registration/urls.py we can find something like this:
|
||||
In /dj_rest_auth/registration/urls.py we can find something like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -36,12 +36,12 @@ FAQ
|
|||
# custom fields for user
|
||||
company_name = models.CharField(max_length=100)
|
||||
|
||||
To allow update user details within one request send to rest_auth.views.UserDetailsView view, create serializer like this:
|
||||
To allow update user details within one request send to dj_rest_auth.views.UserDetailsView view, create serializer like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from rest_framework import serializers
|
||||
from rest_auth.serializers import UserDetailsSerializer
|
||||
from dj_rest_auth.serializers import UserDetailsSerializer
|
||||
|
||||
class UserSerializer(UserDetailsSerializer):
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Installation
|
|||
|
||||
pip install django-rest-auth
|
||||
|
||||
2. Add ``rest_auth`` app to INSTALLED_APPS in your django settings.py:
|
||||
2. Add ``dj_rest_auth`` app to INSTALLED_APPS in your django settings.py:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -16,19 +16,19 @@ Installation
|
|||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
...,
|
||||
'rest_auth'
|
||||
'dj_rest_auth'
|
||||
)
|
||||
|
||||
|
||||
.. note:: This project depends on ``django-rest-framework`` library, so install it if you haven't done yet. Make sure also you have installed ``rest_framework`` and ``rest_framework.authtoken`` apps
|
||||
|
||||
3. Add rest_auth urls:
|
||||
3. Add dj_rest_auth urls:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
urlpatterns = [
|
||||
...,
|
||||
url(r'^rest-auth/', include('rest_auth.urls'))
|
||||
url(r'^rest-auth/', include('dj_rest_auth.urls'))
|
||||
]
|
||||
|
||||
4. Migrate your database
|
||||
|
@ -46,7 +46,7 @@ Registration (optional)
|
|||
|
||||
1. If you want to enable standard registration process you will need to install ``django-allauth`` by using ``pip install django-rest-auth[with_social]``.
|
||||
|
||||
2. Add ``django.contrib.sites``, ``allauth``, ``allauth.account`` and ``rest_auth.registration`` apps to INSTALLED_APPS in your django settings.py:
|
||||
2. Add ``django.contrib.sites``, ``allauth``, ``allauth.account`` and ``dj_rest_auth.registration`` apps to INSTALLED_APPS in your django settings.py:
|
||||
|
||||
3. Add ``SITE_ID = 1`` to your django settings.py
|
||||
|
||||
|
@ -57,19 +57,19 @@ Registration (optional)
|
|||
'django.contrib.sites',
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'rest_auth.registration',
|
||||
'dj_rest_auth.registration',
|
||||
)
|
||||
|
||||
SITE_ID = 1
|
||||
|
||||
3. Add rest_auth.registration urls:
|
||||
3. Add dj_rest_auth.registration urls:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
urlpatterns = [
|
||||
...,
|
||||
url(r'^rest-auth/', include('rest_auth.urls')),
|
||||
url(r'^rest-auth/registration/', include('rest_auth.registration.urls'))
|
||||
url(r'^rest-auth/', include('dj_rest_auth.urls')),
|
||||
url(r'^rest-auth/registration/', include('dj_rest_auth.registration.urls'))
|
||||
]
|
||||
|
||||
|
||||
|
@ -88,12 +88,12 @@ Using ``django-allauth``, ``django-rest-auth`` provides helpful class for creati
|
|||
...,
|
||||
'rest_framework',
|
||||
'rest_framework.authtoken',
|
||||
'rest_auth'
|
||||
'dj_rest_auth'
|
||||
...,
|
||||
'django.contrib.sites',
|
||||
'allauth',
|
||||
'allauth.account',
|
||||
'rest_auth.registration',
|
||||
'dj_rest_auth.registration',
|
||||
...,
|
||||
'allauth.socialaccount',
|
||||
'allauth.socialaccount.providers.facebook',
|
||||
|
@ -106,12 +106,12 @@ Using ``django-allauth``, ``django-rest-auth`` provides helpful class for creati
|
|||
Facebook
|
||||
########
|
||||
|
||||
3. Create new view as a subclass of ``rest_auth.registration.views.SocialLoginView`` with ``FacebookOAuth2Adapter`` adapter as an attribute:
|
||||
3. Create new view as a subclass of ``dj_rest_auth.registration.views.SocialLoginView`` with ``FacebookOAuth2Adapter`` adapter as an attribute:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from allauth.socialaccount.providers.facebook.views import FacebookOAuth2Adapter
|
||||
from rest_auth.registration.views import SocialLoginView
|
||||
from dj_rest_auth.registration.views import SocialLoginView
|
||||
|
||||
class FacebookLogin(SocialLoginView):
|
||||
adapter_class = FacebookOAuth2Adapter
|
||||
|
@ -131,13 +131,13 @@ 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.registration.views.SocialLoginView`` with ``TwitterOAuthAdapter`` adapter and ``TwitterLoginSerializer`` as an attribute:
|
||||
3. Create new view as a subclass of ``dj_rest_auth.registration.views.SocialLoginView`` with ``TwitterOAuthAdapter`` adapter and ``TwitterLoginSerializer`` as an attribute:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from allauth.socialaccount.providers.twitter.views import TwitterOAuthAdapter
|
||||
from rest_auth.registration.views import SocialLoginView
|
||||
from rest_auth.social_serializers import TwitterLoginSerializer
|
||||
from dj_rest_auth.registration.views import SocialLoginView
|
||||
from dj_rest_auth.social_serializers import TwitterLoginSerializer
|
||||
|
||||
class TwitterLogin(SocialLoginView):
|
||||
serializer_class = TwitterLoginSerializer
|
||||
|
@ -160,13 +160,13 @@ 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:
|
||||
3. Create new view as a subclass of ``dj_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
|
||||
from dj_rest_auth.registration.views import SocialLoginView
|
||||
|
||||
class GithubLogin(SocialLoginView):
|
||||
adapter_class = GitHubOAuth2Adapter
|
||||
|
@ -193,8 +193,8 @@ If you want to allow connecting existing accounts in addition to login, you can
|
|||
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
|
||||
from dj_rest_auth.registration.views import SocialConnectView
|
||||
from dj_rest_auth.social_serializers import TwitterConnectSerializer
|
||||
|
||||
class FacebookConnect(SocialConnectView):
|
||||
adapter_class = FacebookOAuth2Adapter
|
||||
|
@ -224,7 +224,7 @@ You can also use the following views to check all social accounts attached to th
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from rest_auth.registration.views import (
|
||||
from dj_rest_auth.registration.views import (
|
||||
SocialAccountListView, SocialAccountDisconnectView
|
||||
)
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ Features
|
|||
Apps structure
|
||||
--------------
|
||||
|
||||
* ``rest_auth`` has basic auth functionality like login, logout, password reset and password change
|
||||
* ``rest_auth.registration`` has logic related with registration and social media authentication
|
||||
* ``dj_rest_auth`` has basic auth functionality like login, logout, password reset and password change
|
||||
* ``dj_rest_auth.registration`` has logic related with registration and social media authentication
|
||||
|
||||
|
||||
Angular app
|
||||
|
|
Loading…
Reference in New Issue
Block a user