diff --git a/Public/signup.html b/Public/signup.html
index ac464dc..f35f3b9 100644
--- a/Public/signup.html
+++ b/Public/signup.html
@@ -10,14 +10,14 @@
diff --git a/Public/signup.js b/Public/signup.js
index 015db15..e28c09d 100644
--- a/Public/signup.js
+++ b/Public/signup.js
@@ -1,12 +1,24 @@
const username = document.getElementById("username");
const password = document.getElementById("password");
const confirmPass = document.getElementById("confirm-password");
+const submit = document.getElementById("submit");
+const form = document.getElementById("signup-form");
+submit.disabled = true;
-confirmPass.addEventListener('keyup',function(){
- if (this.value !== password.value){
+form.addEventListener('keyup',function(){
+ if (confirmPass.value !== password.value || validatePass(password.value) || username.value.length === 0){
+ submit.disabled = true;
console.log("can't submit yet");
} else {
console.log("matched");
+ submit.disabled = false;
}
-});
\ No newline at end of file
+});
+
+function validatePass(value) {
+ const pattern="(?=.*\d)(?=.*[a-z])(?=.*[!$%&(-/:-?_{}~])(?=.*[A-Z]).{9,}";
+ const regex = new RegExp(pattern);
+ console.log(regex.test(value));
+ return regex.test(value);
+}
\ No newline at end of file