Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ii:labs:s2:03:tasks:02 [2022/05/04 14:05]
radu.ciobanu created
ii:labs:s2:03:tasks:02 [2024/04/01 21:39] (current)
florin.stancu created
Line 1: Line 1:
-==== 02. [10pRunning containers ​====+==== 02. [30pMock 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 [[https://​flask.palletsprojects.com/​en/​3.0.x/​templating/#​context-processors|context processor]] to avoid needless code duplication;​ 
 +    * //​Alternative//:​ the ''​session''​ is readily available inside Jinja2 templates! 
 + 
ii/labs/s2/03/tasks/02.1651662310.txt.gz · Last modified: 2022/05/04 14:05 by radu.ciobanu
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