removed some whitespace

master
Alexander Graf 3 years ago
parent 6b16756d92
commit 3141ffe791

@ -70,3 +70,4 @@ def create_app():
""" """
config = configuration.ConfigManager() config = configuration.ConfigManager()
return create_app_from_config(config) return create_app_from_config(config)

@ -8,4 +8,4 @@
{{ macros.form_fields( fields, label=False, class="btn btn-default", spacing=False) }} {{ macros.form_fields( fields, label=False, class="btn btn-default", spacing=False) }}
</form> </form>
{%- endcall %} {%- endcall %}
{%- endblock %} {%- endblock %}

@ -1,7 +1,7 @@
<div class="sidebar text-sm"> <div class="sidebar text-sm">
<nav class="mt-2"> <nav class="mt-2">
<ul class="nav nav-pills nav-sidebar flex-column" role="menu"> <ul class="nav nav-pills nav-sidebar flex-column" role="menu">
<li class="nav-header text-uppercase text-primary" role="none">{% trans %}Go to{% endtrans %}</li> <li class="nav-header text-uppercase text-primary" role="none">{% trans %}Go to{% endtrans %}</li>
{% if config['ADMIN'] %} {% if config['ADMIN'] %}
<li class="nav-item"> <li class="nav-item">
<a href="{{ url_for('ui.client') }}" class="nav-link"> <a href="{{ url_for('ui.client') }}" class="nav-link">
@ -21,12 +21,12 @@
<i class="nav-icon fa fa-life-ring"></i> <i class="nav-icon fa fa-life-ring"></i>
<p class="text">{% trans %}Help{% endtrans %}</p> <p class="text">{% trans %}Help{% endtrans %}</p>
</a> </a>
</li> </li>
{# {#
Domain self-registration is only available when Domain self-registration is only available when
- Admin is available - Admin is available
- Domain Self-registration is enabled - Domain Self-registration is enabled
- The current user is not logged on - The current user is not logged on
#} #}
{% if config['DOMAIN_REGISTRATION'] %} {% if config['DOMAIN_REGISTRATION'] %}
{% if not current_user.is_authenticated %} {% if not current_user.is_authenticated %}
@ -44,7 +44,7 @@
User self-registration is only available when User self-registration is only available when
- Admin is available - Admin is available
- Self-registration is enabled - Self-registration is enabled
- The current user is not logged on - The current user is not logged on
#} #}
{% if not current_user.is_authenticated %} {% if not current_user.is_authenticated %}
{% if signup_domains %} {% if signup_domains %}
@ -57,7 +57,7 @@
</li> </li>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}
</ul> </ul>
</nav> </nav>
</div> </div>

@ -13,7 +13,7 @@ def login():
form = forms.LoginForm() form = forms.LoginForm()
form.submitAdmin.label.text = form.submitAdmin.label.text + ' Admin' form.submitAdmin.label.text = form.submitAdmin.label.text + ' Admin'
form.submitWebmail.label.text = form.submitWebmail.label.text + ' Webmail' form.submitWebmail.label.text = form.submitWebmail.label.text + ' Webmail'
fields = [] fields = []
if str(app.config["ADMIN"]).upper() != "FALSE": if str(app.config["ADMIN"]).upper() != "FALSE":
fields.append(form.submitAdmin) fields.append(form.submitAdmin)
@ -36,7 +36,7 @@ def login():
user = models.User.login(username, form.pw.data) user = models.User.login(username, form.pw.data)
if user: if user:
flask.session.regenerate() flask.session.regenerate()
flask_login.login_user(user) flask_login.login_user(user)
response = flask.redirect(destination) response = flask.redirect(destination)
response.set_cookie('rate_limit', utils.limiter.device_cookie(username), max_age=31536000, path=flask.url_for('sso.login')) response.set_cookie('rate_limit', utils.limiter.device_cookie(username), max_age=31536000, path=flask.url_for('sso.login'))
flask.current_app.logger.info(f'Login succeeded for {username} from {client_ip}.') flask.current_app.logger.info(f'Login succeeded for {username} from {client_ip}.')
@ -46,10 +46,11 @@ def login():
flask.current_app.logger.warn(f'Login failed for {username} from {client_ip}.') flask.current_app.logger.warn(f'Login failed for {username} from {client_ip}.')
flask.flash('Wrong e-mail or password', 'error') flask.flash('Wrong e-mail or password', 'error')
return flask.render_template('login.html', form=form, fields=fields) return flask.render_template('login.html', form=form, fields=fields)
@sso.route('/logout', methods=['GET']) @sso.route('/logout', methods=['GET'])
@access.authenticated @access.authenticated
def logout(): def logout():
flask_login.logout_user() flask_login.logout_user()
flask.session.destroy() flask.session.destroy()
return flask.redirect(flask.url_for('.login')) return flask.redirect(flask.url_for('.login'))

@ -103,7 +103,7 @@ class PrefixMiddleware(object):
self.app = None self.app = None
def __call__(self, environ, start_response): def __call__(self, environ, start_response):
return self.app(environ, start_response) return self.app(environ, start_response)
def init_app(self, app): def init_app(self, app):
self.app = fixers.ProxyFix(app.wsgi_app, x_for=1, x_proto=1) self.app = fixers.ProxyFix(app.wsgi_app, x_for=1, x_proto=1)

@ -1,4 +1,4 @@
# Basic configuration # Basic configuration
user nginx; user nginx;
worker_processes auto; worker_processes auto;
error_log /dev/stderr info; error_log /dev/stderr info;
@ -6,7 +6,7 @@ pid /var/run/nginx.pid;
load_module "modules/ngx_mail_module.so"; load_module "modules/ngx_mail_module.so";
events { events {
worker_connections 1024; worker_connections 1024;
} }
http { http {
@ -15,7 +15,7 @@ http {
default_type application/octet-stream; default_type application/octet-stream;
access_log /dev/stdout; access_log /dev/stdout;
sendfile on; sendfile on;
keepalive_timeout 65; keepalive_timeout 65;
server_tokens off; server_tokens off;
absolute_redirect off; absolute_redirect off;
resolver {{ RESOLVER }} ipv6=off valid=30s; resolver {{ RESOLVER }} ipv6=off valid=30s;
@ -47,12 +47,12 @@ http {
{% if KUBERNETES_INGRESS != 'true' and TLS_FLAVOR in [ 'letsencrypt', 'cert' ] %} {% if KUBERNETES_INGRESS != 'true' and TLS_FLAVOR in [ 'letsencrypt', 'cert' ] %}
# Enable the proxy for certbot if the flavor is letsencrypt and not on kubernetes # Enable the proxy for certbot if the flavor is letsencrypt and not on kubernetes
# #
server { server {
# Listen over HTTP # Listen over HTTP
listen 80; listen 80;
listen [::]:80; listen [::]:80;
{% if TLS_FLAVOR == 'letsencrypt' %} {% if TLS_FLAVOR == 'letsencrypt' %}
location ^~ /.well-known/acme-challenge/ { location ^~ /.well-known/acme-challenge/ {
proxy_pass http://127.0.0.1:8008; proxy_pass http://127.0.0.1:8008;
} }
@ -80,7 +80,7 @@ http {
{% endif %} {% endif %}
# Listen on HTTP only in kubernetes or behind reverse proxy # Listen on HTTP only in kubernetes or behind reverse proxy
{% if KUBERNETES_INGRESS == 'true' or TLS_FLAVOR in [ 'mail-letsencrypt', 'notls', 'mail' ] %} {% if KUBERNETES_INGRESS == 'true' or TLS_FLAVOR in [ 'mail-letsencrypt', 'notls', 'mail' ] %}
listen 80; listen 80;
listen [::]:80; listen [::]:80;
{% endif %} {% endif %}
@ -153,8 +153,8 @@ http {
rewrite ^{{ WEB_WEBMAIL }}/(.*) /$1 break; rewrite ^{{ WEB_WEBMAIL }}/(.*) /$1 break;
{% endif %} {% endif %}
include /etc/nginx/proxy.conf; include /etc/nginx/proxy.conf;
client_max_body_size {{ MESSAGE_SIZE_LIMIT|int + 8388608 }}; client_max_body_size {{ MESSAGE_SIZE_LIMIT|int + 8388608 }};
auth_request /internal/auth/user; auth_request /internal/auth/user;
error_page 403 @webmail_login; error_page 403 @webmail_login;
proxy_pass http://$webmail; proxy_pass http://$webmail;
} }
@ -177,7 +177,7 @@ http {
location @webmail_login { location @webmail_login {
return 302 /sso/login; return 302 /sso/login;
} }
{% endif %} {% endif %}
{% if ADMIN == 'true' %} {% if ADMIN == 'true' %}
location {{ WEB_ADMIN }} { location {{ WEB_ADMIN }} {
@ -186,7 +186,7 @@ http {
expires $expires; expires $expires;
} }
location {{ WEB_ADMIN }}/antispam { location {{ WEB_ADMIN }}/antispam {
rewrite ^{{ WEB_ADMIN }}/antispam/(.*) /$1 break; rewrite ^{{ WEB_ADMIN }}/antispam/(.*) /$1 break;
auth_request /internal/auth/admin; auth_request /internal/auth/admin;
proxy_set_header X-Real-IP ""; proxy_set_header X-Real-IP "";

Loading…
Cancel
Save