Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#register").click(function() {
- var username = $("#register-username").val();
- var password = $("#register-password").val();
- var confirmPassword = $("#confirm-password").val();
- var data = {};
- if (/[a-zA-Z0-9_]+/.test(username) == false) {
- data = { type: "failure", info: "usernameInvalid" };
- } else if (/[a-zA-Z0-9_]+/.test(password) == false) {
- data = { type: "failure", info: "passwordInvalid" };
- } else {
- if (username.length >= 5) {
- if (password.length >= 6) {
- if (password == confirmPassword) {
- data = { type: "success", info: "registerSuccessful", user: username, password: password, confirm: confirmPassword };
- } else {
- data = { type: "failure", info: "passwordMismatch" };
- }
- } else {
- data = { type: "failure", info: "passwordLength" };
- }
- } else {
- data = { type: "failure", info: "usernameLength" };
- }
- }
- socket.emit("register", data);
- });
Add Comment
Please, Sign In to add comment