From 615743b331c4759c58ffc9856c1aa9200adfabec Mon Sep 17 00:00:00 2001 From: Dimitri Huisman Date: Tue, 26 Oct 2021 11:39:56 +0000 Subject: [PATCH] Improve indendation of conditions. --- core/admin/mailu/sso/views/base.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/core/admin/mailu/sso/views/base.py b/core/admin/mailu/sso/views/base.py index cb86e1ab..067ea809 100644 --- a/core/admin/mailu/sso/views/base.py +++ b/core/admin/mailu/sso/views/base.py @@ -11,14 +11,28 @@ def login(): form = forms.LoginForm() endpoint = flask.request.args.get('next', 'ui.index') - if str(app.config['WEBMAIL']).upper() != 'NONE' and str(app.config['ADMIN']).upper() != 'FALSE' and endpoint != 'ui.webmail': - form.target.choices = [('Admin', 'Admin'), ('Webmail', 'Webmail')] - elif str(app.config['WEBMAIL']).upper() != 'NONE' and str(app.config['ADMIN']).upper() != 'FALSE' and endpoint == 'ui.webmail': - form.target.choices = [('Webmail', 'Webmail'), ('Admin', 'Admin')] - elif str(app.config['WEBMAIL']).upper() != 'NONE' and str(app.config['ADMIN']).upper() == 'FALSE': - form.target.choices = [('Webmail', 'Webmail')] - elif str(app.config['WEBMAIL']).upper() == 'NONE' and str(app.config['ADMIN']).upper() != 'FALSE': - form.target.choices = [('Admin', 'Admin')] + if ( + str(app.config["WEBMAIL"]).upper() != "NONE" + and str(app.config["ADMIN"]).upper() != "FALSE" + and endpoint != "ui.webmail" + ): + form.target.choices = [("Admin", "Admin"), ("Webmail", "Webmail")] + elif ( + str(app.config["WEBMAIL"]).upper() != "NONE" + and str(app.config["ADMIN"]).upper() != "FALSE" + and endpoint == "ui.webmail" + ): + form.target.choices = [("Webmail", "Webmail"), ("Admin", "Admin")] + elif ( + str(app.config["WEBMAIL"]).upper() != "NONE" + and str(app.config["ADMIN"]).upper() == "FALSE" + ): + form.target.choices = [("Webmail", "Webmail")] + elif ( + str(app.config["WEBMAIL"]).upper() == "NONE" + and str(app.config["ADMIN"]).upper() != "FALSE" + ): + form.target.choices = [("Admin", "Admin")] if form.validate_on_submit(): if str(form.target.data) == 'Admin':