Skip to content

Commit

Permalink
add logout functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
danmilon committed Nov 25, 2015
1 parent 94811ca commit 153d171
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion templates/index.html
Expand Up @@ -35,7 +35,7 @@ <h2>Είσαι ο χρήστης <span class="monospace">{{username}}</span> κ
{% if week %}
<h1>Τρέχουσα εβδομάδα: <span class="monospace">{{week[0]}} - {{week[1]}}</a></h1>
{% endif %}
<h2>Συνδεδεμένος ως: <strong class="monospace">{{username}}</strong></h2>
<h2>Συνδεδεμένος ως: <strong class="monospace">{{username}} (<a href="/logout">Αποσύνδεση</a>)</strong></h2>
<h2>Το κουτί πρέπει να έχει μέσα <strong class="monospace">{{'%.2f' % (box_amount|round(1))}}€</strong></h2>
<ul class="nav nav-tabs">
<li role="presentation" class="active"><a href="#deliveries" data-toggle="tab">Παραλαβές</a></li>
Expand Down
12 changes: 10 additions & 2 deletions views.py
Expand Up @@ -4,7 +4,7 @@

from sqlalchemy.orm import joinedload
import flask.json as json
from flask import render_template, jsonify, request
from flask import render_template, jsonify, request, Response
from flask_httpauth import HTTPBasicAuth
from passlib.hash import phpass

Expand All @@ -19,7 +19,8 @@
ROLE_MANAGER = 'manager'
APP_VERSION = 'v1'

auth = HTTPBasicAuth(realm='CSA Fragofonias')
auth_realm = 'CSA Fragofonias'
auth = HTTPBasicAuth(realm=auth_realm)


@auth.verify_password
Expand Down Expand Up @@ -214,5 +215,12 @@ def index():
data_json=json.dumps(data))


@app.route('/logout')
def logout():
return Response(
'Αποσυνδεθήκατε επιτυχώς.',
401,
{'WWW-Authenticate': 'Basic realm="%s"' % auth_realm})

if __name__ == '__main__':
app.run(debug=True)

0 comments on commit 153d171

Please sign in to comment.