mirror of
https://github.com/moepman/bk-dss
synced 2024-12-22 23:04:26 +01:00
Fix navigation if session expired.
This commit is contained in:
parent
33e5432c5e
commit
c3c76ec772
6
index.py
6
index.py
@ -35,7 +35,7 @@ class LoginForm(Form):
|
|||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
nav = None
|
nav = None
|
||||||
if 'uuid' in session:
|
if 'uuid' in session and rdb.exists(session['uuid']):
|
||||||
nav = ['edit', 'logout']
|
nav = ['edit', 'logout']
|
||||||
else:
|
else:
|
||||||
nav = ['login']
|
nav = ['login']
|
||||||
@ -45,7 +45,7 @@ def index():
|
|||||||
|
|
||||||
@app.route('/edit', methods=['GET', 'POST'])
|
@app.route('/edit', methods=['GET', 'POST'])
|
||||||
def edit():
|
def edit():
|
||||||
if 'uuid' not in session:
|
if 'uuid' not in session or not rdb.exists(session['uuid']):
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
nav = ['edit', 'logout']
|
nav = ['edit', 'logout']
|
||||||
@ -63,7 +63,7 @@ def edit():
|
|||||||
# TODO error message
|
# TODO error message
|
||||||
l.unbind_s()
|
l.unbind_s()
|
||||||
else:
|
else:
|
||||||
rdb.hset(session'uuid'], 'pswd', pswd)
|
rdb.hset(session['uuid'], 'pswd', pswd)
|
||||||
# TODO show a success message
|
# TODO show a success message
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user