Skip to main content

A django user authentication and login application.

Reason this release was yanked:

faulty

Project description

Authentication

A django user authentication and login application.

0. To install the package, use pip

    pip install django-user-login

Instructions

1. Add "authentication" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'authentication',
    ]

2. The App requires bootstrap@5.3.1, bootstrap-icons@1.8.1 and Django Sessions

3. Include the authentication URLconf in your project urls.py like this:

	path('authentication/', include('authentication.urls')),

4. Run python manage.py migrate to create the User models (you'll need the Admin app enabled).

5. In your settings.py file include the following:

    SITE_TITLE = 'your site title'
    
    LOGIN_URL = '/authentication/'

    EMAIL_HOST = 'email-host'
    EMAIL_PORT = email-port
    EMAIL_HOST_USER = 'email-address'
    EMAIL_HOST_PASSWORD = 'email-password'
    EMAIL_USE_TLS = True

6. Include these lines within the head tag of your base template (optional)

    <link rel="stylesheet" href="{% static 'authentication/authentication.css' %}">
    <script src="{% static 'authentication/authentication.js' %}"></script>
    <script>
    	var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
        var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
            return new bootstrap.Tooltip(tooltipTriggerEl)
        })
    </script>

7. Include this line within the body tag of your base template (optional)

	{% include 'authentication/modals.html' %}

8. For login and logout functionality, use -

  • Login

          <a href="{% url 'authentication:login' %}">Login</a> or
          <a href='/authentication/'>Login</a>
    
  • The above functionality will redirect to the "next" parameter in the url after logging the user in.

  • Logout

          <a href="{% url 'authentication:logout' %}">Logout</a> or
          <a href="/authentication/logout/">Logout</a>
    
  • The above functionality will redirect to the login page after logging the user out.

9. If you have included all the lines mentioned in point 6 and 7, you can also use -

  • Login via Bootstrap Modal

          <button data-bs-toggle="modal" data-bs-target="#loginModal">
              Login
          </button>
    
  • The above functionality will display the bootstrap login form Modal and reload the current page after logging the user in.

  • Logout using JS

          <a href="" onclick="logout(event);">Logout</a>
    
  • The above functionality will reload the current page after logging the user out

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-user-login-0.0.2.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

django_user_login-0.0.2-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file django-user-login-0.0.2.tar.gz.

File metadata

  • Download URL: django-user-login-0.0.2.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for django-user-login-0.0.2.tar.gz
Algorithm Hash digest
SHA256 de2054dd72590effd227244548400386029b137bf3a5590e6bec7555b7296496
MD5 a5ab0fcb86ce9c6cb919e54f838b8ec7
BLAKE2b-256 2a3fc7c4dd182aa008295f93c9db10dd08b21c5653a8a81f6183555c565186c8

See more details on using hashes here.

File details

Details for the file django_user_login-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_user_login-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0aa0eb5e13600718badf13e28c195e39ba847cfd8868e844656763dce4a7a091
MD5 a1aebd1b2a84da6b7aa5b1e2c1a9c57b
BLAKE2b-256 d94e7d20cd02a204d81f9129e3d1765f1c470cb971124c810d02aa5272d06382

See more details on using hashes here.

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