User registration REST API, based on django-rest-framework
Project description
User registration REST API, based on django-rest-framework.
WARNING: django-rest-registration is only Python 3 compatible.
Features
Supported views:
registration (sign-up) with verification
login/logout (sign-in), session- or token-based
user profile (retrieving / updating)
reset password
change password
register (change) e-mail
Modeless (uses cryptographic signing instead of profile models)
Heavily tested (Above 99% code coverage)
Current limitations
Supports only one email per user (as model field)
Heavily based on Django an Django-REST-Framework
Python3 only
Installation
You can install django-rest-registration via pip:
pip install git+https://github.com/szopu/django-rest-registration
Then, you should add it to the INSTALLED_APPS so the app templates for notification emails can be accessed:
INSTALLED_APPS=( ... 'rest_registration', ),
After that, you can use the urls in your urlconfig, for instance:
api_urlpatterns = [ ... url(r'accounts/', include('rest_registration.api.urls')), ] urlpatterns = [ ... url(r'^api/v1/', include(api_urlpatterns)), ]
Configuration
You can configure django-rest-registraton using the REST_REGISTRATION setting in your django settings (similarly to django-rest-framework). The default values are:
REST_REGISTRATION = { 'USER_LOGIN_FIELDS': None, 'USER_HIDDEN_FIELDS': ( 'is_active', 'is_staff', 'is_superuser', 'user_permissions', 'groups', 'date_joined', ), 'USER_PUBLIC_FIELDS': None, 'USER_EMAIL_FIELD': 'email', 'USER_VERIFICATION_FLAG_FIELD': 'is_active', 'REGISTER_SERIALIZER_CLASS': ( 'rest_registration.api.serializers.DefaultRegisterUserSerializer'), 'REGISTER_VERIFICATION_ENABLED': True, 'REGISTER_VERIFICATION_PERIOD': datetime.timedelta(days=7), 'REGISTER_VERIFICATION_URL': None, 'REGISTER_VERIFICATION_EMAIL_TEMPLATES': { 'subject': 'rest_registration/register/subject.txt', 'body': 'rest_registration/register/body.txt', }, 'LOGIN_AUTHENTICATE_SESSION': None, 'LOGIN_RETRIEVE_TOKEN': None, 'RESET_PASSWORD_VERIFICATION_PERIOD': datetime.timedelta(days=1), 'RESET_PASSWORD_VERIFICATION_URL': None, 'RESET_PASSWORD_VERIFICATION_EMAIL_TEMPLATES': { 'subject': 'rest_registration/reset_password/subject.txt', 'body': 'rest_registration/reset_password/body.txt', }, 'REGISTER_EMAIL_VERIFICATION_ENABLED': True, 'REGISTER_EMAIL_VERIFICATION_PERIOD': datetime.timedelta(days=7), 'REGISTER_EMAIL_VERIFICATION_URL': None, 'REGISTER_EMAIL_VERIFICATION_EMAIL_TEMPLATES': { 'subject': 'rest_registration/register_email/subject.txt', 'body': 'rest_registration/register_email/body.txt', }, 'PROFILE_SERIALIZER_CLASS': ( 'rest_registration.api.serializers.DefaultUserProfileSerializer'), 'VERIFICATION_FROM_EMAIL': None, 'VERIFICATION_REPLY_TO_EMAIL': None, }
The USER_* fields can be set directly in the user class (specified by settings.AUTH_USER_MODEL) without using the USER_ prefix (EMAIL_FIELD, etc.).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-rest-registration-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae1a3b26f93669679d494f07e2694b6f5ff9b9720706f05c5ca7c021486d95c4 |
|
MD5 | ab95aedea5f8c7a3a3b74d9fa5f3749e |
|
BLAKE2b-256 | bcfaee9b0095301b2ccae400c5f22493b4df93376ce4777aef1053a3c7cbea16 |