As suggested by ghost

main
Florent Daigniere 2 years ago
parent c1144612be
commit 19bd9362d3

@ -143,11 +143,11 @@ def postfix_sender_login(sender):
if localpart is None: if localpart is None:
return flask.jsonify(",".join(wildcard_senders)) if wildcard_senders else flask.abort(404) return flask.jsonify(",".join(wildcard_senders)) if wildcard_senders else flask.abort(404)
localpart = localpart[:next((i for i, ch in enumerate(localpart) if ch in flask.current_app.config.get('RECIPIENT_DELIMITER')), None)] localpart = localpart[:next((i for i, ch in enumerate(localpart) if ch in flask.current_app.config.get('RECIPIENT_DELIMITER')), None)]
destinations = models.Email.resolve_destination(localpart, domain_name, True) or [] destinations = set(models.Email.resolve_destination(localpart, domain_name, True) or [])
destinations.extend(wildcard_senders) destinations.update(wildcard_senders)
destinations.extend(i[0] for i in models.User.query.filter_by(allow_spoofing=True).with_entities(models.User.email).all()) destinations.update(i[0] for i in models.User.query.filter_by(allow_spoofing=True).with_entities(models.User.email).all())
if destinations: if destinations:
return flask.jsonify(",".join(idna_encode(list(set(destinations))))) return flask.jsonify(",".join(idna_encode(destinations)))
return flask.abort(404) return flask.abort(404)
@internal.route("/postfix/sender/rate/<path:sender>") @internal.route("/postfix/sender/rate/<path:sender>")

Loading…
Cancel
Save