<script type="text/javascript">$(document).ready(function(){var ConnectPlugin = $.fn.ConnectPlugin();$(document).on('click', '#tunnel-carrousel-password-forget-1', function(){var email = $.trim($('#tunnel-verification-email-input').val());if(email!==''){$('#spinner-tunnel-carrousel-password-forget-1').removeClass('d-none');var $this = $(this);$this.prop('disabled', true);var form = $("#tunnel-verification-email-compte").serialize();var url = "{{path('compte_client_verification_email_mot_de_passe_oublier')}}";$.ajax({url: url,method: 'POST',data: form,success : function(res){if(res.success){$('#email-code-confirmation').val($('#tunnel-verification-email-input').val());$('#carousel-mot-de-passe-oublier').carousel('next');}else{ConnectPlugin.elementDisplayError('#tunnel-verification-email-input', res.msg);}$this.prop('disabled', false);$('#spinner-tunnel-carrousel-password-forget-1').addClass('d-none');},error: function(){alert("Erreur lors de la verification d'email du compte");$this.prop('disabled', false);$('#spinner-tunnel-carrousel-password-forget-1').addClass('d-none');}});}else{ConnectPlugin.elementDisplayError('#tunnel-verification-email-input', 'Veuillez renseigner votre adresse email');}});$(document).on('click', '#tunnel-carrousel-password-forget-2', function(){$('#alert-message-code-confirmation').addClass('d-none');$('#message-code-confirmation').html('');var code = $.trim($('#code-confirmation').val());var pass = $.trim($('#password-new').val());var confirme = $.trim($('#password-confirme').val());var verif = true;if(code === ''){verif = false;ConnectPlugin.elementDisplayError('#code-confirmation', 'Renseigner le code de confirmation');}if(pass === ''){verif = false;ConnectPlugin.elementDisplayError('#password-new', 'Renseigner le nouveau mot de passe');}if(confirme === ''){verif = false;ConnectPlugin.elementDisplayError('#password-confirme', 'Confirmer votre mot de passe');}if(verif) {var checkPass = checkPassword(pass);if(pass !== confirme) {ConnectPlugin.elementDisplayError('#password-new', 'Les mots de passe ne sont pas identique');ConnectPlugin.elementDisplayError('#password-confirme', 'Les mots de passe ne sont pas identique');}else if(!checkPass.success){$('#message-code-confirmation').html(checkPass.msg);$('#alert-message-code-confirmation').removeClass('d-none');ConnectPlugin.elementDisplayError('#password-new', '');ConnectPlugin.elementDisplayError('#password-confirme', '');}else{var $this = $(this);$this.prop('disabled', true);$('#spinner-tunnel-carrousel-password-forget-2').removeClass('d-none');var form = $("#tunnnel-code-confirmation-compte").serialize();var url = "{{path('compte_client_code_confirmation_mot_de_passe_oublier')}}";$.ajax({url: url,method: 'POST',data: form,success : function(res){if(res.success){$('#carousel-mot-de-passe-oublier').carousel('next');}else{$('#message-code-confirmation').html(res.msg);$('#alert-message-code-confirmation').removeClass('d-none');}$this.prop('disabled', false);$('#spinner-tunnel-carrousel-password-forget-2').addClass('d-none');},error: function(){alert("Erreur lors de la verification d'email du compte");$this.prop('disabled', false);$('#spinner-tunnel-carrousel-password-forget-2').addClass('d-none');}});}}});$(document).on('click', '.tunnel-carrousel-password-forget-prev', function(){$('#carousel-mot-de-passe-oublier').carousel('prev');});$(document).on('click', '.input-view-password-forget', function(){var $this = $(this);var type = $this.attr('data-type');inputViewPassword($this, type);});function inputViewPassword($this, type){if(type == 1){$this.siblings('input').attr('type', 'text');$this.find('i').removeClass('fe-eye').addClass('fe-eye-off');$this.attr('data-type', 0);}else{$this.siblings().attr('type', 'password');$this.find('i').removeClass('fe-eye-off').addClass('fe-eye');$this.attr('data-type', 1);}}function checkPassword(pass) {var pass1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';var pass2 = 'abcdefghijklmnopqrstuvwxyz';var pass3 = '0123456789';var pass4 = '@/#!';var arrayPass = [pass1, pass2, pass3, pass4];// tslint:disable-next-line: max-line-lengthvar passError = 'Le mot de passe doit contenir au minimum 8 caractères, dont 1 chiffre, 1 Majuscule, 1 minuscule et un caractère spécial @ / # !';let bOk = false;const res = {success: true, msg: ''};if (pass.length > 7) {try {arrayPass.forEach((element, index) => {bOk = checkNombreCharInPass(pass, element, 1);if (!bOk) {res.success = false;res.msg = passError;throw res;}});} catch (e) {console.log('erreur', e);}} else {res.success = false;res.msg = passError;}return res;}function checkNombreCharInPass(pass, regex, nbr) {const arrayReg = Array.from(regex);let bOk = false;let nbrChar = 0;for (const char of arrayReg) {if (pass.indexOf(char) >= 0) {nbrChar++;}}if (nbrChar >= nbr) {bOk = true;}return bOk;}});</script>