templates/registration/register.html.twig line 1

Open in your IDE?
  1. {% extends 'layout_web.html.twig' %}
  2. {% block title %}{{ 'register.title'|trans }}
  3.     |
  4.     {{parent()}}
  5. {% endblock %}
  6. {% block body %}
  7.     <div class="page">
  8.         <div class="page-single">
  9.             <div class="container">
  10.                 <div class="row">
  11.                     <div class="col col-md-5 mx-auto">
  12.                         <div class="text-center mb-6">
  13.                             <img src="{{ asset('/images/logo-pbn-200x100.png')}}" alt="{{appname}}">  
  14.                         </div>
  15.                         {% for flashError in app.flashes('verify_email_error') %}
  16.                             <div class="alert alert-danger" role="alert">{{ flashError }}</div>
  17.                         {% endfor %}
  18.                         {{ form_start(registrationForm,{ 'attr': {'class': 'card'} }) }}
  19.                         <div class="card-body p-6">
  20.                             <div class="float-right">
  21.                                 <a
  22.                                     href="{{ path(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale': ''})) }}">
  23.                                     <span class="flag flag-fr mr-3"></span></a>
  24.                                 <a
  25.                                     href="{{ path(app.request.get('_route'), app.request.get('_route_params')|merge({'_locale': 'en'})) }}">
  26.                                     <span class="flag flag-gb"></span></a>
  27.                             </div>
  28.                             <div class="card-title">{{ 'register.title'|trans }}</div>
  29.                             <div class="form-group">
  30.                                 {{ form_label(registrationForm.email, 'register.email', { 'label_attr': {'class': 'form-label'} }) }}
  31.                                 {{ form_widget(registrationForm.email,{ 'attr': {'class': form_errors(registrationForm.email) == null ? 'form-control' : 'form-control is-invalid'} }) }}
  32.                                 <div class="form-error invalid-feedback">
  33.                                     {{ form_errors(registrationForm.email) }}
  34.                                 </div>
  35.                             </div>
  36.                             <div class="form-group">
  37.                                 {{ form_label(registrationForm.plainPassword, 'register.password', { 'label_attr': {'class': 'form-label'} }) }}
  38.                                 {{ form_widget(registrationForm.plainPassword,{ 'attr': {'class': form_errors(registrationForm.plainPassword) == null ? 'form-control' : 'form-control is-invalid'} }) }}
  39.                                 <i class="fe fe-eye-off" id="togglePassword"></i>
  40.                                 <div class="form-error invalid-feedback">
  41.                                     {{ form_errors(registrationForm.plainPassword) }}
  42.                                 </div>
  43.                             </div>
  44.                             <div class="row">
  45.                                 <div class="col-md-6">
  46.                                     <div class="form-group">
  47.                                         {{ form_label(registrationForm.firstname, 'user.firstname', { 'label_attr': {'class': 'form-label'} }) }}
  48.                                         {{ form_widget(registrationForm.firstname,{ 'attr': {'class': form_errors(registrationForm.firstname) == null ? 'form-control' : 'form-control is-invalid'} }) }}
  49.                                         <div class="form-error invalid-feedback">
  50.                                             {{ form_errors(registrationForm.firstname) }}
  51.                                         </div>
  52.                                     </div>
  53.                                 </div>
  54.                                 <div class="col-md-6">
  55.                                     <div class="form-group">
  56.                                         {{ form_label(registrationForm.lastname, 'user.lastname', { 'label_attr': {'class': 'form-label'} }) }}
  57.                                         {{ form_widget(registrationForm.lastname,{ 'attr': {'class': form_errors(registrationForm.lastname) == null ? 'form-control' : 'form-control is-invalid'} }) }}
  58.                                         <div class="form-error invalid-feedback">
  59.                                             {{ form_errors(registrationForm.lastname) }}
  60.                                         </div>
  61.                                     </div>
  62.                                 </div>
  63.                             </div>
  64.                             <div class="form-group">
  65.                                 {{ form_label(registrationForm.company, 'user.company', { 'label_attr': {'class': 'form-label'} }) }}
  66.                                 {{ form_widget(registrationForm.company,{ 'attr': {'class': form_errors(registrationForm.company) == null ? 'form-control' : 'form-control is-invalid'} }) }}
  67.                                 <div class="form-error invalid-feedback">
  68.                                     {{ form_errors(registrationForm.company) }}
  69.                                 </div>
  70.                             </div>
  71.                             <button class="btn btn-primary btn-block">{{ 'register.title'|trans }}</button>
  72.                         </div>
  73.                         {{ form_end(registrationForm) }}
  74.                     </div>
  75.                 </div>
  76.             </div>
  77.         </div>
  78.     </div>
  79. <style>
  80.     #togglePassword {
  81.     position: absolute;
  82.     right: 1.5em;
  83.     cursor: pointer;
  84.     margin-right: 25px;
  85.     margin-top: -27px;
  86. }
  87. </style>
  88. <script>
  89.         const togglePassword = document.querySelector("#togglePassword");
  90.         const password = document.querySelector("#registration_form_plainPassword");
  91.         togglePassword.addEventListener("click", function () {
  92.             // toggle the type attribute
  93.             const type = password.getAttribute("type") === "password" ? "text" : "password";
  94.             password.setAttribute("type", type);            
  95.             // toggle the icon
  96.             if (type == "text") {
  97.             this.classList.remove("fe-eye-off");
  98.             this.classList.add("fe-eye");
  99.             }
  100.             if (type == "password") {
  101.             this.classList.remove("fe-eye");
  102.             this.classList.add("fe-eye-off");
  103.             }
  104.         });
  105. </script>
  106. {% endblock %}