WILDCARD_SENDERS can have spaces

master
Florent Daigniere 3 years ago
parent facc4b6427
commit 7252a73e11

@ -133,11 +133,10 @@ def postfix_sender_map(sender):
@internal.route("/postfix/sender/login/<path:sender>")
def postfix_sender_login(sender):
has_wildcard_senders = bool(flask.current_app.config["WILDCARD_SENDERS"])
wildcard_senders = flask.current_app.config["WILDCARD_SENDERS"].lower().split(',') if has_wildcard_senders else []
wildcard_senders = [s for s in config.get('WILDCARD_SENDERS', '').lower().replace(' ', '').split(',') if s]
localpart, domain_name = models.Email.resolve_domain(sender)
if localpart is None:
return flask.jsonify(",".join(wildcard_senders)) if has_wildcard_senders else flask.abort(404)
return flask.jsonify(",".join(wildcard_senders)) if wildcard_senders else flask.abort(404)
destination = models.Email.resolve_destination(localpart, domain_name, True)
destination = [*destination, *wildcard_senders] if destination else [*wildcard_senders]
return flask.jsonify(",".join(destination)) if destination else flask.abort(404)

Loading…
Cancel
Save