You've already forked Mailu
mirror of
https://github.com/Mailu/Mailu.git
synced 2025-08-10 22:31:47 +02:00
Resolve HOST_WEBMAIL in admin
This commit is contained in:
@@ -46,6 +46,7 @@ DEFAULT_CONFIG = {
|
||||
'WEBSITE': 'https://mailu.io',
|
||||
'WEB_ADMIN': '/admin',
|
||||
'WEB_WEBMAIL': '/webmail',
|
||||
'WEBMAIL': 'none',
|
||||
'RECAPTCHA_PUBLIC_KEY': '',
|
||||
'RECAPTCHA_PRIVATE_KEY': '',
|
||||
# Advanced settings
|
||||
@@ -79,6 +80,8 @@ class ConfigManager(dict):
|
||||
self.config['HOST_POP3'] = resolve(self.config['HOST_POP3'])
|
||||
self.config['HOST_AUTHSMTP'] = resolve(self.config['HOST_AUTHSMTP'])
|
||||
self.config['HOST_SMTP'] = resolve(self.config['HOST_SMTP'])
|
||||
if self.config["WEBMAIL"] != "none":
|
||||
self.config["HOST_WEBMAIL"] = resolve(self.config['HOST_WEBMAIL'])
|
||||
|
||||
def __coerce_value(self, value):
|
||||
if isinstance(value, str) and value.lower() in ('true','yes'):
|
||||
|
@@ -1,6 +1,7 @@
|
||||
from flask_limiter import RateLimitExceeded
|
||||
|
||||
from mailu import utils
|
||||
from flask import current_app as app
|
||||
|
||||
import socket
|
||||
import flask
|
||||
@@ -23,7 +24,7 @@ def rate_limit_handler(e):
|
||||
def whitelist_webmail():
|
||||
try:
|
||||
return flask.request.headers["Client-Ip"] ==\
|
||||
socket.gethostbyname("webmail")
|
||||
app.config["HOST_WEBMAIL"]
|
||||
except:
|
||||
return False
|
||||
|
||||
|
Reference in New Issue
Block a user