Process code review remarks PR2023

master
Dimitri Huisman 3 years ago
parent 8784971b7f
commit 3449b67c86

@ -1,5 +1,5 @@
from flask import Blueprint
sso = Blueprint('sso', __name__, static_folder='None' ,template_folder='templates')
sso = Blueprint('sso', __name__, static_folder=None ,template_folder='templates')
from mailu.sso.views import *

@ -1,12 +1,6 @@
from wtforms import validators, fields, widgets
from wtforms_components import fields as fields_
from wtforms import validators, fields
from flask_babel import lazy_gettext as _
import flask_login
import flask_wtf
import re
LOCALPART_REGEX = "^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*$"
class LoginForm(flask_wtf.FlaskForm):
class Meta:
@ -15,5 +9,3 @@ class LoginForm(flask_wtf.FlaskForm):
pw = fields.PasswordField(_('Password'), [validators.DataRequired()])
submitAdmin = fields.SubmitField(_('Sign in'))
submitWebmail = fields.SubmitField(_('Sign in'))

@ -2,14 +2,6 @@
<nav class="mt-2">
<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>
{%- if config["WEBMAIL"] != "none" %}
<li class="nav-item" role="none">
<a href="{{ config["WEB_WEBMAIL"] }}" target="_blank" class="nav-link" role="menuitem">
<i class="nav-icon far fa-envelope"></i>
<p>{% trans %}Webmail{% endtrans %} <i class="fas fa-external-link-alt text-xs"></i></p>
</a>
</li>
{% endif %}
{% if config['ADMIN'] %}
<li class="nav-item">
<a href="{{ url_for('ui.client') }}" class="nav-link">
@ -24,8 +16,8 @@
<p>{% trans %}Website{% endtrans %} <i class="fas fa-external-link-alt text-xs"></i></p>
</a>
</li>
<li class="nav-item">
<a href="https://mailu.io" target="_blank" class="nav-link">
<li class="nav-item" role="none">
<a href="https://mailu.io" target="_blank" class="nav-link" role="menuitem">
<i class="nav-icon fa fa-life-ring"></i>
<p class="text">{% trans %}Help{% endtrans %}</p>
</a>
@ -39,8 +31,8 @@
{% if config['DOMAIN_REGISTRATION'] %}
{% if not current_user.is_authenticated %}
{% if config['ADMIN'] %}
<li class="nav-item">
<a href="{{ url_for('ui.domain_signup') }}" class="nav-link">
<li class="nav-item" role="none">
<a href="{{ url_for('ui.domain_signup') }}" class="nav-link" role="menuitem">
<i class="nav-icon fa fa-plus-square"></i>
<p class="text">{% trans %}Register a domain{% endtrans %}</p>
</a>
@ -57,8 +49,8 @@
{% if not current_user.is_authenticated %}
{% if signup_domains %}
{% if config['ADMIN'] %}
<li class="nav-item">
<a href="{{ url_for('ui.user_signup') }}" class="nav-link">
<li class="nav-item" role="none">
<a href="{{ url_for('ui.user_signup') }}" class="nav-link" role="menuitem">
<i class="nav-icon fa fa-user-plus"></i>
<p class="text">{% trans %}Sign up{% endtrans %}</p>
</a>

@ -1,6 +1,4 @@
from mailu.sso import sso, forms
from mailu.ui import access
from mailu.sso import sso
import flask
@sso.route('/language/<language>', methods=['POST'])

@ -1,6 +1,6 @@
from flask import Blueprint
ui = Blueprint('ui', __name__, static_folder='None', template_folder='templates')
ui = Blueprint('ui', __name__, static_folder=None, template_folder='templates')
from mailu.ui.views import *

@ -92,7 +92,7 @@
{%- endif %}
<li class="nav-header text-uppercase text-primary" role="none">{% trans %}Go to{% endtrans %}</li>
{%- if config["WEBMAIL"] != "none" %}
{%- if config["WEBMAIL"] != "none" and current_user.is_authenticated %}
<li class="nav-item" role="none">
<a href="{{ config["WEB_WEBMAIL"] }}" target="_blank" class="nav-link" role="menuitem">
<i class="nav-icon far fa-envelope"></i>
@ -136,8 +136,8 @@
</a>
</li>
{% else %}
<li class="nav-item">
<a href="{{ url_for('sso.login') }}" class="nav-link">
<li class="nav-item" role="none">
<a href="{{ url_for('sso.login') }}" class="nav-link" role="menuitem">
<i class="nav-icon fas fa-sign-in-alt"></i>
<p>{% trans %}Sign in{% endtrans %}</p>
</a>

@ -113,7 +113,7 @@ http {
add_header X-XSS-Protection '1; mode=block';
add_header Referrer-Policy 'same-origin';
{% if TLS_FLAVOR == 'mail-letsencrypt' %}
{% if TLS_FLAVOR == 'mail-letsencrypt' %}
location ^~ /.well-known/acme-challenge/ {
proxy_pass http://127.0.0.1:8008;
}
@ -175,15 +175,13 @@ http {
proxy_pass http://$webmail;
}
location @webmail_login {
location @webmail_login {
return 302 /sso/login;
}
{% else %}
}
{% endif %}
{% if ADMIN == 'true' %}
location {{ WEB_ADMIN }} {
include /etc/nginx/proxy.conf;
include /etc/nginx/proxy.conf;
proxy_pass http://$admin;
expires $expires;
}

@ -54,30 +54,11 @@ Because the admin interface is served as ``/admin``, the Webmail as ``/webmail``
server {
# [...] here goes your standard configuration
location /webmail {
proxy_pass https://localhost:8443/webmail;
}
location /admin {
proxy_pass https://localhost:8443/admin;
location ~ ^/(admin|sso|static|webdav|webmail)/ {
proxy_pass https://localhost:8443;
proxy_set_header Host $http_host;
}
location /sso {
proxy_pass https://localhost:8443/sso;
proxy_set_header Host $http_host;
}
location /webdav {
proxy_pass https://localhost:8443/webdav;
proxy_set_header Host $http_host;
}
location /static {
proxy_pass https://localhost:8443/static;
proxy_set_header Host $http_host;
}
location /main_app {
proxy_pass https://some-host;
}

Loading…
Cancel
Save