sneed
This commit is contained in:
parent
82ba5ab897
commit
c6e7dd7aa3
2 changed files with 40 additions and 42 deletions
|
@ -641,45 +641,6 @@ $('#password-register').on('input', function () {
|
|||
|
||||
});
|
||||
|
||||
// Check username length, special chars
|
||||
|
||||
$('#username-register').on('input', function () {
|
||||
|
||||
var charCount = document.getElementById("username-register").value;
|
||||
var id = document.getElementById("usernameHelpRegister");
|
||||
var successID = document.getElementById("usernameHelpSuccess");
|
||||
|
||||
var ruqqusAPI = '/api/is_available/' + charCount;
|
||||
|
||||
if (charCount.length >= 3) {
|
||||
|
||||
$.getJSON(ruqqusAPI, function(result) {
|
||||
$.each(result, function(i, field) {
|
||||
if (field == false) {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">Username already taken :(';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (!/[^a-zA-Z0-9_\-$]/.test(charCount)) {
|
||||
// Change alert text
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-success mt-1">Username is a-okay!';
|
||||
|
||||
if (charCount.length < 3) {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-muted mt-1">Username must be at least 3 characters long.';
|
||||
}
|
||||
else if (charCount.length > 25) {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">Username must be 25 characters or less.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">No special characters or spaces allowed.</span>';
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
// Search Icon
|
||||
// Change navbar search icon when form is in focus, active states
|
||||
|
||||
|
|
|
@ -1,8 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
{% include "bootstrap.html" %}
|
||||
<script>
|
||||
// Check username length, special chars
|
||||
|
||||
$('#username-register').on('input', function () {
|
||||
|
||||
var charCount = document.getElementById("username-register").value;
|
||||
var id = document.getElementById("usernameHelpRegister");
|
||||
var successID = document.getElementById("usernameHelpSuccess");
|
||||
|
||||
var ruqqusAPI = '/api/is_available/' + charCount;
|
||||
|
||||
if (charCount.length >= 3) {
|
||||
|
||||
$.getJSON(ruqqusAPI, function(result) {
|
||||
$.each(result, function(i, field) {
|
||||
if (field == false) {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">Username already taken :(';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (!/[^a-zA-Z0-9_\-$]/.test(charCount)) {
|
||||
// Change alert text
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-success mt-1">Username is a-okay!';
|
||||
|
||||
if (charCount.length < 3) {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-muted mt-1">Username must be at least 3 characters long.';
|
||||
}
|
||||
else if (charCount.length > 25) {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">Username must be 25 characters or less.';
|
||||
}
|
||||
}
|
||||
else {
|
||||
id.innerHTML = '<span class="form-text font-weight-bold text-danger mt-1">No special characters or spaces allowed.</span>';
|
||||
};
|
||||
|
||||
});
|
||||
</script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="description" content="Sign up in under 27 seconds.">
|
||||
|
@ -162,8 +201,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{% include "bootstrap.html" %}
|
||||
|
||||
<!-- Drama JS -->
|
||||
|
||||
<script src="/assets/js/all_js.js"></script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue