mirror of
https://github.com/Steffo99/estus.git
synced 2024-11-26 01:24:18 +00:00
Add logout page
(Why was it missing in the first place?)
This commit is contained in:
parent
ec98062e0e
commit
7d77a8bf5d
2 changed files with 11 additions and 3 deletions
12
server.py
12
server.py
|
@ -190,8 +190,7 @@ def page_home():
|
||||||
if 'username' not in session:
|
if 'username' not in session:
|
||||||
return redirect(url_for('page_login'))
|
return redirect(url_for('page_login'))
|
||||||
else:
|
else:
|
||||||
session.pop('username')
|
return redirect(url_for('page_dashboard'))
|
||||||
return redirect(url_for('page_login'))
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/login', methods=['GET', 'POST'])
|
@app.route('/login', methods=['GET', 'POST'])
|
||||||
|
@ -210,6 +209,15 @@ def page_login():
|
||||||
return render_template('error.htm', error="Username o password non validi.")
|
return render_template('error.htm', error="Username o password non validi.")
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/logout')
|
||||||
|
def page_logout():
|
||||||
|
"""Pagina di logout:
|
||||||
|
slogga l'utente se visitata"""
|
||||||
|
if 'username' in session:
|
||||||
|
session.pop('username')
|
||||||
|
return redirect(url_for('page_login'))
|
||||||
|
|
||||||
|
|
||||||
@app.route('/dashboard')
|
@app.route('/dashboard')
|
||||||
def page_dashboard():
|
def page_dashboard():
|
||||||
"""Dashboard del sito:
|
"""Dashboard del sito:
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<li class="navbar-text">
|
<li class="navbar-text">
|
||||||
Sei connesso come <b>{{user}}</b>
|
Sei connesso come <b>{{user}}</b>
|
||||||
</li>
|
</li>
|
||||||
<a href="/login" class="btn btn-danger navbar-btn btn-right">Logout</a>
|
<a href="/logout" class="btn btn-danger navbar-btn btn-right">Logout</a>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue