{% extends 'decoupe/decoupe.html.twig' %}
{% block body_css %}bg-gradient-danger{% endblock %}
{% block content_full %}
<div class="">
<div class="container">
<div class="row justify-content-center">
<div class="col-xl-10 col-lg-12 col-md-9">
<div class="card o-hidden border-0 shadow-lg my-5">
<div class="card-body p-0">
<div class="row">
<div class="col-lg-6 d-none d-lg-block bg-login-image"></div>
<div class="col-lg-6">
<div class="p-5">
<div class="text-center">
<h1 class="h4 mb-4 text-danger font-weight-bold">
<i class="fas fa-laugh-wink"></i>
Opaie V<sup>2</sup>
</h1>
</div>
<form action="{{ path('getInvitation') }}" id="formInvitation" method="post" class="user">
<div class="form-group">
<input name="emailGetPassword" type="text" class="form-control form-control-user" id="emailGetPassword" aria-describedby="emailHelp" placeholder="Adresse mail" required>
</div>
<button type="submit" id="btn-get-invitation" class="btn btn-primary btn-user btn-block">
<i class="fa fa-envelope"></i>
Recevoir l'invitation
</button>
</form>
<hr>
<div class="text-center">
<a class="" href="{{ path('security_login') }}">Se connecter</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block addjs %}
<script>
$(document).ready(function(){
let pgb = $("#progressBar");
let formPassword = $("#formInvitation");
let btnGetPassword = $("#btn-get-invitation");
let email = $("#emailGetPassword");
formPassword.submit(function(){
event.preventDefault();
if (email.val() === null || email.val() === ''){
email.addClass('is-invalid');
swal({title: 'Email vide', icon: 'warning', text: 'Entrez votre adresse mail'});
} else {
email.removeClass('is-invalid');
getPassword();
}
});
btnGetPassword.submit(function(){
event.preventDefault();
if (email.val() === null || email.val() === ''){
email.addClass('is-invalid');
swal({title: 'Email vide', icon: 'warning', text: 'Entrez votre adresse mail'});
} else {
email.removeClass('is-invalid');
getPassword();
}
});
let getPassword = function () {
pgb.removeClass('nodisplay');
requestPost('{{ path('getInvitation') }}', JSON.stringify({ 'email': email.val() })).then((res) => {
swal({title: 'Lien envoyé!', icon: 'success', text: 'Consultez vos mails, nous vous avons envoyé un lien. Merci.'});
});
};
});
</script>
{% endblock %}