Added: Signin Up, connection to the DB, validator, base controller, base view, environment file, User model

This commit is contained in:
2024-12-26 02:00:33 +01:00
parent d7b8aba072
commit 5bca9b12aa
9 changed files with 338 additions and 27 deletions

View File

@ -1,11 +1,33 @@
<section class="signup">
<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">
<label for="password-2">Password again</label>
<input type="password" name="password-2" id="password-2">
<input type="submit" value="Sign Up" id="submit-signup">
</form>
<?php if ($this->get('error')): ?>
<div class="error"><?= $this->get('error') ?></div>
<?php endif; ?>
<form action="/auth/signup" method="POST">
<label for="username">Username</label>
<input type="text" name="username" id="username" value="<?= htmlspecialchars($_POST['username'] ?? '') ?>" required>
<?php if (isset($this->get('validationErrors')['username'])): ?>
<small class="error"><?= $this->get('validationErrors')['username'] ?></small>
<?php endif; ?>
<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; ?>
<label for="password-2">Password again</label>
<input type="password" name="password-2" id="password-2" required>
<?php if (isset($this->get('validationErrors')['password_confirmation'])): ?>
<small class="error"><?= $this->get('validationErrors')['password_confirmation'] ?></small>
<?php endif; ?>
<input type="submit" value="Sign Up">
</form>
</section>