summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/application.js.coffee1
-rw-r--r--app/assets/javascripts/password_strength.js.coffee1
-rw-r--r--app/views/profiles/passwords/edit.html.haml2
-rw-r--r--features/profile/profile.feature19
-rw-r--r--features/steps/profile/profile.rb34
5 files changed, 55 insertions, 2 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 493babad856..faf725109f5 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -18,7 +18,6 @@
#= require jquery.turbolinks
#= require turbolinks
#= require bootstrap
-#= require pwstrength-bootstrap-1.2.2
#= require password_strength
#= require select2
#= require raphael
diff --git a/app/assets/javascripts/password_strength.js.coffee b/app/assets/javascripts/password_strength.js.coffee
index 7f4a9180ae9..33b4d2e0f69 100644
--- a/app/assets/javascripts/password_strength.js.coffee
+++ b/app/assets/javascripts/password_strength.js.coffee
@@ -1,3 +1,4 @@
+#= require pwstrength-bootstrap-1.2.2
overwritten_messages =
wordSimilarToUsername: "Your password should not contain your username"
diff --git a/app/views/profiles/passwords/edit.html.haml b/app/views/profiles/passwords/edit.html.haml
index 8e84d312194..425200ff523 100644
--- a/app/views/profiles/passwords/edit.html.haml
+++ b/app/views/profiles/passwords/edit.html.haml
@@ -21,7 +21,7 @@
%div
= link_to "Forgot your password?", reset_profile_password_path, method: :put
- .form-group#password-strength
+ .form-group
= f.label :password, 'New password', class: 'control-label'
.col-sm-10
= f.password_field :password, required: true, class: 'form-control', id: 'user_password_profile'
diff --git a/features/profile/profile.feature b/features/profile/profile.feature
index d2125e013bc..d7fa370fe2a 100644
--- a/features/profile/profile.feature
+++ b/features/profile/profile.feature
@@ -83,3 +83,22 @@ Feature: Profile
Given I visit profile design page
When I change my code preview theme
Then I should receive feedback that the changes were saved
+
+ @javascript
+ Scenario: I see the password strength indicator
+ Given I visit profile password page
+ When I try to set a weak password
+ Then I should see the input field yellow
+
+ @javascript
+ Scenario: I see the password strength indicator error
+ Given I visit profile password page
+ When I try to set a short password
+ Then I should see the input field red
+ And I should see the password error message
+
+ @javascript
+ Scenario: I see the password strength indicator with success
+ Given I visit profile password page
+ When I try to set a strong password
+ Then I should see the input field green \ No newline at end of file
diff --git a/features/steps/profile/profile.rb b/features/steps/profile/profile.rb
index 7d3bea7878e..6d747b65bae 100644
--- a/features/steps/profile/profile.rb
+++ b/features/steps/profile/profile.rb
@@ -64,6 +64,24 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
end
end
+ step 'I try to set a weak password' do
+ within '.update-password' do
+ fill_in "user_password_profile", with: "22233344"
+ end
+ end
+
+ step 'I try to set a short password' do
+ within '.update-password' do
+ fill_in "user_password_profile", with: "short"
+ end
+ end
+
+ step 'I try to set a strong password' do
+ within '.update-password' do
+ fill_in "user_password_profile", with: "Itulvo9z8uud%$"
+ end
+ end
+
step 'I change my password' do
within '.update-password' do
fill_in "user_current_password", with: "12345678"
@@ -86,6 +104,22 @@ class Spinach::Features::Profile < Spinach::FeatureSteps
page.should have_content "You must provide a valid current password"
end
+ step 'I should see the input field yellow' do
+ page.should have_css 'div.has-warning'
+ end
+
+ step 'I should see the input field green' do
+ page.should have_css 'div.has-success'
+ end
+
+ step 'I should see the input field red' do
+ page.should have_css 'div.has-error'
+ end
+
+ step 'I should see the password error message' do
+ page.should have_content 'Your password is too short'
+ end
+
step "I should see a password error message" do
page.should have_content "Password confirmation doesn't match"
end