Skip to content

Instantly share code, notes, and snippets.

@COil
Created November 4, 2018 09:53
Show Gist options
  • Save COil/5351f5c04df61503a025a0ac7cc54388 to your computer and use it in GitHub Desktop.
Save COil/5351f5c04df61503a025a0ac7cc54388 to your computer and use it in GitHub Desktop.
Example of Twig template for the 429 error code (HTTP_TOO_MANY_REQUESTS)
{# templates/bundles/TwigBundle/Exception/error429.html.twig #}
{% extends 'layout.html.twig' %}
{% block meta_title %}Error {{ status_code }}, too many login attempts{% endblock meta_title %}
{% block body %}
<h1>Security warning</h1>
<h2>Too many login attempts</h2>
<p>
Too many failed login attempts detected. Your tried to login {{ constant('App\\Subscriber\\PostFail2BanSubscriber::MAX_LOGIN_FAILURE_ATTEMPTS') }}
times without success. You will <b>NOT</b> be able to login during <b>{{ constant('App\\Subscriber\\Fail2BanSubscriber::FAIL_TTL_HOUR') }}</b> hour(s) since now.
If you think it's a bug please contact us.
</p>
<p class="text-center">
<b>If you have lost your password please use the following form:</b><br/><br/>
<a href="{# path('user_resetting_request_'~locale) #}" type="button" class="btn btn-primary btn-lg">
<span>Request a new password</span>
</a>
</p>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment