logout on failure
This commit is contained in:
parent
e7c8b62ffd
commit
6c45c47497
1 changed files with 5 additions and 3 deletions
4
web.py
4
web.py
|
@ -56,10 +56,12 @@ def main():
|
||||||
def home():
|
def home():
|
||||||
if 'acct' in session:
|
if 'acct' in session:
|
||||||
dc.execute("SELECT * FROM data WHERE username = %s AND instance = %s", (session['username'], session['instance']))
|
dc.execute("SELECT * FROM data WHERE username = %s AND instance = %s", (session['username'], session['instance']))
|
||||||
#TODO: if this fails, redirect to /logout
|
|
||||||
data = dc.fetchone()
|
data = dc.fetchone()
|
||||||
|
try:
|
||||||
for item in ['username', 'instance', 'avi', 'secret', 'client_id', 'client_secret', 'cc', 'ccavi']:
|
for item in ['username', 'instance', 'avi', 'secret', 'client_id', 'client_secret', 'cc', 'ccavi']:
|
||||||
session[item] = data[item]
|
session[item] = data[item]
|
||||||
|
except:
|
||||||
|
return redirect('/logout') #TODO: not good UX
|
||||||
|
|
||||||
if 'cc' not in session:
|
if 'cc' not in session:
|
||||||
session['cc'] = "None"
|
session['cc'] = "None"
|
||||||
|
|
Loading…
Reference in a new issue