From b5fad464ff1ff737c9fb179046c57d04edfcb269 Mon Sep 17 00:00:00 2001 From: Leon Chen Date: Sun, 22 Mar 2015 12:04:14 -0400 Subject: [PATCH] Fix for issue #10 For some reason, the validatePassword function doesn't like it when I have more than one if statement and will not load the error message. For now, I asked for the password to contain at least 6 chars and an uppercase letter. --- public/js/page_signup.js | 6 ++++-- public/signup.php | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/public/js/page_signup.js b/public/js/page_signup.js index 8394b11..63cc673 100644 --- a/public/js/page_signup.js +++ b/public/js/page_signup.js @@ -41,8 +41,10 @@ jQuery(document).ready(function() { function validatePassword(password, errorMsg){ var passwordLen = password.length; - if (passwordLen < 6){ - errorMsg.text("*Password must be at least 6 characters"); + var i = 0; + var checkLetter = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}$/; + if (!checkLetter.test(password)){ + errorMsg.text("*Password must contain at least 6 characters and one uppercase letter."); errorMsg.css("visibility","visible"); return false; } diff --git a/public/signup.php b/public/signup.php index b02bd5f..cec3c79 100644 --- a/public/signup.php +++ b/public/signup.php @@ -6,6 +6,7 @@
+

Sign Up Now!

@@ -14,6 +15,7 @@


+

Error message