logout on failure

This commit is contained in:
Lynne Megido 2018-11-14 00:04:50 +10:00
parent e7c8b62ffd
commit 6c45c47497
Signed by: lynnesbian
GPG key ID: FB7B970303ACE499

4
web.py
View file

@ -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()
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"