mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-24 17:42:23 +00:00
Modifications mail nouvau organisateur
This commit is contained in:
parent
7096f6fee1
commit
cd70de049a
@ -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);
|
||||
}
|
||||
|
@ -130,11 +130,6 @@ function canValidate(Team $team, Tournament $tournament)
|
||||
$req->execute([$team->getEncadrants()[$i - 1], $tournament->getId(), "PHOTO_CONSENT"]);
|
||||
$d = $req->fetch();
|
||||
$can_validate &= $d["version"] > 0;
|
||||
|
||||
$req = $DB->prepare("SELECT COUNT(*) AS `version` FROM `documents` WHERE `user` = ? AND `tournament` = ? AND `type` = ?;");
|
||||
$req->execute([$team->getEncadrants()[$i - 1], $tournament->getId(), "SANITARY_PLUG"]);
|
||||
$d = $req->fetch();
|
||||
$can_validate &= $d["version"] > 0;
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= 6; ++$i) {
|
||||
@ -146,17 +141,17 @@ function canValidate(Team $team, Tournament $tournament)
|
||||
$d = $req->fetch();
|
||||
$can_validate &= $d["version"] > 0;
|
||||
|
||||
$req = $DB->prepare("SELECT COUNT(*) AS `version` FROM `documents` WHERE `user` = ? AND `tournament` = ? AND `type` = ?;");
|
||||
$req->execute([$team->getParticipants()[$i], $tournament->getId(), "SANITARY_PLUG"]);
|
||||
$d = $req->fetch();
|
||||
$can_validate &= $d["version"] > 0;
|
||||
|
||||
$birth_date = $DB->query("SELECT `birth_date` FROM `users` WHERE `id` = " . $team->getParticipants()[$i] . ";")->fetch()["birth_date"];
|
||||
if ($birth_date > strval($YEAR - 18) . substr($tournament->getStartDate(), 4)) {
|
||||
$req = $DB->prepare("SELECT COUNT(*) AS `version` FROM `documents` WHERE `user` = ? AND `tournament` = ? AND `type` = ?;");
|
||||
$req->execute([$team->getParticipants()[$i], $tournament->getId(), "PARENTAL_CONSENT"]);
|
||||
$d = $req->fetch();
|
||||
$can_validate &= $d["version"] > 0;
|
||||
|
||||
$req = $DB->prepare("SELECT COUNT(*) AS `version` FROM `documents` WHERE `user` = ? AND `tournament` = ? AND `type` = ?;");
|
||||
$req->execute([$team->getParticipants()[$i], $tournament->getId(), "SANITARY_PLUG"]);
|
||||
$d = $req->fetch();
|
||||
$can_validate &= $d["version"] > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ class Mailer
|
||||
$content = self::getTemplate("add_organizer");
|
||||
$content = preg_replace("#{FIRST_NAME}#", $new_orga->first_name, $content);
|
||||
$content = preg_replace("#{SURNAME}#", $new_orga->surname, $content);
|
||||
$content = preg_replace("#{PASSWORD}#", $new_orga->password, $content);
|
||||
$content = preg_replace("#{TOKEN}#", $new_orga->token, $content);
|
||||
|
||||
self::sendMail($new_orga->email, "Ajout d'un organisateur – TFJM² $YEAR", $content);
|
||||
}
|
||||
|
@ -7,12 +7,12 @@
|
||||
<body>
|
||||
Bonjour {FIRST_NAME} {SURNAME},<br />
|
||||
<br />
|
||||
Vous recevez ce message (envoyé automatiquement) car vous êtes organisateur d'un des tournois du TFJM<sup>2</sup>.
|
||||
Veuillez trouver ci-dessous vos informations d'utilisateur pour le site officiel des inscriptions. Elles vous permettront de gérer les inscriptions des équipes de votre tournoi.<br />
|
||||
Vous recevez ce message (envoyé automatiquement) car vous êtes organisateur d'un des tournois du TFJM<sup>2</sup>.<br /><br />
|
||||
Un compte organisateur vous a été créé par l'un des administrateurs. Un mot de passe aléatoire vous a été attribué, mais que vous
|
||||
devez changer pour des raisons de sécurité sur le lien suivant :
|
||||
<a href="{URL_BASE}/connexion/reinitialiser_mdp/{TOKEN}">{URL_BASE}/connexion/reinitialiser_mdp/{TOKEN}</a><br />
|
||||
<br />
|
||||
Votre mot de passe est : <strong style="color: red; font-size: 18px;">{PASSWORD}</strong><br />
|
||||
<br />
|
||||
Notez bien que ce mot de passe est temporaire, et pour des raisons de sécurité vous devrez le changer lors de votre prochaine connexion sur le site.<br />
|
||||
Une fois le mot de passe changé, vous pourrez vous <a href="{URL_BASE}/connexion">connecter sur la plateforme</a>.<br />
|
||||
<br />
|
||||
Merci beaucoup pour votre aide !<br />
|
||||
<br />
|
||||
|
Loading…
Reference in New Issue
Block a user