<style>
.champs-sofa {
color: #000;
width: 88%;
padding: 1rem;
border: solid 1px #2AF;
border-radius: 15px;
margin-bottom: 0.2rem;
box-shadow: inset 0 0 5px #2AF;
padding-right: 3rem; /* espace pour l'œil */
font-size: 1rem;
margin-left: 0.5rem;
}
.champs-container {
width: 30vw;
margin: 0 auto;
position: relative;
}
.show-hide-btn {
position: absolute;
top: 50%;
right: 3rem;
transform: translateY(-50%);
color: #2AF;
font-size: 1.2rem;
cursor: pointer;
z-index: 2;
}
.champs-label img {
vertical-align: middle;
margin-bottom: 0.4rem;
}
.champs-feedback {
width: 30vw;
margin: 0 auto;
margin-bottom: 1rem;
font-size: 0.85rem;
}
.show-hide-btn:hover {
color: #168ad3;
font-size: 2rem;
}
i{
font-size: 1.5rem;
color: grey;
}
.invalid-feedback{
color: red;
}
.valid-feedback{
color: limegreen;
}
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css">
<div class="container_test_form" style="margin-top: 2rem;margin-bottom: 3rem;">
<form id="contactFormArea" style="width: 40vw; margin: 0 auto;" action="https://logicielsofa.fr/test/_00_utilitaires_test_artisan/utilitaire_dossier.php" method="POST">
<div id="NOM_DOSS_test" style="width: 30vw; margin: 0 auto;"><label for="NOM_DOSS"><img class="alignnone size-full wp-image-1441" style="vertical-align: middle;" src="https://so-fa.fr/wp-content/uploads/2015/03/nom.png" alt="nom" width="32" height="30" /></label>
<input id="NOM_DOSS" style="color: #000; width: 88%; padding: 1rem; border: solid 1px #2AF; border-radius: 15px; margin-bottom: 1rem; box-shadow: inset 0 0 5px #2AF;" name="NOM_DOSS" required="" type="text" placeholder="Nom de votre société" /></div>
<div id="ADR1_test" style="width: 30vw; margin: 0 auto;"><label for="ADR1"><img class="alignnone size-full wp-image-1441" style="vertical-align: middle;" src="https://so-fa.fr/wp-content/uploads/2015/03/adresse.png" alt="adresse" width="32" height="30" /></label>
<input id="ADR1" style="color: #000; width: 88%; padding: 1rem; border: solid 1px #2AF; border-radius: 15px; margin-bottom: 1rem; box-shadow: inset 0 0 5px #2AF;" name="ADR1" required="" type="text" placeholder="Votre adresse" /></div>
<div id="ADR2_test" style="width: 30vw; margin: 0 auto;"><label for="ADR2"><img class="alignnone size-full wp-image-1441" style="vertical-align: middle;" src="https://so-fa.fr/wp-content/uploads/2015/03/adresse.png" alt="adresse2" width="32" height="30" /></label>
<input id="ADR2" style="color: #000; width: 88%; padding: 1rem; border: solid 1px #2AF; border-radius: 15px; margin-bottom: 1rem; box-shadow: inset 0 0 5px #2AF;" name="ADR2" type="text" placeholder="Complément d'adresse" /></div>
<div id="CPOSTAL_test" style="width: 30vw; margin: 0 auto;"><label for="CPOSTAL"><img class="alignnone size-full wp-image-1441" style="vertical-align: middle;" src="https://so-fa.fr/wp-content/uploads/2015/03/adresse.png" alt="codepostal" width="32" height="30" /></label>
<input id="CPOSTAL" style="color: #000; width: 88%; padding: 1rem; border: solid 1px #2AF; border-radius: 15px; margin-bottom: 1rem; box-shadow: inset 0 0 5px #2AF;" maxlength="5" name="CPOSTAL" required="" type="text" placeholder="Code postal" /></div>
<div id="VILLE_test" style="width: 30vw; margin: 0 auto;"><label for="VILLE"><img class="alignnone size-full wp-image-1441" style="vertical-align: middle;" src="https://so-fa.fr/wp-content/uploads/2015/03/adresse.png" alt="ville" width="32" height="30" /></label>
<input id="VILLE" style="color: #000; width: 88%; padding: 1rem; border: solid 1px #2AF; border-radius: 15px; margin-bottom: 1rem; box-shadow: inset 0 0 5px #2AF;" name="VILLE" required="" type="text" placeholder="Votre ville" />
</div>
<div id="FIXE_test" style="width: 30vw; margin: 0 auto;"><label for="FIXE"><img class="alignnone size-full wp-image-1445" style="vertical-align: middle;" src="https://so-fa.fr/wp-content/uploads/2015/03/fixe.png" alt="fixe" width="32" height="30" /></label>
<input id="FIXE" style="color: #000; width: 88%; padding: 1rem; border: solid 1px #2AF; border-radius: 15px; margin-bottom: 1rem; box-shadow: inset 0 0 5px #2AF;" maxlength="10" name="FIXE" type="text" placeholder="Votre numéro de téléphone fixe" />
</div>
<div id="PORTABLE_test" style="width: 30vw; margin: 0 auto;"><label for="PORTABLE"><img class="alignnone size-full wp-image-1446" style="vertical-align: middle; margin-left: 2px;" src="https://so-fa.fr/wp-content/uploads/2015/03/portable.png" alt="portable" width="32" height="30" /></label>
<input id="PORTABLE" style="color: #000; width: 87%; padding: 1rem; border: solid 1px #2AF; border-radius: 15px; margin-bottom: 1rem; box-shadow: inset 0 0 5px #2AF;" maxlength="10" name="PORTABLE" type="text" placeholder="Votre numéro de téléphone portable" />
</div>
<hr>
<p style="text-align: center;color: orange;"><i class="bi bi-info-square-fill" style="color: orange;"></i> Ces informations vous serviront pour vous connecter à votre espace SO-FA</p>
<div id="EMAIL_test" style="width: 30vw; margin: 0 auto;"><label for="EMAIL"><img class="alignnone size-full wp-image-1444" style="vertical-align: middle;" src="https://so-fa.fr/wp-content/uploads/2015/03/email.png" alt="email" width="32" height="30" /></label>
<input id="EMAIL" style="color: #000; width: 88%; padding: 1rem; border: solid 1px #2AF; border-radius: 15px; margin-bottom: 1rem; box-shadow: inset 0 0 5px #2AF;" maxlength="50" name="EMAIL" required="" type="text" placeholder="Votre email" />
</div>
<div id="MPASS1_test" class="champs-container">
<label for="mdp" class="champs-label">
<i class="bi bi-incognito"></i>
</label>
<input id="mdp" type="password" name="MPASS1" class="champs-sofa" placeholder="Nouveau mot de passe" oninput="validate()" style=" color: #000;width: 88%;padding: 1rem;border: solid 1px #2AF;border-radius: 15px;margin-bottom: 0.2rem;box-shadow: inset 0 0 5px #2AF;padding-right: 3rem;font-size: 1.8rem;margin-left: 0.5rem;"/>
<span onclick="show_or_hide('mdp')" class="show-hide-btn">
<i class="bi bi-eye-fill" id="hide_btn_1"></i>
</span>
</div>
<div id="error_mdp" class="invalid-feedback champs-feedback" style="visibility: hidden; display: none;">
<i class="bi bi-exclamation-circle-fill" style="color: red;"></i> Votre mot de passe doit comporter 8 caractères, une majuscule, une minuscule et un chiffre minimum.
</div>
<div id="valid_mdp" class="valid-feedback champs-feedback" style="visibility: hidden; display: none;">
<i class="bi bi-check-circle-fill" style="color: limegreen;"></i> Mot de passe correct
</div>
<div id="MPASS2_test" class="champs-container">
<label for="mdp2" class="champs-label">
<i class="bi bi-incognito"></i>
</label>
<input id="mdp2" type="password" name="MPASS2" class="champs-sofa" placeholder="Confirmation du mot de passe" oninput="validate()" style=" color: #000;width: 88%;padding: 1rem;border: solid 1px #2AF;border-radius: 15px;margin-bottom: 0.2rem;box-shadow: inset 0 0 5px #2AF;padding-right: 3rem;font-size: 1.8rem;margin-left: 0.5rem;"/>
<span onclick="show_or_hide('mdp2')" class="show-hide-btn">
<i class="bi bi-eye-fill" id="hide_btn_2"></i>
</span>
</div>
<div id="error_mdp2" class="invalid-feedback champs-feedback" style="visibility: hidden; display: none;">
<i class="bi bi-exclamation-circle-fill" style="color: red;"></i> Votre saisie n'est pas similaire dans les deux champs.
</div>
<div id="valid_mdp2" class="valid-feedback champs-feedback" style="visibility: hidden; display: none;">
<i class="bi bi-check-circle-fill" style="color: limegreen;"></i> Mots de passe similaires
</div>
<br>
<hr>
<div id="cgv" style="line-height:30px;font-size: 0.7em; font-weight: bold; margin-bottom: 1.5rem; margin-top: 1rem; color: black !important;display: flex;justify-content: center;"><input id="chekboxCGV" style="float: left; width: 20px; line-height: 30px; margin-top: 0.5rem;" name="chekboxCGV" required="" type="checkbox" value="checkbox" /> En cochant cette case vous acceptez nos <a href="https://so-fa.fr/conditions-generales-de-ventes" target="_blanck" rel="noopener noreferrer" style="margin-left: 0.1rem;">conditions générales de ventes</a></div>
<div id="footer_abo">
<div id="CODEPROMO_test" style="display: flex;justify-content: center;margin-bottom: 1rem;">
<label for="CODEPROMO" style="margin-right: 0.5rem;padding-top: 0.2rem;">Si vous possédez un code promo, renseignez-le ici : </label>
<input id="CODEPROMO" style="color: #000; border: solid 1px #16842b; border-radius: 9px; box-shadow: inset 0 0 5px #16842b;padding-top: 0.5rem;" title="Entrer ici votre Code PROMO afin de bénéficier de tarifs préférentiels" name="CODEPROMO" type="text"/></div>
</div>
<div style="text-align: center;margin-top: 2rem;">
<input id="btn_valid" class="buttoncontactblue" style="background-color: grey; padding: 1rem; border: none; border-radius: 15px; color: white; font-weight: bold; margin: 0 auto;" name="submit" type="submit" value="Valider la création de votre compte" disabled="true"/>
</div>
</form>
</div>
<script>
function validate() {
let str = document.getElementById("mdp");
let str2 = document.getElementById("mdp2");
let btn_value = document.getElementById('btn_valid');
let error_mdp = document.getElementById('error_mdp');
let error_mdp2 = document.getElementById('error_mdp2');
let valid_mdp = document.getElementById('valid_mdp');
let valid_mdp2 = document.getElementById('valid_mdp2');
if (str.value.match( /[0-9]/g) &&
str.value.match( /[A-Z]/g) &&
str.value.match(/[a-z]/g) &&
str.value.length >= 8){
// on débloque le bouton valider
str.setAttribute('style','border-color: rgb(50,205,50);background-color: rgba(50,205,50,0.1);border-width: 3px;border-radius: 15px;');
error_mdp.setAttribute('style','visibility:hidden;display: none;');
valid_mdp.setAttribute('style','visibility:visible;display: block;');
}else {
// on bloque le bouton valider
btn_value.setAttribute('disabled','true');
btn_value.style.backgroundColor = "grey";
str.setAttribute('style','border-color: red;background-color: rgba(255,0,0,0.1);border-width: 3px;border-radius: 15px;');
error_mdp.setAttribute('style','visibility:visible;display: block;');
valid_mdp.setAttribute('style','visibility:hidden;display: none;');
}
if (str.value === str2.value){
if (str.value.match( /[0-9]/g) &&
str.value.match( /[A-Z]/g) &&
str.value.match(/[a-z]/g) &&
str.value.length >= 8 &&
str2.value.match( /[0-9]/g) &&
str2.value.match( /[A-Z]/g) &&
str2.value.match(/[a-z]/g) &&
str2.value.length >= 8){
// on débloque le bouton valider
str.setAttribute('style','border-color: rgb(50,205,50);background-color: rgba(50,205,50,0.1);border-width: 3px;border-radius: 15px;');
error_mdp.setAttribute('style','visibility:hidden;display: none;');
valid_mdp.setAttribute('style','visibility:visible;display: block;');
str2.setAttribute('style','border-color: rgb(50,205,50);background-color: rgba(50,205,50,0.1);border-width: 3px;border-radius: 15px;');
error_mdp2.setAttribute('style','visibility:hidden;display: none;');
valid_mdp2.setAttribute('style','visibility:visible;display: block;');
btn_value.removeAttribute('disabled');
btn_value.style.backgroundColor = "#2af";
}else {
// on bloque le bouton valider
btn_value.setAttribute('disabled','true');
btn_value.style.backgroundColor = "grey";
str.setAttribute('style','border-color: red;background-color: rgba(255,0,0,0.1);border-width: 3px;border-radius: 15px;');
error_mdp.setAttribute('style','visibility:visible;display: block;');
valid_mdp.setAttribute('style','visibility:hidden;display: none;');
str2.setAttribute('style','border-color: red;background-color: rgba(255,0,0,0.1)border-width: 3px;border-radius: 15px;');
error_mdp2.setAttribute('style','visibility:visible;display: block;');
valid_mdp2.setAttribute('style','visibility:hidden;display: none;');
}
}else{
// on bloque le bouton valider
btn_value.setAttribute('disabled','true');
btn_value.style.backgroundColor = "grey";
str2.setAttribute('style','border-color: red;background-color: rgba(255,0,0,0.1);border-width: 3px;border-radius: 15px;');
error_mdp2.setAttribute('style','visibility:visible;display: block;');
valid_mdp2.setAttribute('style','visibility:hidden;display: none;');
}
}
function show_or_hide(name) {
console.log(name);
let x = document.getElementById(name);
console.log(x.type);
if (x.type === "password") {
x.type = "text";
if (name == "mdp"){
document.getElementById("hide_btn_1").setAttribute('class','bi bi-eye-slash-fill');
}else{
document.getElementById("hide_btn_2").setAttribute('class','bi bi-eye-slash-fill');
}
} else {
x.type = "password";
if (name == "mdp"){
document.getElementById("hide_btn_1").setAttribute('class','bi bi-eye-fill');
}else{
document.getElementById("hide_btn_2").setAttribute('class','bi bi-eye-fill');
}
}
}
</script>