Quelques modifications
This commit is contained in:
parent
70cece8694
commit
945e1105b8
|
@ -59,7 +59,7 @@ class NewTeam {
|
|||
$_SESSION["team"] = Team::fromTrigram($this->trigram);
|
||||
$_SESSION["user"]->setTeamId($_SESSION["team"]->getId());
|
||||
|
||||
sendAddTeam($_SESSION["user"], $_SESSION["team"], $this->tournament);
|
||||
sendAddTeamMail($_SESSION["user"], $_SESSION["team"], $this->tournament);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ class NewUser
|
|||
global $YEAR;
|
||||
|
||||
ensure(filter_var($this->email, FILTER_VALIDATE_EMAIL), "L'adresse e-mail entrée est invalide.");
|
||||
$this->email = strtolower($this->email);
|
||||
ensure(userExists($this->email), "Un compte existe déjà avec cette adresse e-mail.");
|
||||
ensure(strlen($this->password) >= 8, "Le mot de passe doit comporter au moins 8 caractères.");
|
||||
ensure($this->password == $this->confirm_password, "Les deux mots de passe sont différents.");
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
|
||||
if (isset($_POST["submitted"])) {
|
||||
$error_message = updateAccount();
|
||||
} elseif (isset($_POST["submitted_password"])) {
|
||||
$error_message = updatePassword();
|
||||
}
|
||||
|
||||
if (!isset($_SESSION["user_id"]))
|
||||
require_once "server_files/403.php";
|
||||
|
||||
/** @var User $user */
|
||||
$user = $_SESSION["user"];
|
||||
|
||||
if (isset($_POST["submitted"])) {
|
||||
$error_message = updateAccount();
|
||||
} elseif (isset($_POST["submitted_password"])) {
|
||||
$error_message = updatePassword();
|
||||
}
|
||||
|
||||
function updateAccount()
|
||||
{
|
||||
global $URL_BASE, $MAIL_ADDRESS, $user;
|
||||
|
|
|
@ -34,7 +34,7 @@ function sendRegisterMail($new_user)
|
|||
* @param $team Team
|
||||
* @param $tournament Tournament
|
||||
*/
|
||||
function sendAddTeam($user, $team, $tournament)
|
||||
function sendAddTeamMail($user, $team, $tournament)
|
||||
{
|
||||
global $LOCAL_PATH, $YEAR;
|
||||
|
||||
|
@ -45,4 +45,21 @@ function sendAddTeam($user, $team, $tournament)
|
|||
$content = preg_replace("#{TRIGRAM}#", $team->getTrigram(), $content);
|
||||
$content = preg_replace("#{TOURNAMENT_NAME}#", $tournament->getName(), $content);
|
||||
$content = preg_replace("#{ACCESS_CODE}#", $team->getAccessCode(), $content);
|
||||
|
||||
sendMail($user->getEmail(), "Ajout d'une équipe TFJM² $YEAR", $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param NewUser
|
||||
*/
|
||||
function sendAddOrganizerMail($new_orga)
|
||||
{
|
||||
global $LOCAL_PATH, $YEAR;
|
||||
|
||||
$content = file_get_contents("$LOCAL_PATH/server_files/services/mail_templates/add_organizer.html");
|
||||
$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);
|
||||
|
||||
sendMail($new_orga->email, "Inscription au TFJM² $YEAR", $content);
|
||||
}
|
Loading…
Reference in New Issue