A5.php/resources/views/register.blade.php

67 lines
2.8 KiB
PHP

<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<title>Register</title>
</head>
<body class="d-flex justify-content-center align-items-center" style="height: 75vh;">
<div class="page-wrapper w-50">
<form action="/register" method="POST">
@csrf
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="email" class="form-control" id="email" name="email" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" oninput="validatePassword()" class="form-control" id="password" name="password" required>
</div>
<div class="mb-3">
<label for="vpassword" class="form-label">Confirm Password</label>
<input type="password" oninput="validatePassword()" class="form-control" id="vpassword" required>
</div>
<div class="controls d-flex flex-column">
<p id="error" class="visually-hidden text-danger"></p>
<a href="/">Login</a>
<button type="submit" class="btn btn-primary mt-2 " id="submit">Submit</button>
</div>
</form>
</div>
<script>
const pass = document.getElementById("password");
const vpass = document.getElementById("vpassword");
const errorText = document.getElementById("error");
const submit = document.getElementById("submit");
function validatePassword() {
if (pass.value !== vpass.value) {
submit.setAttribute("disabled", "true");
errorText.classList.remove("visually-hidden");
errorText.innerText = "Password's do not match."
} else {
submit.removeAttribute("disabled");
errorText.classList.add("visually-hidden");
errorText.innerText = "";
}
}
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous">
</script>
</body>
</html>