devise-uncommon_password 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fcf2e96ea2a94925642769c30cd3b8c544f4b95658e5b7ba298a6d7cdc1f157b
4
- data.tar.gz: 41a1c64bda50b4c77ee9f9ac29915fceec1d97a141c95ea8afeb1a40d6d42ca7
3
+ metadata.gz: 5c7f79f3899e83a01351cf9eca77965b763ad9091b3119723818ab5c405724e5
4
+ data.tar.gz: 6fa5690a6dee123a91331110ba4c34e1dbf2bbaa8ac2f2501a23199e9870d68b
5
5
  SHA512:
6
- metadata.gz: 33902ba370816fe64871afcfc01f3fe72c2d28fcf83d350009322565800d4fc310d5b8e554aed3e717658c65a52e5678db00a8bbc2b785f5c421c2a6f31d2dc0
7
- data.tar.gz: 7d37d75caf3d3941e231ef54e600da32a33387e6091373f5c346781e30c1b00fafd6c5b7e7fb4b5ee10497f550e884be93a0123c04f33a316644ed699fdd20ea
6
+ metadata.gz: 07d1607d4933f54d01abb2425acc87359a040dd11aa13e8fdec15cbbaecbe109f3ef3ea12993915bfdc08039088686a7eaaebfafd7b6d926c18ef973e7f2fdbe
7
+ data.tar.gz: 468adc1e4cb81b29e78bac9d7699461ebff55835d22ef14df6c0d077e47e2ce0b4504d15ca14046c4b9784d1c69496739f4e6443483c307f90b334bc6bc8673f
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/HCLarsen/devise-uncommon_password.svg?branch=master)](https://travis-ci.org/HCLarsen/devise-uncommon_password)
4
4
  [![Code Climate](https://codeclimate.com/github/HCLarsen/devise-uncommon_password.svg)](https://codeclimate.com/github/HCLarsen/devise-uncommon_password)
5
5
 
6
- Devise::UncommonPassword is an extension for the devise gem, which prevents users from signing up using one of the 100 most common passwords. The list is derived from the darkweb2017_top10K.txt found at: https://github.com/danielmiessler/SecLists/tree/master/Passwords.
6
+ Devise::UncommonPassword is an extension for the [devise](https://github.com/heartcombo/devise) gem, which prevents users from signing up using one of the 100 most common passwords. The list is derived from the darkweb2017_top10K.txt found at: https://github.com/danielmiessler/SecLists/tree/master/Passwords.
7
7
 
8
8
  ## Usage
9
9
 
@@ -23,6 +23,23 @@ By default, the password is checked against the 100 most common passwords that f
23
23
  config.password_matches = 1000
24
24
  ```
25
25
 
26
+ ### Internationalization and Customization
27
+
28
+ The default message for users who attempt to use a common password is:
29
+
30
+ ```
31
+ is a very common password. Please choose something harder to guess.
32
+ ```
33
+
34
+ This can be changed by modifying the `devise.en.yml` file, under errors/messages/common_password. Translations can be provided using the devise translation files in the same location.
35
+
36
+ ```yml
37
+ en:
38
+ errors:
39
+ messages:
40
+ common_password: 'is a very common password. Please choose something harder to guess.'
41
+ ```
42
+
26
43
  ## Installation
27
44
  Add this line to your application's Gemfile:
28
45
 
@@ -8,4 +8,7 @@ module Devise
8
8
  end
9
9
  end
10
10
 
11
+ # Load default I18n
12
+ I18n.load_path.unshift File.join(File.dirname(__FILE__), *%w[uncommon_password locales en.yml])
13
+
11
14
  Devise.add_module :uncommon_password, model: "devise_uncommon_password/model"
@@ -0,0 +1,4 @@
1
+ en:
2
+ errors:
3
+ messages:
4
+ common_password: 'is a very common password. Please choose something harder to guess.'
@@ -16,7 +16,6 @@ module Devise
16
16
  file.each { |password| passwords << password.chomp.downcase }
17
17
  end
18
18
  passwords.select! {|password| Devise.password_length.include? password.length }
19
- #passwords[0..99]
20
19
  passwords[0..Devise.password_matches-1]
21
20
  end
22
21
 
@@ -32,7 +31,7 @@ module Devise
32
31
 
33
32
  def not_common_password
34
33
  if Devise::Models::UncommonPassword.common_passwords.include? password.downcase
35
- errors.add(:password, "is a very common password. Please choose something harder to guess.")
34
+ errors.add(:password, :common_password)
36
35
  end
37
36
  end
38
37
  end
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module UncommonPassword
3
- VERSION = '0.3.6'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise-uncommon_password
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-30 00:00:00.000000000 Z
11
+ date: 2020-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -81,6 +81,7 @@ files:
81
81
  - README.md
82
82
  - Rakefile
83
83
  - lib/devise/uncommon_password.rb
84
+ - lib/devise/uncommon_password/locales/en.yml
84
85
  - lib/devise/uncommon_password/model.rb
85
86
  - lib/devise/uncommon_password/passwords.txt
86
87
  - lib/devise/uncommon_password/version.rb