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.

01. To install and use the package, use:

    pip install django-user-login

Instructions

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

    INSTALLED_APPS = [
        ...
        'authentication',
    ]

03. The App requires Django Sessions

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

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

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

06. 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 = 'emaill-address'
    EMAIL_HOST_PASSWORD = 'email-password
    EMAIL_USE_TLS = True
    AUTHENTICATION_DEBUG=False

07. For login and logout functionality, use -

  • To Login, use anyone of these

              - <a href="{% url 'authentication:homepage' %}">Login</a>
              - <a href='/authentication/'>Login</a>
    
  • To Logout, use anyone of these

              - <a href="{% url 'authentication:logout' %}">Logout</a>
              - <a href="/authentication/logout/">Logout</a>
    
  • To visit My Account page and edit profile credentials, use any one of these -

              - <a href="{% url 'authentication:account' %}">Account</a>
              - <a href="/authentication/account/">Account</a>
    

08. When AUTHENTICATION_DEBUG = TRUE

    - Live EMAILS will not be sent and verification codes, if any, will be printed on the console.
    - No password validation will happen.

09. Check Demo Website

10. This authentication app creates two models - Person and Address

    class Person(models.Model):
    MALE = 'M'
    FEMALE = 'F'
    NON_BINARY = 'N'
    GENDER_CHOICES = [
            (MALE, "male"),
            (FEMALE, 'female'),
            (NON_BINARY, 'non_binary')
    ]

    user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="person")
    first_name = models.CharField(max_length=64, blank=True, null=True)
    last_name = models.CharField(max_length=64, blank=True, null=True)
    email = models.EmailField(unique=True, blank=True, null=True)
    username = models.CharField(max_length=64, blank=True, null=True)
    gender = models.CharField(max_length=1, choices=GENDER_CHOICES, blank=True, null=True)
    phone = models.CharField(max_length=20, unique=True, blank=True, null=True)
    birth_date = models.DateField(null=True, blank=True)

    class Meta:
            ordering = ['first_name', 'last_name']

    def __str__(self):
            return f"{self.first_name} {self.last_name}"


    class Address(models.Model):
    person = models.ForeignKey(Person, on_delete=models.CASCADE, related_name="address")
    primary = models.BooleanField(default=False)
    first_name = models.CharField(max_length=200)
    last_name = models.CharField(max_length=200)
    email = models.EmailField(max_length=500)
    mobile = models.CharField(max_length=20)
    homephone = models.CharField(max_length=20, null=True, blank=True)
    address1 = models.CharField(max_length=2000)
    address2 = models.CharField(max_length=2000, null=True, blank=True)
    landmark = models.CharField(max_length=500)
    pincode = models.CharField(max_length=10)
    city = models.CharField(max_length=50)
    state = models.CharField(max_length=50)
    country = models.CharField(max_length=50)

    def __str__(self):
            return f"{self.first_name} {self.last_name}"
    
    class Meta:
            ordering = ['first_name', 'last_name']
            verbose_name_plural = "Address Entries"

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.3.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

django_user_login-0.3.0-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-user-login-0.3.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for django-user-login-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4867cc29ddc332828eb74c2087e077f71496bbdf995d539ad92ac63aa942cecf
MD5 af991a3fb84893690d44b95eb53b9137
BLAKE2b-256 2e826bd4ffe593ccc5d61152eb281ce3e56107ce5ba9485d499d04449057cc97

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_user_login-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55c1bb311e8b3f1498e535e86507bde063950dc6c96bb964e867457c38c43766
MD5 9d883192400ced386ec54a92a6252e9c
BLAKE2b-256 e5bd5ff441a8d58f2a0a0ca4b598041de7390e84f2e44584eecf3a13d7ff49a1

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