{% extends "partials/base.html.twig" %}
{% block body %}
<div class="container h-100 d-flex" id="login-page">
<div class="row align-items-center g-lg-5">
<div class="col-lg-7 text-center text-lg-start">
<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 266.5 288.7" style="enable-background:new 0 0 266.5 288.7;" xml:space="preserve">
<style type="text/css">
.st0{fill:#e9eef9;}
</style>
<path class="st0" d="M180.5,280.7c-37,0-67.1-30.1-67.1-67.1V78.5h32.7v135.1c0,18.9,15.4,34.4,34.4,34.4V280.7z"/>
<path class="st0" d="M86,209.8H53.2v-79.3c0-18.9-15.4-34.4-34.4-34.4V63.4c37,0,67.1,30.1,67.1,67.1V209.8z"/>
<path class="st0" d="M213.2,210.4h-32.7V75.1c0-37,30.1-67.1,67.1-67.1v32.7c-18.9,0-34.4,15.4-34.4,34.4V210.4z"/>
<path class="st0" d="M85.1,35.6c0,9-7.3,16.4-16.4,16.4s-16.4-7.3-16.4-16.4c0-9,7.3-16.4,16.4-16.4S85.1,26.6,85.1,35.6"/>
<path class="st0" d="M258.8,119.4c0,9-7.3,16.4-16.4,16.4c-9,0-16.4-7.3-16.4-16.4c0-9,7.3-16.4,16.4-16.4
C251.5,103.1,258.8,110.4,258.8,119.4"/>
<path class="st0" d="M135.3,139.5L135.3,139.5l-0.1-32.7H168C168,124.8,153.4,139.5,135.3,139.5"/>
</svg>
<h1 class="display-4 fw-bold lh-1 mb-3">
<strong>MAX</strong>
L’outil de candidature et d’admissibilité
</h1>
<p class="col-lg-10 fs-4 fw-bold mb-0 text-primary">par interfor</p>
<h2 class="mb-4 fw-light">Max c’est Maximiser</h2>
<ul class="text-left mb-4 checklist d-none d-lg-flex" >
<li ><i class="fa-solid fa-check"></i> Le choix de l’orientation</li>
<li><i class="fa-solid fa-check"></i> La réussite de votre projet professionnel</li>
<li><i class="fa-solid fa-check"></i> Les chances de décrocher un contrat en alternance</li>
</ul>
{# <h5 class="mb-0"><a class="link-dark" style="text-decoration: none" href="http://www.interfor.fr" target="_blank">Accéder au site Interfor</a></h5>#}
{# <h2 class="alert alert-info">Interfor est actuellement fermé jusqu'au 15 août inclus. Le traitement de vos dossiers et de vos questions reprendra après cette date. <br>Merci de votre compréhension et à bientôt sur Max-interfor.fr </h2>#}
</div>
<div class="col-md-10 mx-auto col-lg-5">
<div class="p-4 p-md-5 rounded-3 bg-light">
<h3 class="mb-4 d-none d-lg-flex">Organisation du parcours : </h3>
<ul class="text-left mb-4 checklist d-none d-lg-flex" >
<li><i class="fa-solid fa-check"></i> Une inscription</li>
<li><i class="fa-solid fa-check"></i> Vous envoyez vos Pièces Jointes</li>
<li><i class="fa-solid fa-check"></i> Une étape QUIZ</li>
<li><i class="fa-solid fa-check"></i> Recherche entreprise</li>
<li><i class="fa-solid fa-check"></i> Nous remplissons avec vous votre engagement</li>
</ul>
<p class="text-center text-lg-start"><i class="fas fa-users"></i> Avec un accompagnement personnalisé, au bon endroit, au bon moment. <a href="https://interfor-formations.fr/" target="_blank">En savoir plus</a></p>
<a class="w-100 btn btn-lg btn-primary mb-2 shadow" data-toggle="modal" data-target="#registerModal" href="#">Je crée mon compte</a>
<a class="w-100 btn btn-lg btn-secondary shadow" data-toggle="modal" data-target="#loginModal" href="#">Je me connecte</a>
<hr class="my-3">
<div class="text-lg-center">
<p><a href="{{ path('company') }}" class="btn btn-link">Espace entreprise</a></p>
<p class="mb-0"><a class="btn btn-outline-primary " style="text-decoration: none" href="http://www.interfor.fr" target="_blank">Accéder au site Interfor</a></p>
</div>
</div>
</div>
</div>
</div>
<div class="modal right fade " id="registerModal" tabindex="-1" role="dialog" aria-labelledby="registerModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Je m'inscris</h5>
<button id="closeRegister" type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<p class="alert-info mb-4"><strong> Parcoursup : </strong> Attention, il faut vous inscrire sur Parcoursup préalablement. Si vous l’avez déjà fait vous allez être contacté prochainement.
<span id="idConnectSubscription" class="red">
{% if registerError is defined %}
</br>{{ registerError }}
{% endif %}
</span>
</p>
{{ form_start(form) }}
<div class="form-group mb-3">
{{ form_label(form.lastname) }}
{{ form_widget(form.lastname, {'attr': {'class': 'form-control'}}) }}
<div class="label-error">
{{ form_errors(form.lastname) }}
</div>
</div>
<div class="form-group mb-3">
{{ form_label(form.firstname) }}
{{ form_widget(form.firstname, {'attr': {'class': 'form-control'}}) }}
<div class="label-error">
{{ form_errors(form.firstname) }}
</div>
</div>
<div class="form-group mb-3">
{{ form_label(form.phone) }}
{{ form_widget(form.phone, {'attr': {'class': 'form-control', 'pattern' : '0[1-9][0-9]{8}', 'placeholder': 'ex : 0600000000', 'maxlength' : '10', 'id': 'phonecheck'}}) }}
<div class="label-error" id="labelErrorPhone">
{{ form_errors(form.phone) }}
</div>
</div>
<div class="form-group mb-3">
{{ form_label(form.email) }}
{{ form_widget(form.email, {'attr': {'class': 'form-control', "pattern" : "[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+.[a-zA-Z.]{2,15}"}}) }}
<div class="label-error">
{{ form_errors(form.email) }}
</div>
</div>
<div class="form-group mb-3">
<label for="pwd" class="required">Mot de passe</label>
<div class="input-group">
<span class="input-group-text"><i class="fa-solid fa-key"></i></span>
<input type="password" name="password" id="pwd" class="form-control" autocomplete="current-password" required placeholder="Mot de passe">
<span class="input-group-text showPassword" id="eye">
<i class="fa-solid fa-eye"></i>
</span>
</div>
</div>
<div class="form-group mb-2">
<div class="input-group">
<span class="input-group-text"><i class="fa-solid fa-key"></i></span>
<input type="password" name="password2" id="pwd2" class="form-control" onKeyUp="check(event)" autocomplete="current-password" required placeholder="Répéter le mot de passe">
<span class="input-group-text showPassword" id="eye2">
<i class="fa-solid fa-eye"></i>
</span>
</div>
</div>
<div class="col-sm-6">
<div id="error" class="error" style="display: none; color: red">Les mots de passe ne correspondent pas</div>
</div>
<div class="form-check mb-4 mt-4">
{{ form_widget(form.rgpd, {'attr': {'class': 'form-check-input'}}) }}
{{ form_label(form.rgpd) }}
</div>
<div class="form-group">
{{ form_label(form.save) }}
{{ form_widget(form.save, {'attr': {'class': 'btn btn-primary btn-lg d-none', 'onclick':'checkPhone(event)'}}) }}
</div>
<div class="btn btn-primary btn-lg" onclick="checkPhone(event)">S'inscrire</div>
<div class="label-error">
{{ form_errors(form) }}
</div>
{{ form_end(form) }}
</div>
</div>
</div>
</div>
<div class="modal right fade " id="loginModal" tabindex="-1" role="dialog" aria-labelledby="loginModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Je me connecte</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
{% for message in app.flashes('success') %}
<script>
$('#snackbar').html('{{ message }}').addClass('show');
// After 3 seconds, remove the show class from DIV
setTimeout(function(){ $('#snackbar').removeClass('show'); }, 3000);
</script>
{% endfor %}
<form method="POST" action="{{ path('app_login') }}" name="login_form">
{% if error %}
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<div class="form-group mb-3">
<label for="inputEmail">Numéro de téléphone</label>
<input type="text" value="{{ last_username }}" name="inputPhone" id="inputEmail" class="form-control" pattern="[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}" maxlength="14" autocomplete="email" required autofocus>
</div>
<div class="form-group mb-3">
<label for="inputPassword">Mot de passe</label>
<input type="password" name="inputPassword" id="inputPassword" class="form-control" autocomplete="current-password" required>
</div>
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
<div id="idConnect" class="red mt-1" ></div>
<div class="form-group ">
<a onclick="login(event)" class="btn btn-lg btn-success">Valider</a>
</div>
<hr class="my-4">
{# <a class="btn btn-link" href="{{ path('app_forgotten_password') }}">Mot de passe oublié ?</a> #}
<a class="btn btn-link" onclick="closeLoginModal()" data-toggle="modal" data-target="#forgotPasswordModal">Mot de passe oublié ?</a>
</form>
</div>
</div>
</div>
</div>
<div class="modal right fade " id="forgotPasswordModal" tabindex="-1" role="dialog" aria-labelledby="forgotPasswordModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Mot de passe oublié</h5>
<button id="closeForgotPasswordModal" type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<span id="successForgotPassword" class="green"></span>
<span id="errorForgotPassword" class="red">
</span>
<form method="POST" action="{{ path('app_forgotten_password') }}" name="forgot_password_form">
{% if error %}
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}
<div class="form-group mb-3">
<label for="inputEmail">E-mail</label>
<input id="forgot-email" placeholder="Votre email" type="text" name="email" class="form-control">
</div>
<div class="form-group">
<a onclick="forgotPassword(event)" class="btn btn-lg btn-success">Envoyer</a>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal right fade " id="verifySmsModal" tabindex="-1" role="dialog" aria-labelledby="verifySmsModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Vérifications en 2 étapes</h5>
<!--<button id="closeverifySmsModal" type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>-->
</div>
<p id="smsError" class="alert alert-danger d-none">
Code erroné
</p>
<p id="smsResend" class="alert alert-success d-none">
Un code vous a été renvoyé
</p>
<div class="modal-body text-center">
<span id="successVerifySms" class="text-success"></span>
<span id="errorVerifySms" class="text-danger"></span>
<p class="my-4">Veuillez entrer le code à <strong class="text-primary">6 chiffres</strong><br />envoyé sur votre téléphone <i class="fa-solid text-primary fa-mobile-screen-button"></i> <span id="phone_verify"></span></p>
<input class="form-control form-control-lg" id="inputCode" type="text" pattern="[0-9]{6}" style="max-width: 60%; margin: auto;" maxlength="6" required />
<p class="my-4"><strong>Vous n'avez pas reçu de sms ?</strong><br /><a id="resend-link" onclick="resendCode()" class="btn btn-sm my-2 btn-outline-primary disabled-link">renvoyez le code</a><br /><span id="timer">dans 60 secondes</span></p>
<button id='btn-submit' class="btn btn-lg btn-success" onclick="sendCode()"><i class="fa-solid fa-check"></i> Valider le code</button>
</div>
</div>
</div>
</div>
{% if message is defined and message is not null %}
<button type="button" id="modalHomeTextButton" style="display:none;" data-toggle="modal" data-target="#modalHomeText"></button>
<div class="modal fade" id="modalHomeText" tabindex="-1" role="dialog" aria-keyshortcuts="true" aria-labelledby="modalLabel" aria-hidden="true" style="display: none">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content" style="max-width: 30em">
<div>
<div class="">
<button type="button" class="closeModal close btn btn-outline-secondary" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" class="ion-ios-close">x</span>
</button>
<img src="{{ message.pictureUrl }}" width="100%"/>
</div>
<div class=" ">
<div class="modal-body d-flex align-items-center">
<div class="text w-40 text-center mt-3">
<h2 class="mb-2">{{ message.title }}</h2>
<h4 class="mb-4">{{ message.text }}</h4>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% block javascript %}
<script>
window.onload = function() {
if("{{registerError is defined}}"){
$('#registerModal').modal('show');
}
}
window.onload = function() {
window.setInterval(diminuerTemps, 1000)
{% if message is defined and message is not null %}
const modal = document.getElementById('modalHomeText');
document.getElementById('modalHomeTextButton').click();
{% endif %}
}
const modal = document.getElementById('modalHomeText') ? document.getElementById('modalHomeText') : null;
function closeModalHomeText(){
document.getElementById('modalHomeTextButton').click();
}
document.getElementById("eye").addEventListener("click", function(e){
var pwd = document.getElementById("pwd");
console.log(pwd.getAttribute("type"))
if(pwd.getAttribute("type")=="password"){
pwd.setAttribute("type","text");
} else {
pwd.setAttribute("type","password");
}
});
document.getElementById("eye2").addEventListener("click", function(e){
var pwd2 = document.getElementById("pwd2");
if(pwd2.getAttribute("type")=="password"){
pwd2.setAttribute("type","text");
} else {
pwd2.setAttribute("type","password");
}
});
// $(document).ready(function(e) {
function check(evt){
var password = $("#pwd").val();
var confirmPassword = $("#pwd2").val();
if (password != confirmPassword) {
$('#error').css('display', 'block')
$("#submit").prop('disabled', true)
}
else {
$('#error').css('display', 'none')
$("#submit").prop('disabled', false)
}
};
// $(document).ready(function(e) {
function checkPhone(evt){
$('#labelErrorPhone').html('');
let form = document.querySelector('[name="user_form"]');
var phone = $("#user_form_phone").val();
var email = $("#user_form_email").val();
console.log($("#user_form_phone").length, form)
if(phone != null && phone.length > 4 && email != null && email.length > 4) {
if ($("#pwd").val() === $("#pwd2").val()) {
if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email) === true) {
$.ajax({
type: "POST",
url: "{{ path('app_check_phone') }}",
data: {
'phone': phone,
},
dataType: 'html',
success: function(data) {
if (data == 'true'){
$("#submit").prop('disabled', true)
$('#idConnectSubscription').append("<br> Numéro de téléphone existe déjà, veuillez vous connecter");
evt.preventDefault();
}
else {
form.submit();
}
}
});
}
else {
$('#idConnectSubscription').append("<br> Email invalide");
}
}
else {
$('#idConnectSubscription').append("<br> Les mots de passe ne correspondent pas");
}
}
else {
$("#submit").prop('disabled', true)
$('#idConnectSubscription').html('')
$('#idConnectSubscription').append("<br> Veuillez remplir tous les champs");
evt.preventDefault();
}
}
function login(evt) {
var phone = $('input[name="inputPhone"]').val();
var password = $('input[name="inputPassword"]').val();
let form = document.querySelector('[name="login_form"]');
evt.preventDefault();
$('#idConnect').html('');
$.ajax({
type: "POST",
url: "{{ path('app_login_user') }}",
data: {
'phone': phone,
'password': password,
},
dataType: 'html',
success: function(data) {
if (data == 'true'){
form.submit();
}
else {
$('#idConnect').append("Numéro de téléphone et ou mot de passe sont incorrect");
}
}
});
}
function forgotPassword(evt) {
var email = $('#forgot-email').val();
evt.preventDefault();
$.ajax({
type: "POST",
url: "{{ path('app_forgotten_password') }}",
data: {
'email': email,
},
success: function(data) {
if(data == false){
$('#successForgotPassword').html('')
$('#errorForgotPassword').html('Aucun e-mail correspondant n\'a été trouvé<br>');
}else{
$('#errorForgotPassword').html('')
$('#successForgotPassword').html('Un e-mail vous a été envoyé');
}
console.log(data)
}
});
}
// SMS VERIFY
const timerElement = document.getElementById("timer")
let timer = 60
function createCode(){
// console.log('test');
// $.ajax({
// type: "POST",
// url: "/verify/create",
// data: {'data':$("[name='user_form']").serialize()}, // serializes the form's elements.
// success: function(data)
// {
// $('#closeRegister').click();
// $('#phone_verify').html($('inputEmail').val())
// $('#verifySmsModal').modal('show');
// resetTimer()
// console.log(data);
//
// }
// });
//
// return false; // avoid to execute the actual submit of the form.
}
function sendCode(){
$("#btn-submit").attr('disabled', true);
console.log($('#inputCode').val())
const code = $('#inputCode').val();
$('#smsError').addClass('d-none')
$.ajax({
type: "POST",
url: "/verify/code",
data: {'code':code}, // serializes the form's elements.
success: function(data)
{
resetTimer()
console.log(data);
if(data == false){
$('#smsError').removeClass('d-none')
$("#btn-submit").attr('disabled', false);
}else{
window.location.reload()
}
}
});
}
function resendCode(){
const code = $('#inputCode').val();
$('#smsResend').addClass('d-none')
$.ajax({
type: "POST",
url: "/resend/sms",
data: {'data':$("[name='user_form']").serialize()}, // serializes the form's elements.
success: function(data)
{
resetTimer()
console.log(data);
if(data == true){
$('#smsResend').removeClass('d-none')
}
}
});
}
function diminuerTemps() {
if(timer < 1){
$('#resend-link').removeClass('disabled-link')
timerElement.innerText = ''
}else{
timerElement.innerText = "dans " +timer+ " secondes"
timer--
}
}
function resetTimer(){
$('#resend-link').addClass('disabled-link')
timer = 60
}
</script>
{% endblock %}
{% endblock %}