styles für register- und loginform hinzugefügt

This commit is contained in:
Illia Hromovoi 2025-07-02 10:57:26 +02:00
parent e7b3a062b7
commit 430d1b38c0
7 changed files with 110 additions and 67 deletions

View File

@ -13,6 +13,7 @@
color: var(--brand-white);
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
cursor: pointer;
}
@ -22,6 +23,11 @@
border-radius: 3px;
}
.btn-secondary{
background: var(--fullblock);
border-radius: 3px;
}
.btn-user {
border-radius: 9999px;
color: var(--brand-primary);

View File

@ -64,3 +64,26 @@ input, textarea {
margin-top: 5px;
}
.form-user{
justify-content: center!important;
grid-template-columns: auto!important;
}
/* fix radio buttons registration */
.input:nth-child(5){
flex-direction: row;
justify-content: space-between;
max-width: 290px;
align-items: center;
}
.input:nth-child(5) label{
display: flex;
flex-direction: row;
align-items: center;
gap: 10px;
}
.input:nth-child(5) label input{
margin-top: 0;
}

View File

@ -107,3 +107,7 @@ main {
text-decoration: none;
}
.paragraph{
font-size: var(--font-size-smalltext);
color: var(--brand-white);
}

View File

@ -87,17 +87,19 @@ class UserController{
public function showUserLoginConfirmation(){
$userId = $this->getCurrentUserId();
$user = null;
var_dump($user . "user");
if($userId){
$user = $this->db->getUserById($userId);
}
include 'Views/User/showUserLoginConfirmation.phtml';
$path = "Views/User/showUserLoginConfirmation.phtml";
if(file_exists($path)){
include $path;
}
}
public function register(){
$this->db->createUser($_POST);
$this->view->setDoMethodName("showUserRegisterConfirmation");
$this->showUserRegisterConfirmation();
$this->login();
}
public function login(){

View File

@ -2,16 +2,23 @@
include dirname(__DIR__).'/header.phtml';
?>
<?php if ($user): ?>
<p>Hallo, <?= htmlspecialchars($user['vorname']) ?> <?= htmlspecialchars($user['name']) ?>!</p>
<?php else: ?>
<p>Benutzerdaten konnten nicht geladen werden.</p>
<?php endif; ?>
<div class="container">
<div class="row">
<div class="col-12">
<h1>Erfolgreiche Anmeldung!</h1>
<h1>Sie haben sich erfolgreich angemeldet</h1>
<?php if ($user): ?>
<p class="paragraph">Hallo, <?= htmlspecialchars($user['vorname']) ?> <?= htmlspecialchars($user['name']) ?>!</p>
<div class="row" style="gap: 10px">
<a class="btn btn-primary" href="index.php">Unsere Kurse ansehen</a>
<a class="btn btn-secondaty" href="?controller=User&do=showUserAccountPage">Zu meinem Account</a>
</div>
<?php else: ?>
<p>Benutzerdaten konnten nicht geladen werden.</p>
<?php endif; ?>
<?php
include dirname(__DIR__).'/footer.phtml';
?>
</div>
</div>
</div>

View File

@ -2,32 +2,33 @@
include dirname(__DIR__).'/header.phtml';
?>
<h1>Als Benutzer anmelden</h1>
<div class="container">
<div class="row">
<div class="col-12">
<h1>Als Benutzer anmelden</h1>
<form method="post" class="form-grid">
<form method="post" class="form-grid form-user">
<?php foreach ($labels as $key => $label): ?>
<div class="input">
<label for="reg_<?= $key ?>"><?= $label ?></label>
<?php if ($key === 'password'): ?>
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>
<?php elseif($key === 'email'): ?>
<input type="email" name="<?= $key ?>" id="reg_<?= $key ?>" required>
<?php else: ?>
<input type="text" name="<?= $key ?>" id="reg_<?= $key ?>" value="<?= htmlspecialchars($validData[$key] ?? '') ?>" required>
<?php endif; ?>
<?php foreach ($labels as $key => $label): ?>
<div class="input">
<label for="reg_<?= $key ?>"><?= $label ?></label>
<?php if ($key === 'password'): ?>
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>
<?php elseif($key === 'email'): ?>
<input type="email" name="<?= $key ?>" id="reg_<?= $key ?>" required>
<?php else: ?>
<input type="text" name="<?= $key ?>" id="reg_<?= $key ?>" value="<?= htmlspecialchars($validData[$key] ?? '') ?>" required>
<?php endif; ?>
<?php if (!empty($errors[$key])): ?>
<div class="error"><?= $errors[$key] ?></div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php if (!empty($errors[$key])): ?>
<div class="error"><?= $errors[$key] ?></div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<input type="hidden" name="controller" value="user">
<input type="hidden" name="do" value="login">
<button type="submit" class="btn btn-primary btn-form" style="display: block">Login</button>
</form>
<input type="hidden" name="controller" value="user">
<input type="hidden" name="do" value="login">
<button type="submit" class="btn btn-primary btn-form" style="display: block">Login</button>
</form>
</div>
</div>
</div>

View File

@ -2,36 +2,36 @@
include dirname(__DIR__).'/header.phtml';
?>
<h1>Benutzer erstellen</h1>
<div class="container">
<div class="row">
<div class="col-12">
<h1>Benutzer erstellen</h1>
<form method="post" class="form-grid">
<form method="post" class="form-grid">
<?php foreach ($labels as $key => $label): ?>
<div class="input">
<label for="reg_<?= $key ?>"><?= $label ?></label>
<?php if ($key === 'password'): ?>
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>
<?php elseif ($key === 'role'): ?>
<label><input type="radio" name="role" value="user" <?= (isset($validData['role']) && $validData['role'] === 'user') ? 'checked' : '' ?>> User</label>
<label><input type="radio" name="role" value="leiter" <?= (isset($validData['role']) && $validData['role'] === 'leiter') ? 'checked' : '' ?>> Leiter</label>
<?php else: ?>
<input type="text" name="<?= $key ?>" id="reg_<?= $key ?>" value="<?= htmlspecialchars($validData[$key] ?? '') ?>" required>
<?php endif; ?>
<?php foreach ($labels as $key => $label): ?>
<div class="input">
<label for="reg_<?= $key ?>"><?= $label ?></label>
<?php if ($key === 'password'): ?>
<input type="password" name="<?= $key ?>" id="reg_<?= $key ?>" required>
<?php elseif ($key === 'role'): ?>
<label><input type="radio" name="role" value="user" required<?= (isset($validData['role']) && $validData['role'] === 'user') ? 'checked' : '' ?>> User</label>
<label><input type="radio" name="role" value="leiter" <?= (isset($validData['role']) && $validData['role'] === 'leiter') ? 'checked' : '' ?>> Leiter</label>
<?php else: ?>
<input type="text" name="<?= $key ?>" id="reg_<?= $key ?>" value="<?= htmlspecialchars($validData[$key] ?? '') ?>" required>
<?php endif; ?>
<?php if (!empty($errors[$key])): ?>
<div class="error"><?= $errors[$key] ?></div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php if (!empty($errors[$key])): ?>
<div class="error"><?= $errors[$key] ?></div>
<?php endif; ?>
</div>
<?php endforeach; ?>
<input type="hidden" name="controller" value="user">
<input type="hidden" name="do" value="register">
<input type="hidden" name="controller" value="user">
<input type="hidden" name="do" value="register">
<button type="submit" class="btn">Registrieren</button>
</form>
<?php
include dirname(__DIR__).'/footer.phtml';
?>
<button type="submit" class="btn btn-primary btn-form">Registrieren</button>
</form>
</div>
</div>
</div>