Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,39 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (5.1.2)
actionpack (= 5.1.2)
actioncable (5.1.4)
actionpack (= 5.1.4)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.2)
actionpack (= 5.1.2)
actionview (= 5.1.2)
activejob (= 5.1.2)
actionmailer (5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
activejob (= 5.1.4)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.1.2)
actionview (= 5.1.2)
activesupport (= 5.1.2)
actionpack (5.1.4)
actionview (= 5.1.4)
activesupport (= 5.1.4)
rack (~> 2.0)
rack-test (~> 0.6.3)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.1.2)
activesupport (= 5.1.2)
actionview (5.1.4)
activesupport (= 5.1.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.1.2)
activesupport (= 5.1.2)
activejob (5.1.4)
activesupport (= 5.1.4)
globalid (>= 0.3.6)
activemodel (5.1.2)
activesupport (= 5.1.2)
activerecord (5.1.2)
activemodel (= 5.1.2)
activesupport (= 5.1.2)
activemodel (5.1.4)
activesupport (= 5.1.4)
activerecord (5.1.4)
activemodel (= 5.1.4)
activesupport (= 5.1.4)
arel (~> 8.0)
activesupport (5.1.2)
activesupport (5.1.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
Expand Down Expand Up @@ -75,28 +75,28 @@ GEM
mini_portile2 (~> 2.2.0)
orm_adapter (0.5.0)
rack (2.0.3)
rack-test (0.6.3)
rack (>= 1.0)
rails (5.1.2)
actioncable (= 5.1.2)
actionmailer (= 5.1.2)
actionpack (= 5.1.2)
actionview (= 5.1.2)
activejob (= 5.1.2)
activemodel (= 5.1.2)
activerecord (= 5.1.2)
activesupport (= 5.1.2)
bundler (>= 1.3.0, < 2.0)
railties (= 5.1.2)
rack-test (0.7.0)
rack (>= 1.0, < 3)
rails (5.1.4)
actioncable (= 5.1.4)
actionmailer (= 5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
activejob (= 5.1.4)
activemodel (= 5.1.4)
activerecord (= 5.1.4)
activesupport (= 5.1.4)
bundler (>= 1.3.0)
railties (= 5.1.4)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
railties (5.1.2)
actionpack (= 5.1.2)
activesupport (= 5.1.2)
railties (5.1.4)
actionpack (= 5.1.4)
activesupport (= 5.1.4)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
Expand All @@ -107,12 +107,12 @@ GEM
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.0)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
thor (0.19.4)
thor (0.20.0)
thread_safe (0.3.6)
tzinfo (1.2.3)
thread_safe (~> 0.1)
Expand All @@ -132,4 +132,4 @@ DEPENDENCIES
sqlite3

BUNDLED WITH
1.15.3
1.16.0.pre.1
3 changes: 2 additions & 1 deletion lib/devise/uncommon_password/model.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

module Devise
module Models
# The UncommonPassword module adds a new validation for Devise Models.
Expand Down Expand Up @@ -26,7 +27,7 @@ def self.common_passwords

def not_common_password
if Devise::Models::UncommonPassword.common_passwords.include? password.downcase
errors.add(:password, "is a very common password. Please choose something harder to guess.")
errors.add(:password, I18n.t('errors.messages.common_password'))
end
end
end
Expand Down
6 changes: 5 additions & 1 deletion test/devise/uncommon_password_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ class Devise::UncommonPassword::Test < ActiveSupport::TestCase
password = passwords.first.upcase
user = User.create email:"example@example.org", password: password, password_confirmation: password
assert_not user.valid?, "Uppercase common passwords shoud not be valid."
assert_equal ["is a very common password. Please choose something harder to guess."], user.errors[:password]
assert_equal [def not_common_password
if Devise::Models::UncommonPassword.common_passwords.include? password.downcase
errors.add(:password, I18n.t('errors.messages.common_password')
end
end], user.errors[:password]
end

test "should accept validation for an uncommon password" do
Expand Down