Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Django application to easily handle signup, login and logout

Project Description

django-ohm2-handlers-light source code
=============================


Installation:

#. Create a Python +3.5 virtualenv

#. Install dependencies::

- ohm2_handlers_light
- rest_framework

#. Add 'ohm2_accounts_light' to installed apps::

INSTALLED_APPS = [
'''
'ohm2_accounts_light',
...
]

#. Create tables::

./manage.py migrate




Models
------

handlers_light comes with two basic models::
#from ohm2_handlers_light.models import BaseModel

class PasswordReset(BaseModel):
user = models.ForeignKey(User)

last_sent_date = models.DateTimeField(null = True, blank = True, default = None)
activation_date = models.DateTimeField(null = True, blank = True, default = None)
ip_address = models.GenericIPAddressField(null = True, blank = True, default = "")
code = models.CharField(max_length = settings.STRING_NORMAL, unique = True)


def send_again(self):
if self.last_sent_date and not h_utils.is_older_than_now(self.last_sent_date, seconds = settings.MINIMUM_PASSWORD_RESET_DELAY):
return False
return True

def __str__(self):
return self.user.username


Pipelines
---------

Use this pipelines to handle cascade-functions.

Signup (ohm2_accounts_light.pipelines.signup.default)::

# 1: user = ohm2_accounts_light_utils.create_user(username, email, password)
# 2: ohm2_accounts_light_utils.run_signup_pipeline(request, user, username, email, password)


Login (ohm2_accounts_light.pipelines.login.default)::

# 1: auth_user = authenticate(username, password)
# 2: ohm2_accounts_light_utils.run_login_pipeline(request, auth_user)


Logout (ohm2_accounts_light.pipelines.logout.default)::

# 1: ohm2_accounts_light_utils.run_logout_pipeline(request)



Behavior can be change on the settins.py like this::

OHM2_ACCOUNTS_LIGHT_SIGNUP_PIPELINE = (
'your_app.pipelines.signup.pipeline_1',
'your_app.pipelines.signup.pipeline_2',
)

OHM2_ACCOUNTS_LIGHT_LOGIN_PIPELINE = (
'your_app.pipelines.login.pipeline_1',
'your_app.pipelines.login.pipeline_2',
)

OHM2_ACCOUNTS_LIGHT_LOGOUT_PIPELINE = (
'your_app.pipelines.logout.pipeline_1',
'your_app.pipelines.logout.pipeline_2',
)





Variables
---------

OHM2_ACCOUNTS_LIGHT_CHECK_PASSWORD_SECURE: check if user password is secure (default: True)
OHM2_ACCOUNTS_LIGHT_SIGNUPS_ENABLED: signup enabled (disabled) (default: True)
OHM2_ACCOUNTS_LIGHT_ENABLE_EMAIL_LOGIN: users are able to login using their email address (default: True)
OHM2_ACCOUNTS_LIGHT_UNIQUE_USER_EMAILS: if True, users must have unique email addresses (default: True)
OHM2_ACCOUNTS_LIGHT_SIGNUP_PIPELINE: sets the signup pipeline
OHM2_ACCOUNTS_LIGHT_LOGIN_PIPELINE: sets the login pipeline
OHM2_ACCOUNTS_LIGHT_LOGOUT_PIPELINE: sets the logout pipeline



API - v1
--------

Add 'ohm2_accounts_light.api.v1.urls' to your 'urls.py'.

Signup (ohm2_accounts_light.api.v1.views.signup)::

Runs the signup pipeline checking this variables::

1.- CHECK_PASSWORD_SECURE: if True, check user's password using 'ohm2_accounts_light.utils.is_password_secure'.
2.- SIGNUPS_ENABLED: if True, signups are allowed. If False, no signups will take place.


Login(ohm2_accounts_light.api.v1.views.login)::

Runs the login pipeline checking this variables::

1.- ENABLE_EMAIL_LOGIN: if True, will try to use username as email address.
2.- UNIQUE_USER_EMAILS: if True, will get user objects using 'h_utils.get_db' function


Logout(ohm2_accounts_light.api.v1.views.logout)::

Runs the logout pipeline.


Release History

This version
History Node

0.4.0

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.2.13

History Node

0.2.12

History Node

0.2.10

History Node

0.2.8

History Node

0.2.6

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

History Node

0.0.20

History Node

0.0.19

History Node

0.0.18

History Node

0.0.17

History Node

0.0.16

History Node

0.0.15

History Node

0.0.14

History Node

0.0.13

History Node

0.0.12

History Node

0.0.11

History Node

0.0.10

History Node

0.0.9

History Node

0.0.8

History Node

0.0.7

History Node

0.0.6

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
django-ohm2-accounts-light-0.4.0.tar.gz
(26.3 kB) Copy SHA256 Hash SHA256
Source Dec 28, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting