mirror of
https://github.com/moepman/bk-dss
synced 2024-11-01 01:27:05 +01:00
Refactor isLoggedin.
This commit is contained in:
parent
3dde9cb790
commit
60e5380d37
8
index.py
8
index.py
@ -32,10 +32,14 @@ class LoginForm(Form):
|
|||||||
submit = SubmitField('Login')
|
submit = SubmitField('Login')
|
||||||
|
|
||||||
|
|
||||||
|
def isLoggedin():
|
||||||
|
return 'uuid' in session and rdb.exists(session['uuid'])
|
||||||
|
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
nav = None
|
nav = None
|
||||||
if 'uuid' in session and rdb.exists(session['uuid']):
|
if isLoggedin():
|
||||||
nav = ['edit', 'logout']
|
nav = ['edit', 'logout']
|
||||||
else:
|
else:
|
||||||
nav = ['login']
|
nav = ['login']
|
||||||
@ -45,7 +49,7 @@ def index():
|
|||||||
|
|
||||||
@app.route('/edit', methods=['GET', 'POST'])
|
@app.route('/edit', methods=['GET', 'POST'])
|
||||||
def edit():
|
def edit():
|
||||||
if 'uuid' not in session or not rdb.exists(session['uuid']):
|
if not isLoggedin():
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
|
|
||||||
nav = ['edit', 'logout']
|
nav = ['edit', 'logout']
|
||||||
|
Loading…
Reference in New Issue
Block a user