02. [30p] Mock Authentication

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

  • Use a server-side session to store the user's state (e.g., an authenticated bool + username string keys).
    • Don't forget to set a secret_key for the session, otherwise it won't work!
  • Write the Flask functions for /login and /logout with the appropriate checks / actions.
  • You can either use the included login.html template page, or roll out your own!
    • Check out the input names inside the <form>!
  • Hint: you can also set the authenticated variable inside the Jinja template to conditionally display the user's status.
    • You can use a Flask context processor to avoid needless code duplication;
    • Alternative: the session is readily available inside Jinja2 templates!
ii/labs/s2/03/tasks/02.txt ยท Last modified: 2024/04/01 21:39 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