Add a way to define user password on subscribe.php
This commit is contained in:
parent
b39b9931ef
commit
49f16f5f12
@ -128,6 +128,11 @@ class User
|
|||||||
return hash("whirlpool", $username.':'.$password);
|
return hash("whirlpool", $username.':'.$password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setPassword($password)
|
||||||
|
{
|
||||||
|
$this->password = $this->getPassword($this->username, $password);
|
||||||
|
}
|
||||||
|
|
||||||
public function set_validated($validated)
|
public function set_validated($validated)
|
||||||
{
|
{
|
||||||
$this->validated = $validated;
|
$this->validated = $validated;
|
||||||
|
@ -1,4 +1,31 @@
|
|||||||
<?php include("header.html") ?>
|
<?php
|
||||||
|
include("header.html");
|
||||||
|
|
||||||
|
if (isset($_GET["new_admin"]))
|
||||||
|
{
|
||||||
|
die("Fonction désactivée");
|
||||||
|
if ($_POST["password"] == $_POST["passwordc"])
|
||||||
|
{
|
||||||
|
include("User.class.php");
|
||||||
|
|
||||||
|
$users = User::getUsers();
|
||||||
|
@$id = sha1($_POST["email"]);
|
||||||
|
|
||||||
|
if (array_key_exists($id, $users))
|
||||||
|
{
|
||||||
|
$users[$id]->setPassword($_POST["password"]);
|
||||||
|
User::setUsers($users);
|
||||||
|
echo "Mot de passe défini avec succès.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo("Utilisateur non trouvé");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo("Le mot de passe et sa confirmation sont différents.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
?>
|
||||||
<section id="introduction">
|
<section id="introduction">
|
||||||
<article id="left">
|
<article id="left">
|
||||||
<h2>Inscription</h2>
|
<h2>Inscription</h2>
|
||||||
@ -15,14 +42,30 @@
|
|||||||
|
|
||||||
<form id="formulaire_email" method="post" action="subscribeAction.php">
|
<form id="formulaire_email" method="post" action="subscribeAction.php">
|
||||||
<label for="email">Votre email : </label>
|
<label for="email">Votre email : </label>
|
||||||
<input id="email" name="email" type="text" />
|
<input id="email" name="email" type="text">
|
||||||
|
|
||||||
<label for="login">Login : </label>
|
<label for="login">Login : </label>
|
||||||
<input id="login" name="login" type="text" />
|
<input id="login" name="login" type="text">
|
||||||
|
|
||||||
<input type="submit" name="send" value="Envoyer"/>
|
<input type="submit" name="send" value="Envoyer">
|
||||||
|
</form>
|
||||||
|
</article>
|
||||||
|
<article id="genpass">
|
||||||
|
<h2>Administration</h2>
|
||||||
|
<form id="formulaire_gen" method="post" action="?new_admin">
|
||||||
|
<label for="email">Votre email : </label>
|
||||||
|
<input id="email" name="email" type="text">
|
||||||
|
|
||||||
|
<label for="password">Mot de passe : </label>
|
||||||
|
<input id="passowrd" name="password" type="password">
|
||||||
|
|
||||||
|
<label for="passwordc">Confirmation : </label>
|
||||||
|
<input id="passowrdc" name="passwordc" type="password">
|
||||||
|
|
||||||
|
<input type="submit" name="send" value="Envoyer">
|
||||||
</form>
|
</form>
|
||||||
</article>
|
</article>
|
||||||
</section>
|
</section>
|
||||||
|
<?php } ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Reference in New Issue
Block a user