diff --git a/CSS/Element/button.css b/CSS/Element/button.css
index 3bbb93c..34d3ebd 100644
--- a/CSS/Element/button.css
+++ b/CSS/Element/button.css
@@ -1,3 +1,10 @@
+.buttons-container{
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: 10px;
+}
+
.btn{
padding: 5px 10px;
font-weight: var(--font-weight-semibold);
@@ -7,6 +14,7 @@
display: flex;
flex-direction: row;
align-items: center;
+ cursor: pointer;
}
.btn-primary {
@@ -27,6 +35,18 @@
aspect-ratio: 1/1;
}
+.btn-form{
+ padding: 10px 20px;
+}
+
+.btn-login{
+ background-color: transparent;
+}
+
.btn-user > span {
font-size: 28px;
}
+
+.btn-logout{
+ background-color: red;
+}
diff --git a/CSS/style.css b/CSS/style.css
index 2f2d81e..3634670 100644
--- a/CSS/style.css
+++ b/CSS/style.css
@@ -1,4 +1,5 @@
@import url(variables.css);
+@import url(style_columns.css);
@import url(Block/header.css);
@import url(Block/footer.css);
@import url(Element/logo.css);
@@ -36,7 +37,6 @@ h2 {
main {
margin-top: 190px;
- padding: 10px;
}
.msg {
diff --git a/CSS/style_columns.css b/CSS/style_columns.css
index 6c03506..57026a6 100644
--- a/CSS/style_columns.css
+++ b/CSS/style_columns.css
@@ -6,6 +6,12 @@
/*** 12 spaltiges Grid mit Flexboxen ***/
/*** Container ***/
+
+.container{
+ max-width: 90%;
+ padding: 24px 42px 24px 42px;
+}
+
.row {
display: flex;
flex-flow: row;
diff --git a/Controller/UserController.php b/Controller/UserController.php
index 46512de..4904508 100644
--- a/Controller/UserController.php
+++ b/Controller/UserController.php
@@ -10,13 +10,32 @@ class UserController{
private $validData = array();
private $errors = array();
+ private $labels = [
+ "name" => "Vorname*",
+ "lastname" => "Nachname*",
+ "email" => "E-Mail*",
+ "password" => "Passwort*",
+ "role" => "Rolle*"
+ ];
+
+ private $validLoginData = array();
+ private $loginErrors = array();
+ private $loginLabels = [
+ "email" => "E-Mail*",
+ "password" => "Passwort*",
+ ];
+
public function __construct($view){
$this->db = new UserModel();
$this->view = $view;
}
public function showUserRegisterForm(){
-
+ $this->view->setVars([
+ 'labels' => $this->labels,
+ 'errors' => $this->errors,
+ 'validData' => $this->validData
+ ]);
}
public function showUserRegisterConfirmation(){
@@ -24,7 +43,45 @@ class UserController{
}
public function showUserLoginForm(){
+ $this->view->setVars([
+ 'labels' => $this->loginLabels,
+ 'errors' => $this->loginErrors,
+ 'validData' => $this->validLoginData
+ ]);
+ }
+ private function validateForm() {
+ foreach ($this->labels as $key => $label) {
+ if (!isset($_POST[$key]) || trim($_POST[$key]) === '') {
+ $this->errors[$key] = "Bitte $label angeben";
+ } else {
+ $this->validData[$key] = trim($_POST[$key]);
+ }
+ }
+
+ if (isset($this->validData['password'])) {
+ if (strlen($this->validData['password']) < 6) {
+ $this->errors['password'] = "Das Passwort muss mindestens 6 Zeichen lang sein.";
+ }
+ }
+
+ if (isset($this->validData['email']) && !filter_var($this->validData['email'], FILTER_VALIDATE_EMAIL)) {
+ $this->errors['email'] = "Bitte eine gültige E-Mail-Adresse eingeben.";
+ }
+ }
+
+ public function validateLoginForm(){
+ foreach ($this->loginLabels as $key => $label) {
+ if (isset($this->validData['password'])) {
+ if (strlen($this->validData['password']) < 6) {
+ $this->errors['password'] = "Das Passwort muss mindestens 6 Zeichen lang sein.";
+ }
+ }
+
+ if (isset($this->validData['email']) && !filter_var($this->validData['email'], FILTER_VALIDATE_EMAIL)) {
+ $this->errors['email'] = "Bitte eine gültige E-Mail-Adresse eingeben.";
+ }
+ }
}
public function showUserLoginConfirmation(){
@@ -73,7 +130,8 @@ class UserController{
public function logout(){
$this->clearUserSession();
- echo "Erfolgreich ausgeloggt";
+ header("Location: index.php?controller=user&do=showUserLoginForm");
+ exit();
}
public function isUserLoggenIn(){
@@ -83,4 +141,8 @@ class UserController{
public function getCurrentUserId(){
return $_SESSION["user_id"] ?? null;
}
+
+ public function showUserAccountPage (){
+
+ }
}
\ No newline at end of file
diff --git a/Views/Admin/showForm.phtml b/Views/Admin/showForm.phtml
index 2b7b1db..e66b63a 100644
--- a/Views/Admin/showForm.phtml
+++ b/Views/Admin/showForm.phtml
@@ -29,6 +29,7 @@ foreach ($labels as $key => $value) {
-
+
+
\ No newline at end of file
diff --git a/Views/User/showUserAccountPage.phtml b/Views/User/showUserAccountPage.phtml
new file mode 100644
index 0000000..80b531e
--- /dev/null
+++ b/Views/User/showUserAccountPage.phtml
@@ -0,0 +1,17 @@
+
+
+