<3 Simple login in flask - python <3

in Project HOPE4 years ago (edited)

sesion.png

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.

Coin Marketplace

STEEM 0.16
TRX 0.16
JST 0.030
BTC 59201.08
ETH 2515.32
USDT 1.00
SBD 2.50