This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST (JSON)
Go to file
Mateusz Sikora de1fb3d81f registration with email verification:
- rebuild login view
- check email verification in LoginSerializer depends on allauth settings
- add test for registration with email verification
2014-10-01 15:31:10 +02:00
rest_auth registration with email verification: 2014-10-01 15:31:10 +02:00
.gitignore Initial commit 2014-04-30 12:50:41 -07:00
.travis.yml update README and travis config 2014-07-17 10:41:46 +02:00
AUTHORS Created AUTHORS, MANIFEST.in, and setup.py. 2014-04-30 13:55:04 -07:00
LICENSE Initial commit 2014-04-30 12:50:41 -07:00
MANIFEST.in Created AUTHORS, MANIFEST.in, and setup.py. 2014-04-30 13:55:04 -07:00
README.md Update README.md 2014-09-05 15:29:34 +02:00
setup.py django-registration replacement 2014-10-01 14:13:21 +02:00

Build Status Coverage Status Requirements Status

django-rest-auth

Since the introduction of django-rest-framework, Django apps have been able to serve up app-level REST API endpoints. As a result, we saw a lot of instances where developers implemented their own REST registration API endpoints here and there, snippets, and so on. We aim to solve this demand by providing django-rest-auth, a set of REST API endpoints to handle User Registration and Authentication tasks. By having these API endpoints, your client apps such as AngularJS, iOS, Android, and others can communicate to your Django backend site independently via REST APIs for User Management. Of course, we'll add more API endpoints as we see the demand.

Features

  1. User Registration with activation
  2. Login/Logout
  3. Retrieve/Update the Django User & user-defined UserProfile model
  4. Password change
  5. Password reset via e-mail

Installation

  1. This project needs the following packages

    django-registration>=1.0

    djangorestframework>=2.3.13

  2. Install this package

  3. Add rest_auth app to INSTALLED_APPS in your django settings.py

     INSTALLED_APPS = (
         ...,
         'rest_framework',
         'rest_framework.authtoken',
         'registration',
         ...,
         'rest_auth',
     )
    
  4. This project depends on django-rest-framework library, therefore the following REST_FRAMEWORK settings needs to be entered in your Django settings.py

     REST_FRAMEWORK = {
             'DEFAULT_AUTHENTICATION_CLASSES': (
             'rest_framework.authentication.SessionAuthentication',
         ),
    
         'DEFAULT_PERMISSION_CLASSES': (
             'rest_framework.permissions.IsAuthenticated',
         )
     }
    
  5. (optional) Lastly, this project accepts the following Django setting values. You can set the UserProfile model (do not define it if you are not using any UserProfile model) and/or create your own REST registration backend for django-registration (default is registration.backends.simple.views.RegistrationView)

     REST_REGISTRATION_BACKEND = 'your_app.backends.rest_registration.RESTRegistrationView'
     REST_PROFILE_MODULE = 'your_app.UserProfile'
    
  6. Add rest_auth urls in your project root urls.py

     urlpatterns = patterns('',
         ...,
         (r'^rest-auth/', include('rest_auth.urls')),
     )
    
  7. You're good to go now!

API endpoints without Authentication

  1. /rest-auth/register/
    • POST
      • username
      • password
      • email
      • first_name
      • last_name
  2. /rest-auth/password/reset/
    • POST
      • email
  3. /rest-auth/password/reset/confirm/{uidb64}/{token}/
    • POST
      • new_password1
      • new_password2
  4. /rest-auth/login/
    • POST
      • username
      • password
  5. /rest-auth/verify-email/{activation_key}/
    • GET

API endpoints with Authentication

  1. /rest-auth/logout/

    • GET
  2. /rest-auth/user/

    • GET & POST
      • POST parameters
        • user as dictionary
        • user-defined UserProfile model fields
        • user data example "user": {"id": 1, "first_name": "Person", "last_name": "2"}
  3. /rest-auth/password/change/

    • POST
      • new_password1
      • new_password2