Added requirement that usernames be exclusively alphanumeric
This commit is contained in:
parent
db06888ecb
commit
6329d96331
@ -56,7 +56,7 @@ try { // Try opening the SQL database connection
|
|||||||
<!-- THIS DIV IS FOR INPUT -->
|
<!-- THIS DIV IS FOR INPUT -->
|
||||||
<div id="textInputArea">
|
<div id="textInputArea">
|
||||||
<label for="username" class="inputLabel">Username:</label>
|
<label for="username" class="inputLabel">Username:</label>
|
||||||
<input type="text" id="username" name="username" class="newLine" maxlength="30" onchange="usernameConfirm()" tabindex="1">
|
<input type="text" id="username" name="username" class="newLine" maxlength="30" onchange="usernameConfirm()" tabindex="1" pattern="[a-zA-Z0-9]*" required>
|
||||||
<p id="confirmUsername"></p>
|
<p id="confirmUsername"></p>
|
||||||
<label for="password" class="inputLabel">Password:</label>
|
<label for="password" class="inputLabel">Password:</label>
|
||||||
<input type="password" id="password" name="password" required tabindex="1">
|
<input type="password" id="password" name="password" required tabindex="1">
|
||||||
|
@ -21,11 +21,16 @@ function verifyInput() {
|
|||||||
|
|
||||||
// Check if the username is filled out
|
// Check if the username is filled out
|
||||||
var username = document.forms["userForm"]["username"].value;
|
var username = document.forms["userForm"]["username"].value;
|
||||||
|
// Alert if not
|
||||||
if (username == "") {
|
if (username == "") {
|
||||||
alert ("Must enter a username!");
|
alert ("Must enter a username!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Check if the name is already taken
|
||||||
|
if (!usernameConfirm()) {
|
||||||
|
alert ("Username already taken!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if a password is required, if so, make sure one is entered
|
// Check if a password is required, if so, make sure one is entered
|
||||||
var password = document.forms["userForm"]["password"].value;
|
var password = document.forms["userForm"]["password"].value;
|
||||||
@ -46,10 +51,6 @@ function verifyInput() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!usernameConfirm()) {
|
|
||||||
alert ("Username already taken!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayPassword() {
|
function displayPassword() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user