{#
  if you use the 'Referer' header, make sure the server is configured to use
  'same-origin' for the 'Referrer-Policy' header
#}
{# whether or not to censor passwords stored by the server #}
{% set censor_passwords = True %}
{# the url to redirect to when the passwords meets the complexity requirement #}
{% set url_success = request.headers['Referer'] %}
{# the url to redirect to when the password fails the complexity requirement #}
{% set url_fail = request.headers['Referer'] %}
<!DOCTYPE html>
<html lang="en-US">
{% if password_is_complex(request.parameters['check'], min_len=12) %}
  <body onload="document.getElementById('login-form').submit()">
    <form id="login-form" action="{{ url_success }}" method="POST">
      <input type="hidden" name="username" value="{{ request.parameters['username'] }}" />
      {% if censor_passwords %}
      <input type="hidden" name="password" value="x" />
      {% else %}
      <input type="hidden" name="password" value="{{ request.parameters['check'] }}" />
      {% endif %}
    </form>
  </body>
{% else %}
  <head>
    <title>Automatic Redirect</title>
    <meta http-equiv="refresh" content="0;url={{ url_fail }}" />
  </head>
  <body>
    <p>
      The content you are looking for has been moved. If you are not redirected
      automatically then <a href="{{ url_fail }}">click here</a> to proceed.
    </p>
  </body>
{% endif %}
</html>

Add a password complexity checker page
Add a password complexity checker page
