1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-25 10:20:30 +02:00

Modifications mail nouvau organisateur

This commit is contained in:
Yohann D'ANELLO
2020-01-18 23:57:49 +01:00
parent 7096f6fee1
commit cd70de049a
4 changed files with 16 additions and 19 deletions

View File

@ -24,6 +24,7 @@ class NewOrganizer {
public $email;
public $admin;
public $password;
public $token;
public function __construct($data)
{
@ -45,10 +46,11 @@ class NewOrganizer {
global $DB, $YEAR;
$this->password = genRandomPhrase(16, true);
$this->token = genRandomPhrase(64);
$req = $DB->prepare("INSERT INTO `users`(`email`, `pwd_hash`, `surname`, `first_name`, `role`, `year`)
VALUES (?, ?, ?, ?, ?, ?);");
$req->execute([$this->email, password_hash($this->password, PASSWORD_BCRYPT), $this->surname, $this->first_name, $this->admin ? "ADMIN" : "ORGANIZER", $YEAR]);
$req = $DB->prepare("INSERT INTO `users`(`email`, `pwd_hash`, `surname`, `first_name`, `role`, `forgotten_password`, `year`)
VALUES (?, ?, ?, ?, ?, ?, ?);");
$req->execute([$this->email, password_hash($this->password, PASSWORD_BCRYPT), $this->surname, $this->first_name, $this->admin ? "ADMIN" : "ORGANIZER", $this->token, $YEAR]);
Mailer::sendAddOrganizerMail($this);
}