Ajout d'une validation des mots de passe, ceux-ci

ne doivent pas dépasser
les 100 caractères
ServeurDeTest
Johan LACHENAL 2 years ago
parent a86acffb4b
commit 743f8aca5e

@ -36,4 +36,11 @@ class Validation
}
return true;
}
public function ValidatePassword(string $password) : bool{
if(strlen($password)>100)
{
return false;
}
return true;
}
}

@ -54,7 +54,10 @@ class Controller
throw (new Exception("Email non valide"));
}
if(! $validation->ValidateUsername($_REQUEST['username'])){
throw(new Exception("Username non valide"));
throw(new Exception("Pseudo non valide"));
}
if(! $validation->ValidatePassword($_REQUEST['password'])){
throw(new InvalidMdpException("Mot de passe non valide"));
}
$joueur = new Joueur($_REQUEST['email'], $_REQUEST['username'], $_REQUEST['password']);
$gateway->insert($joueur);

Loading…
Cancel
Save