logout on failure
This commit is contained in:
parent
e7c8b62ffd
commit
6c45c47497
1 changed files with 5 additions and 3 deletions
8
web.py
8
web.py
|
@ -56,10 +56,12 @@ def main():
|
|||
def home():
|
||||
if 'acct' in session:
|
||||
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()
|
||||
for item in ['username', 'instance', 'avi', 'secret', 'client_id', 'client_secret', 'cc', 'ccavi']:
|
||||
session[item] = data[item]
|
||||
try:
|
||||
for item in ['username', 'instance', 'avi', 'secret', 'client_id', 'client_secret', 'cc', 'ccavi']:
|
||||
session[item] = data[item]
|
||||
except:
|
||||
return redirect('/logout') #TODO: not good UX
|
||||
|
||||
if 'cc' not in session:
|
||||
session['cc'] = "None"
|
||||
|
|
Loading…
Reference in a new issue