forked from Github-Mirrors/canaille
adds pre-visualization mail buttons when api request on HIBP have failed in canaille/core/templates/mails/admin.html
This commit is contained in:
parent
2a57a05155
commit
ae9c1309b9
3 changed files with 59 additions and 1 deletions
|
@ -286,3 +286,47 @@ def registration_txt(user, email):
|
|||
site_url=base_url,
|
||||
registration_url=registration_url,
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/mail/compromised_password_check_failure.html")
|
||||
@permissions_needed("manage_oidc")
|
||||
def compromised_password_check_failure_html(user):
|
||||
base_url = url_for("core.account.index", _external=True)
|
||||
user_name = "<USER NAME>"
|
||||
check_password_url = "<URL TO CHECK PASSWORD>"
|
||||
hashed_password = "<HASHED PASSWORD>"
|
||||
user_email = "<USER EMAIL>"
|
||||
|
||||
return render_template(
|
||||
"mails/compromised_password_check_failure.html",
|
||||
site_name=current_app.config["CANAILLE"]["NAME"],
|
||||
site_url=base_url,
|
||||
user_name=user_name,
|
||||
check_password_url=check_password_url,
|
||||
hashed_password=hashed_password,
|
||||
logo=current_app.config["CANAILLE"]["LOGO"],
|
||||
user_email=user_email,
|
||||
title=_("Compromised password check failure on {website_name}").format(
|
||||
website_name=current_app.config["CANAILLE"]["NAME"]
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/mail/compromised_password_check_failure.txt")
|
||||
@permissions_needed("manage_oidc")
|
||||
def compromised_password_check_failure_txt(user):
|
||||
base_url = url_for("core.account.index", _external=True)
|
||||
user_name = "<USER NAME>"
|
||||
check_password_url = "<URL TO CHECK PASSWORD>"
|
||||
hashed_password = "<HASHED PASSWORD>"
|
||||
user_email = "<USER EMAIL>"
|
||||
|
||||
return render_template(
|
||||
"mails/compromised_password_check_failure.txt",
|
||||
site_name=current_app.config["CANAILLE"]["NAME"],
|
||||
site_url=base_url,
|
||||
user_name=user_name,
|
||||
check_password_url=check_password_url,
|
||||
hashed_password=hashed_password,
|
||||
user_email=user_email,
|
||||
)
|
||||
|
|
|
@ -218,7 +218,7 @@ def send_compromised_password_check_failure_mail(
|
|||
base_url = url_for("core.account.index", _external=True)
|
||||
logo_cid, logo_filename, logo_raw = logo()
|
||||
|
||||
subject = _("compromised password check failure on {website_name}").format(
|
||||
subject = _("Compromised password check failure on {website_name}").format(
|
||||
website_name=current_app.config["CANAILLE"]["NAME"]
|
||||
)
|
||||
text_body = render_template(
|
||||
|
|
|
@ -134,6 +134,20 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="item">
|
||||
<div class="right floated content">
|
||||
<div class="ui buttons">
|
||||
<a class="ui button primary" href="{{ url_for("core.admin.compromised_password_check_failure_txt") }}">TXT</a>
|
||||
<a class="ui button primary" href="{{ url_for("core.admin.compromised_password_check_failure_html") }}">HTML</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="middle aligned content">
|
||||
{{ _("Compromised password check failure") }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue