1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-14 10:53:30 +02:00

Make logic more readable.

This commit is contained in:
Dimitri Huisman 2021-10-27 08:22:36 +00:00
parent 48764f0400
commit a47afec4ee

View File

@ -11,28 +11,13 @@ 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")]
form.target.choices = []
if str(app.config["ADMIN"]).upper() != "FALSE":
form.target.choices += [("Admin", "Admin")]
if str(app.config["WEBMAIL"]).upper() != "NONE":
form.target.choices += [("Webmail", "Webmail")]
if endpoint == "ui.webmail":
form.target.choices.reverse()
if form.validate_on_submit():
if str(form.target.data) == 'Admin':