From 91c96b3714a8f5753d9851ee8e2a859b201f6905 Mon Sep 17 00:00:00 2001 From: Patricio Cano Date: Wed, 22 Oct 2014 12:40:41 -0500 Subject: [PATCH] Added a password strength indicator to the reset password view and the change password view after first login. Updated JS to work with the updated views. --- app/assets/javascripts/password_strength.js.coffee | 11 ++++++----- app/views/devise/passwords/edit.html.haml | 4 ++-- app/views/profiles/passwords/new.html.haml | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/password_strength.js.coffee b/app/assets/javascripts/password_strength.js.coffee index e6fec307c59..61e25deac4c 100644 --- a/app/assets/javascripts/password_strength.js.coffee +++ b/app/assets/javascripts/password_strength.js.coffee @@ -15,10 +15,10 @@ $(document).ready -> profileOptions.rules = activated: overwritten_rules - signUpOptions = {} - signUpOptions.common = + deviseOptions = {} + deviseOptions.common = usernameField: "#user_username" - signUpOptions.ui = + deviseOptions.ui = container: "#password-strength" showPopover: true showErrors: true @@ -26,8 +26,9 @@ $(document).ready -> showProgressBar: false showStatus: true errorMessages: overwritten_messages - signUpOptions.rules = + deviseOptions.rules = activated: overwritten_rules $("#user_password").pwstrength profileOptions - $("#user_password_sign_up").pwstrength signUpOptions + $("#user_password_sign_up").pwstrength deviseOptions + $("#user_password_recover").pwstrength deviseOptions diff --git a/app/views/devise/passwords/edit.html.haml b/app/views/devise/passwords/edit.html.haml index 1326cc0aac9..f6cbf9b82ba 100644 --- a/app/views/devise/passwords/edit.html.haml +++ b/app/views/devise/passwords/edit.html.haml @@ -6,8 +6,8 @@ .devise-errors = devise_error_messages! = f.hidden_field :reset_password_token - %div - = f.password_field :password, class: "form-control top", placeholder: "New password", required: true + .form-group#password-strength + = f.password_field :password, class: "form-control top", id: "user_password_recover", placeholder: "New password", required: true %div = f.password_field :password_confirmation, class: "form-control bottom", placeholder: "Confirm new password", required: true .clearfix.append-bottom-10 diff --git a/app/views/profiles/passwords/new.html.haml b/app/views/profiles/passwords/new.html.haml index aef7348fd20..b52514668e3 100644 --- a/app/views/profiles/passwords/new.html.haml +++ b/app/views/profiles/passwords/new.html.haml @@ -14,7 +14,7 @@ .form-group = f.label :current_password, class: 'control-label' .col-sm-10= f.password_field :current_password, required: true, class: 'form-control' - .form-group + .form-group#password-strength = f.label :password, class: 'control-label' .col-sm-10= f.password_field :password, required: true, class: 'form-control' .form-group