<commit_before>{% extends '@CleverAgeEAVManagerUser/base.html.twig' %}

{% block content %}
    <div class="panel panel-default" style="background-color:#ffffffe0;margin-top:30vh;transform:translateY(-30%);">
        <div class="panel-heading">
            {% block login_title %}
                <h3 class="panel-title">{{ 'login.title'|trans({'%title%': block('title')}, 'security') }}</h3>
            {% endblock %}
        </div>
        <div class="panel-body">
            <form action="{{ path('login') }}" method="post" accept-charset="UTF-8" role="form">
                <fieldset {% if error %}class="has-error"{% endif %}>
                    {% block login_form_fields %}
                        <div class="form-group">
                            <input class="form-control" placeholder="{{ 'login.username'|trans({}, 'security') }}"
                                   name="_username" type="text" value="{{ last_username }}" required="required">
                        </div>
                        <div class="form-group">
                            <input class="form-control" placeholder="{{ 'login.password'|trans({}, 'security') }}"
                                   name="_password" type="password" value="" required="required">
                        </div>
                        <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
                    {% endblock %}
                    {% block login_errors %}
                        {% if error %}
                            <div class="text-danger text-center">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
                        {% endif %}
                    {% endblock %}
                </fieldset>
                <fieldset>
                    {% block login_actions %}
                        <p class="text-right">
                            <a href="{{ path('lost_password') }}">{{ 'login.lost_password'|trans({}, 'security') }}</a>
                        </p>
                        <input class="btn btn-success btn-block" type="submit" id="_submit" name="_submit"
                               value="{{ 'login.submit'|trans({}, 'security') }}">
                    {% endblock %}
                </fieldset>
            </form>
        </div>
    </div>
{% endblock %}

{# Best practise: avoid any third-party code on login pages #}
{% block javascripts %}
    <script>
        {#
        Load random image background from unsplash (this is safe)
        set the loginSplashUrl global variable in twig to override the default pattern
        #}
        document.addEventListener("DOMContentLoaded", function () {
            var imgSrc = '{{ loginSplashUrl|default('https://source.unsplash.com/random/%width%x%height%') }}';
            var img = new Image();
            img.src = imgSrc.replace('%width%', window.innerWidth).replace('%height%', window.innerHeight);
            img.style.position = 'fixed';
            img.style.zIndex = -1000;
            img.style.transition = 'opacity 2s ease-in-out';
            img.style.opacity = 0;
            img.onload = function () {
                document.body.insertBefore(img, document.body.firstChild);
                window.setTimeout(function () {
                    img.style.opacity = 1;
                }, 0);
            }
        });
    </script>
{% endblock %}
{% block additionnal_javascript %}{% endblock %}<commit_msg>Fixing background login implementation and switching to dedicated unsplash collection<commit_after>{% extends '@CleverAgeEAVManagerUser/base.html.twig' %}

{% block content %}
    <div class="panel panel-default" style="background-color:#ffffffe0;margin-top:30vh;transform:translateY(-30%);">
        <div class="panel-heading">
            {% block login_title %}
                <h3 class="panel-title">{{ 'login.title'|trans({'%title%': block('title')}, 'security') }}</h3>
            {% endblock %}
        </div>
        <div class="panel-body">
            <form action="{{ path('login') }}" method="post" accept-charset="UTF-8" role="form">
                <fieldset {% if error %}class="has-error"{% endif %}>
                    {% block login_form_fields %}
                        <div class="form-group">
                            <input class="form-control" placeholder="{{ 'login.username'|trans({}, 'security') }}"
                                   name="_username" type="text" value="{{ last_username }}" required="required">
                        </div>
                        <div class="form-group">
                            <input class="form-control" placeholder="{{ '<PASSWORD>.password'|trans({}, 'security') }}"
                                   name="_password" type="password" value="" required="required">
                        </div>
                        <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
                    {% endblock %}
                    {% block login_errors %}
                        {% if error %}
                            <div class="text-danger text-center">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
                        {% endif %}
                    {% endblock %}
                </fieldset>
                <fieldset>
                    {% block login_actions %}
                        <p class="text-right">
                            <a href="{{ path('lost_password') }}">{{ 'login.lost_password'|trans({}, 'security') }}</a>
                        </p>
                        <input class="btn btn-success btn-block" type="submit" id="_submit" name="_submit"
                               value="{{ 'login.submit'|trans({}, 'security') }}">
                    {% endblock %}
                </fieldset>
            </form>
        </div>
    </div>
{% endblock %}

{# Best practise: avoid any third-party code on login pages #}
{% block javascripts %}
    {% set loginSplashUrl = loginSplashUrl is defined ? loginSplashUrl : 'https://source.unsplash.com/collection/2517821/%width%x%height%' %}
    {% if loginSplashUrl %}
        <script>
            {#
            Load random image background from unsplash (this is safe)
            set the loginSplashUrl global variable in twig to override the default pattern
            #}
            document.addEventListener("DOMContentLoaded", function () {
                var imgSrc = '{{ loginSplashUrl }}';
                var img = new Image();
                img.src = imgSrc.replace('%width%', window.innerWidth).replace('%height%', window.innerHeight);
                img.style.position = 'fixed';
                img.style.zIndex = -1000;
                img.style.transition = 'opacity 2s ease-in-out';
                img.style.opacity = 0;
                img.onload = function () {
                    document.body.insertBefore(img, document.body.firstChild);
                    window.setTimeout(function () {
                        img.style.opacity = 1;
                    }, 0);
                }
            });
        </script>
    {% endif %}
{% endblock %}
{% block additionnal_javascript %}{% endblock %}
{'fraction_non_alphanumeric': 0.15220424107142858, 'fraction_numerical': 0.005440848214285714, 'mean_word_length': 1.64929785661493, 'pattern_counts': {'":': 0, '<': 64, '<?xml version=': 0, '>': 64, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4370041', 'n_tokens_mistral': 1962, 'n_tokens_neox': 1765, 'n_words': 373}