web-base/Core/Templates/account/confirm_email.twig

41 lines
1.7 KiB
Twig

{% extends "account/account_base.twig" %}
{% set view_title = 'account.confirm_email_title' %}
{% set view_icon = 'user-check' %}
{% set view_description = 'account.confirm_email_description' %}
{% block view_content %}
<noscript>
<div class="alert alert-danger">{{ L('general.noscript') }}</div>
</noscript>
<div class="alert alert-info" id="confirm-status">
{{ L('account.confirming_email') }}… <i class="fas fa-spinner fa-spin"></i>
</div>
<a href='/login'>
<button class='btn btn-primary' style='position: absolute; bottom: 30px' type='button'>
{{ L("account.proceed_to_login") }}
</button>
</a>
<script nonce="{{ site.csp.nonce }}">
$(document).ready(function() {
let token = jsCore.getParameter("token");
let confirmStatus = $("#confirm-status");
if (token) {
jsCore.apiCall("/user/confirmEmail", { token: token }, (res) => {
confirmStatus.removeClass("alert-info");
if (!res.success) {
confirmStatus.addClass("alert-danger");
confirmStatus.text("{{ L('account.confirm_error') }}: " + res.msg);
} else {
confirmStatus.addClass("alert-success");
confirmStatus.text("{{ L('account.confirm_success') }}");
}
});
} else {
confirmStatus.removeClass("alert-info");
confirmStatus.addClass("alert-danger");
confirmStatus.text("{{ L('account.invalid_link') }}");
}
});
</script>
{% endblock %}