diff --git a/js/register.js b/js/register.js index e69de29..255332b 100644 --- a/js/register.js +++ b/js/register.js @@ -0,0 +1,10 @@ +window.addEventListener("load", function () { + let passwd = this.document.getElementById("passwd"); + let passwd_conf = this.document.getElementById("conf_passwd"); + + passwd_conf.addEventListener("change", function(){ + this.style.border += "red"; + let error = document.getElementById("error"); + error.style.display = "block"; + }); +}); \ No newline at end of file diff --git a/php/auth/login.php b/php/auth/login.php index dce4c92..51cf695 100644 --- a/php/auth/login.php +++ b/php/auth/login.php @@ -42,6 +42,6 @@ - Pas de compte ? Inscrivez-vous ! + Pas de compte ? Inscrivez-vous ! diff --git a/php/auth/register.php b/php/auth/register.php index 2a0f098..8020349 100644 --- a/php/auth/register.php +++ b/php/auth/register.php @@ -12,17 +12,26 @@ if($mail) { - $pass = filter_input(INPUT_POST, 'passwd', FILTER_SANITIZE_STRING); + $promo = filter_input(INPUT_POST, 'promo', FILTER_VALIDATE_INT | FILTER_SANITIZE_NUMBER_INT); - // A continuer + if($promo) + { + $pass = filter_input(INPUT_POST, 'passwd', FILTER_SANITIZE_STRING); + + register($mail, $promo, password_hash($pass, PASSWORD_DEFAULT)); + + header("Location: login.php"); + } } } include "../templates/header.php"; ?>