Auth logic is completed (signin, signup, logout), Added: Middlewares, RequireAuth middleware

This commit is contained in:
2024-12-26 14:44:40 +01:00
parent 01b057986e
commit 4c44dac115
11 changed files with 112 additions and 31 deletions

View File

@ -1,9 +1,21 @@
<section class="signin">
<form>
<label for="username">Username</label>
<input type="text" name="username" id="username">
<label for="password">Password</label>
<input type="password" name="password" id="password">
<input type="submit" value="Sign In" id="submit-signin">
</form>
<?php if ($this->get('error')): ?>
<div class="error"><?= $this->get('error') ?></div>
<?php endif; ?>
<form action="/auth/signin" method="POST">
<label for="email">Email</label>
<input type="email" name="email" id="email" value="<?= htmlspecialchars($_POST['email'] ?? '') ?>" required>
<?php if (isset($this->get('validationErrors')['email'])): ?>
<small class="error"><?= $this->get('validationErrors')['email'] ?></small>
<?php endif; ?>
<label for="password">Password</label>
<input type="password" name="password" id="password" required>
<?php if (isset($this->get('validationErrors')['password'])): ?>
<small class="error"><?= $this->get('validationErrors')['password'] ?></small>
<?php endif; ?>
<input type="submit" value="Sign In">
</form>
</section>