more changes to register since misleading errors and disabled resubmitting the form when username is already taken and when password confirmation is wrong

This commit is contained in:
Mario 2023-01-26 18:26:38 +02:00 committed by GitHub
parent b8253c425f
commit 8923aaacaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,11 @@ if(isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['pass'];
$passwordconfirm = $_POST['passconfirm'];
echo '<script>
if ( window.history.replaceState ) {
window.history.replaceState( null, null, window.location.href );
}
</script>';
$user = new User($con, $user->getID($con, $username));
if ($password == $passwordconfirm) {
$passwordconfirmiswrong = false;
@ -69,7 +74,7 @@ $thefunfact = json_decode($result);
} else {
echo "form-control form-control-sm";
} ?>" type="text" placeholder="Your username" id="inputSmall" for="inputValid" name="username">
<?php if($userexists == true) { echo '<div class="invalid-feedback" bis_skin_checked="1">Password Confirmation field is invalid.</div>'; } ?>
<?php if($userexists == true) { echo '<div class="invalid-feedback" bis_skin_checked="1">Username is already taken.</div>'; } ?>
<label class="col-form-label col-form-label-sm mt-4 password text-light" for="inputSmall">Password</label>
<input class="<?php if($passwordconfirmiswrong == true) {
echo "form-control is-invalid";