diff --git a/server_files/classes/User.php b/server_files/classes/User.php index 4a4845f..6af19d2 100644 --- a/server_files/classes/User.php +++ b/server_files/classes/User.php @@ -240,7 +240,7 @@ class User { global $DB; $this->receive_animath_mails = $receive_animath_mails; - $DB->prepare("UPDATE `users` SET `receive_animath_mails` = ? WHERE `id` = ?;")->execute([$receive_animath_mails, $this->getId()]); + $DB->prepare("UPDATE `users` SET `receive_animath_mails` = ? WHERE `id` = ?;")->execute([$receive_animath_mails ? 1 : 0, $this->getId()]); } public function getAllDocuments($problem) diff --git a/server_files/controllers/mon_compte.php b/server_files/controllers/mon_compte.php index a44755b..988600e 100644 --- a/server_files/controllers/mon_compte.php +++ b/server_files/controllers/mon_compte.php @@ -9,7 +9,7 @@ $user = $_SESSION["user"]; $has_error = false; $error_message = null; -if (isset($_POST["update_team"])) { +if (isset($_POST["update_account"])) { $my_account = new MyAccount($_POST); try { $my_account->makeVerifications(); @@ -21,7 +21,7 @@ if (isset($_POST["update_team"])) { } } -if (isset($_POST["submitted_password"])) { +if (isset($_POST["update_password"])) { $new_password = new NewPassword($_POST); try { $new_password->makeVerifications(); @@ -59,6 +59,8 @@ class MyAccount foreach ($keys as $key) $this->$key = $this->$key != null && $this->$key != "" ? $this->$key : $this->user->$key; + + $this->receive_animath_mails = $this->receive_animath_mails == "on"; } public function makeVerifications() diff --git a/server_files/views/ajouter_admin.php b/server_files/views/ajouter_admin.php index c702282..6adc058 100644 --- a/server_files/views/ajouter_admin.php +++ b/server_files/views/ajouter_admin.php @@ -1,7 +1,12 @@ -if (isset($admin) && !$has_error) { ?> +