From 37304cc5a36ef6362a855678667dd7bf02e326a6 Mon Sep 17 00:00:00 2001
From: Lloyd Hilaiel <lloyd@hilaiel.com>
Date: Tue, 16 Aug 2011 14:17:26 +0300
Subject: [PATCH] update client to impose password restrictions

---
 .../static/dialog/controllers/createaccount_controller.js     | 4 +++-
 .../static/dialog/controllers/forgotpassword_controller.js    | 4 +++-
 browserid/static/dialog/views/create.ejs                      | 1 +
 browserid/static/dialog/views/forgotpassword.ejs              | 1 +
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/browserid/static/dialog/controllers/createaccount_controller.js b/browserid/static/dialog/controllers/createaccount_controller.js
index 50ba5cdb0..67e5d9b56 100644
--- a/browserid/static/dialog/controllers/createaccount_controller.js
+++ b/browserid/static/dialog/controllers/createaccount_controller.js
@@ -146,8 +146,10 @@
         } else {
           if (!pass) {
             self.find('#enter_a_password').show();
-          } else if (pass.length < 5) {
+          } else if (pass.length < 8) {
             self.find('#password_too_short').show();
+          } else if (pass.length > 80) {
+            self.find('#password_too_long').show();
           } else {
             self.find('#password_ok').show();
             $('#create_continue').removeClass('disabled');
diff --git a/browserid/static/dialog/controllers/forgotpassword_controller.js b/browserid/static/dialog/controllers/forgotpassword_controller.js
index e7037030c..0726de3b9 100644
--- a/browserid/static/dialog/controllers/forgotpassword_controller.js
+++ b/browserid/static/dialog/controllers/forgotpassword_controller.js
@@ -63,8 +63,10 @@
           } else {
             if (!pass) {
               self.find("#enter_a_password").show();
-            } else if (pass.length < 5) {
+            } else if (pass.length < 8) {
               self.find("#password_too_short").show();
+            } else if (pass.length > 80) {
+              self.find("#password_too_long").show();
             } else {
               self.find("#password_ok").show();
               $("#create_continue").removeClass("disabled");
diff --git a/browserid/static/dialog/views/create.ejs b/browserid/static/dialog/views/create.ejs
index 16b4c5884..14b29914b 100644
--- a/browserid/static/dialog/views/create.ejs
+++ b/browserid/static/dialog/views/create.ejs
@@ -17,6 +17,7 @@
       <span class="note passwordnote" id="enter_a_password"><span class="bad">Enter a password</span></span>
       <span class="note passwordnote" id="passwords_different" style="display:none;"><span class="bad">Passwords different</span></span>
       <span class="note passwordnote" id="password_too_short" style="display:none;"><span class="bad">Password too short</span></span>
+      <span class="note passwordnote" id="password_too_long" style="display:none;"><span class="bad">Password too long</span></span>
       <span class="note passwordnote" id="password_ok" style="display:none;"><span class="good">Password OK</span></span>
     </div>
     <div class="attention_lame" style="display:none;" id="emailinuse_message">
diff --git a/browserid/static/dialog/views/forgotpassword.ejs b/browserid/static/dialog/views/forgotpassword.ejs
index 9a038b93d..d9d7948b3 100644
--- a/browserid/static/dialog/views/forgotpassword.ejs
+++ b/browserid/static/dialog/views/forgotpassword.ejs
@@ -15,6 +15,7 @@
       <span class="note passwordnote" id="enter_a_password"><span class="bad">Enter a password</span></span>
       <span class="note passwordnote" id="passwords_different" style="display:none;"><span class="bad">Passwords different</span></span>
       <span class="note passwordnote" id="password_too_short" style="display:none;"><span class="bad">Password too short</span></span>
+      <span class="note passwordnote" id="password_too_long" style="display:none;"><span class="bad">Password too long</span></span>
       <span class="note passwordnote" id="password_ok" style="display:none;"><span class="good">Password OK</span></span>
     </div>
     <div class="attention_lame" style="display:none;" id="emailinuse_message">
-- 
GitLab