diff --git a/CSS/style_columns.css b/CSS/style_columns.css index 4541368..21a3dd6 100644 --- a/CSS/style_columns.css +++ b/CSS/style_columns.css @@ -11,6 +11,7 @@ max-width: 90%; padding: 24px 42px 24px 42px; margin: 0 auto; + color: var(--brand-white); } .row { diff --git a/Controller/UserController.php b/Controller/UserController.php index 368b018..f35db59 100644 --- a/Controller/UserController.php +++ b/Controller/UserController.php @@ -147,7 +147,7 @@ class UserController{ } public function clearUserSession(){ - unset($_SESSION["user_id"], $_SESSION["user_role"]); + unset($_SESSION["user_id"], $_SESSION["user_role"], $_SESSION["vorname"], $_SESSION["name"]); } public function logout(){ @@ -167,4 +167,28 @@ class UserController{ public function showUserAccountPage (){ } + + public function showUserDeleteConfirmation(){ + + } + + public function deleteAccount(){ + $userId = $_SESSION["user_id"] ?? ""; + if($userId){ + $this->db->deleteUser($userId); + $this->clearUserSession(); + $this->view->setDoMethodName("showUserDeleteConfirmation"); + $this->showUserDeleteConfirmation(); + } + } + + public function changeAccountData(){ + $userId = $_SESSION["user_id"] ?? ""; + if($userId){ + $this->db->changeUserData($userId); + $this->setUserSession($user); + $this->view->setDoMethodName("showUserDeleteConfirmation"); + $this->showUserDeleteConfirmation(); + } + } } \ No newline at end of file diff --git a/Model/UserModel.php b/Model/UserModel.php index cf29689..8099c34 100644 --- a/Model/UserModel.php +++ b/Model/UserModel.php @@ -59,4 +59,12 @@ class UserModel extends Database return $sth->fetch(); } + public function deleteUser($id){ + $pdo = $this->linkDB(); + $sql = "DELETE FROM user WHERE id = :id"; + $sth = $pdo->prepare($sql); + $sth->bindParam(":id", $id); + $sth->execute(); + } + } \ No newline at end of file diff --git a/Views/User/showUserAccountPage.phtml b/Views/User/showUserAccountPage.phtml index 80b531e..d75be5b 100644 --- a/Views/User/showUserAccountPage.phtml +++ b/Views/User/showUserAccountPage.phtml @@ -6,11 +6,28 @@