User Authentication policy is a very crucial process for every application and organization. It is a process used to identify verified users and allow them to access accounts and networks securely. It is a process in which you verify that someone who is attempting to access services and applications is who they claim to be which can be established in various ways such as entering a password into your laptop or phone or a PIN number into your ATM. So far, we have built a web application that uses forms but we are still missing a major piece of basically almost every web application which is: USER AUTHENTICATION.
Implementing this is famously hard. There are many security concerns so its not advisable to do it yourself but with the help of Django which comes with a powerful built-in user authentication system that we can use, its much more easier.
Whenever we create a new project, by default, Django installs the auth app which provides us with a User Object containing:
We will then use the User Object to implement log in, log out and sign up in our blog application.
Django already provides us with a default view for login page via LoginView so all we have to do is add a url pattern for the auth system, a log in template, and a small update to our settings.py file.
First, we will update the blog_project/urls.py where we will place our log in and log out pages at the accounts/URL.
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path(‘admin/’, admin.site.urls),
path(‘accounts/’, include(‘django.contrib.auth.urls’)), # new
path(”, include(‘blog.urls’)),
]
Introduction Python is a programming language that has a large sum of frameworks. One of…
Introduction What is Cloud Computing? According to Wikipedia, Cloud Computing is a paradigm for enabling…
Introduction In the fast paced world of technology, learning a versatile and high-in-demand programming language…
Introduction In previous articles, we have learnt about Django, how it works and how we…
Introduction In this article, we shall learn how to build and implement a blog app.…
Introduction In this article, we shall use a database for the first time to build…