1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-25 18:17:24 +02:00

Design "Confirmer mail" & mini-corrections

This commit is contained in:
galaxyoyo
2019-09-24 23:54:04 +02:00
parent 90952ecb7c
commit 60939771f6
5 changed files with 30 additions and 15 deletions

View File

@ -23,6 +23,7 @@ class NewUser
public $role;
public $school;
public $class;
public $receive_animath_mails;
public $description;
public $confirm_email_token;
@ -33,6 +34,8 @@ class NewUser
{
foreach ($data as $key => $value)
$this->$key = htmlspecialchars($value);
$this->receive_animath_mails = $this->receive_animath_mails ? 1 : 0;
}
public function makeVerifications()
@ -63,10 +66,10 @@ class NewUser
if (!$DB->query("SELECT `id` FROM `users` WHERE `year` = $YEAR;")->fetch())
$this->role = Role::ADMIN;
$req = $DB->prepare("INSERT INTO `users`(`email`, `pwd_hash`, `confirm_email`, `surname`, `first_name`, `school`, `class`, `role`, `description`, `year`)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
$req = $DB->prepare("INSERT INTO `users`(`email`, `pwd_hash`, `confirm_email`, `surname`, `first_name`, `school`, `class`, `role`, `description`, `receive_animath_mails`, `year`)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);");
$req->execute([$this->email, password_hash($this->password, PASSWORD_BCRYPT), $this->confirm_email_token, $this->surname, $this->first_name,
$this->school, SchoolClass::getName($this->class), Role::getName($this->role), $this->description, $YEAR]);
$this->school, SchoolClass::getName($this->class), Role::getName($this->role), $this->description, $this->receive_animath_mails, $YEAR]);
Mailer::sendRegisterMail($this);
}