<3 Simple login in flask - python <3
Here I show you a small section of my code, where I am creating a simple session (for now) in Flask and Python. The more secure a session, the more stable your software will be
Explanation:
- @ app.route: define the name of the route on the web. This path will be directly available to the function that will be below.
- def logout(): Defines the function where the functionalities or processes associated with the already defined route will be specified.
- if 'user' in session: This is a conditional, which checks if a certain user is logged in, and is active, allows you to log out successfully, otherwise it will issue an error.
- function FLASH(TEXT): It allows creating for a limited period of time, the message that will be shown to the user when processing their request.
- return redirect('URL'): At the end of the process, the system will automatically redirect to the established route.