Skip to main content

Django Login over Token.

Project description

https://travis-ci.org/jespino/django-lot.png?branch=master https://coveralls.io/repos/jespino/django-lot/badge.png?branch=master https://pypip.in/v/django-lot/badge.png https://pypip.in/d/django-lot/badge.png

Django Login over Token easy the creation of token based logins. Can be one-time-logins, temporary valid logins or permanent logins, always based on your settings.

How to install

You can also install it with: pip install django-lot

Configuration

Add the lot authentication backend to the AUTHENTICATION_BACKENDS settings variable.

Example:

AUTHENTICATION_BACKENDS = (
    "django.contrib.auth.backends.ModelBackend",
    "lot.auth_backend.LOTBackend",
)

Add the lot app to your installed apps and define your settings LOT variable as a dictionary and LOT_MIDDLEWARE_PARAM_NAME if you use the lot middleware.

Example:

LOT = {
  'fast-login': {
      'name': _(u'Fast login'),
      'duration': 60,
      'one-time': True,
  },
  'slow-login': {
      'name': _(u'Slow login'),
      'duration': 60*60*24,
      'one-time': True,
  },
  'always-login': {
      'name': _(u'Always login'),
      'one-time': False,
      'duration': None,
  },
}

LOT_MIDDLEWARE_PARAM_NAME = 'uuid-login'

Usage

You have to create the LOT instances with a user and a type (the uuid and the created date are auto-generated). Then you can use the lot login view, or the the lot login middleware. You can set the session_data attribute to add data to the user session when login with LOT.

If you use the lot middleware you can login in any url that have the param defined in the LOT_MIDDLEWARE_PARAM_NAME and have a valid LOT instance related to it.

If you use the view you can add the next param to redirect the user to an url after the login. By default will redirect you to the “/” url.

Project details


Download files

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

Source Distribution

django-lot-0.0.4.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file django-lot-0.0.4.tar.gz.

File metadata

  • Download URL: django-lot-0.0.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for django-lot-0.0.4.tar.gz
Algorithm Hash digest
SHA256 086e0e7aade5e51411846f37118713b6e74095cdb610c4632504b4d5e222dfb4
MD5 4a5f617ad79ffe16cff0e40398c71ecb
BLAKE2b-256 eb5780c3a7da26e25d6bbbabdea21f83a122b52c9a0a987bb796f38dbea77908

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page