Merge branch 'fix-sso-1929' of github.com:Diman0/Mailu into fix-sso-1929

master
Dimitri Huisman 3 years ago
commit da788ddee3

@ -11,7 +11,7 @@ import hmac
def create_app_from_config(config): def create_app_from_config(config):
""" Create a new application based on the given configuration """ Create a new application based on the given configuration
""" """
app = flask.Flask(__name__) app = flask.Flask(__name__, static_folder='static_files', static_url_path='')
app.cli.add_command(manage.mailu) app.cli.add_command(manage.mailu)
# Bootstrap is used for error display and flash messages # Bootstrap is used for error display and flash messages
@ -62,7 +62,6 @@ def create_app_from_config(config):
app.register_blueprint(ui.ui, url_prefix='/ui') app.register_blueprint(ui.ui, url_prefix='/ui')
app.register_blueprint(internal.internal, url_prefix='/internal') app.register_blueprint(internal.internal, url_prefix='/internal')
app.register_blueprint(sso.sso, url_prefix='/sso') app.register_blueprint(sso.sso, url_prefix='/sso')
app.register_blueprint(static_files.static, url_prefix='/static')
return app return app

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

@ -22,7 +22,7 @@ def login():
if form.validate_on_submit(): if form.validate_on_submit():
if str(form.target.data) == 'Admin': if str(form.target.data) == 'Admin':
endpoint = 'ui.index' endpoint = 'ui.user_settings'
destination = app.config['WEB_ADMIN'] destination = app.config['WEB_ADMIN']
elif str(form.target.data) == 'Webmail': elif str(form.target.data) == 'Webmail':
endpoint = 'ui.webmail' endpoint = 'ui.webmail'
@ -44,4 +44,4 @@ def login():
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'))

@ -1,5 +0,0 @@
from flask import Blueprint
static = Blueprint('static', __name__, static_folder='static', static_url_path='/static')

@ -16,7 +16,7 @@ COPY conf /conf
COPY static /static COPY static /static
COPY *.py / COPY *.py /
RUN gzip -k9 /static/*.ico /static/*.txt RUN gzip -k9 /static/*.ico /static/*.txt; chmod a+rX -R /static
EXPOSE 80/tcp 443/tcp 110/tcp 143/tcp 465/tcp 587/tcp 993/tcp 995/tcp 25/tcp 10025/tcp 10143/tcp EXPOSE 80/tcp 443/tcp 110/tcp 143/tcp 465/tcp 587/tcp 993/tcp 995/tcp 25/tcp 10025/tcp 10143/tcp
VOLUME ["/certs"] VOLUME ["/certs"]

@ -129,16 +129,10 @@ http {
# Actual logic # Actual logic
{% if ADMIN == 'true' or WEBMAIL != 'none' %} {% if ADMIN == 'true' or WEBMAIL != 'none' %}
location ^~ /sso { location ~ ^/(sso|static) {
include /etc/nginx/proxy.conf; include /etc/nginx/proxy.conf;
proxy_pass http://$admin; proxy_pass http://$admin;
} }
location ^~ /static {
include /etc/nginx/proxy.conf;
rewrite ^/static/(.*) /static/static/$1 break;
proxy_pass http://$admin;
}
{% endif %} {% endif %}
{% if WEB_WEBMAIL != '/' and WEBROOT_REDIRECT != 'none' %} {% if WEB_WEBMAIL != '/' and WEBROOT_REDIRECT != 'none' %}

Loading…
Cancel
Save