This is an old revision of the document!


03. Authentication

Now it's the time to add authentication to our website.

We will use the built-in Flask client-side encrypted sessions feature, for which will need to take the following steps to enable:

  • Import the session field from Flask;
  • Configure a secret encryption key for the session cookies:
    # insert after initializing `app`
    app.config["SECRET_KEY"] = "<type some secret here>"
  • Write the Flask functions for login.html and logout.html with the appropriate checks / actions.
  • Use the authenticated variable inside the Jinja template and conditionally display the user's status.
ii/labs/s2/02/tasks/03.1680362603.txt.gz ยท Last modified: 2023/04/01 18:23 by florin.stancu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0