From 91970cb413b5a364503117bb8f9cc1fbbb04f18f Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Thu, 12 Dec 2024 16:52:30 +0100 Subject: [PATCH] Fix error --- app/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 7d0da22a..b7d14061 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1170,7 +1170,8 @@ def write_creds(): # Get project_id to save it to de DB utils.get_project_ids([creds]) # delete cached credentials - del session['creds'] + if 'creds' in session: + del session['creds'] cred.write_creds(creds["id"], get_cred_id(), creds, cred_id in [None, '']) if val_res == 0: flash("Credentials successfully written!", 'success') @@ -1188,7 +1189,8 @@ def delete_creds(): cred_id = request.args.get('cred_id', "") try: # delete cached credentials - del session['creds'] + if 'creds' in session: + del session['creds'] cred.delete_cred(cred_id, get_cred_id()) flash("Credentials successfully deleted!", 'success') except Exception as ex: @@ -1207,7 +1209,8 @@ def enable_creds(): if val_res == 2: flash(val_msg, 'warning') # delete cached credentials - del session['creds'] + if 'creds' in session: + del session['creds'] cred.enable_cred(cred_id, get_cred_id(), enable) except Exception as ex: flash("Error updating credentials %s!" % ex, 'error')