Creating login page on Flask
Allow users to connect to their personal space is one of the most important feature for you web application. In this article, i will explain you how you can add an authentication by adding a login page using the Flask-Login python package.
All script are available on my GitHub here.
So here, we will create a sign up, sign in and login out pages that will allow users to connect to their personnal private spaces that if they are not connected they can’t see them.
Store the active user’s ID in the session, and let you log them in and out easily.
It will allow you :
- Let you restrict views to logged-in (or logged-out) users.
- Handle the normally-tricky “remember me” functionality.
- Help protect your users’ sessions from being stolen by cookie thieves.
Our project will have the following architecture one the project is complete :
---------Create_LoginPage
├── __init__.py # setup your app
├── main.py # the non-auth routes for your app
├── auth.py # the auth routes for your app
├── models.py # your user model
├── db.sqlite # your database
└── templates
├── base.html # contains common layout and links
├──…