password_strength 1.1.0 → 1.1.1

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
  SHA1:
3
- metadata.gz: afd2978e12b6d6980a1bdd21811b7804f417df7e
4
- data.tar.gz: bcb325941e94e8885d0b01c12da7339ff3a6d733
3
+ metadata.gz: e2fa304fc47ccd30db833384a5ad819f202b7a6b
4
+ data.tar.gz: 8e480804a0dc165ca2a31d4512a64aa1e9438722
5
5
  SHA512:
6
- metadata.gz: b78bd8239f550d05f4afb26c517f3d90ef6f9c04ce1070201ed4dd35d55930a3efdacdaaed7187a2905eda1283f85d9482f326b3e87e76eef6d9d1077253d2b4
7
- data.tar.gz: 6cae48bb42591bf3545e34f0296822fa710ba09e890edbea2c28d3d458fca284282033c766fabe13aa84875efbe49a69828e37bb7bbb09fe46c2e24af2d4da71
6
+ metadata.gz: e3cb592bb95b7ed5940909325281583c9bcb140f0c85482155d8db49275897595b0a01dea1ada56343c006155cc44b3d95949f250bb4a2292de1ce903ac627cf
7
+ data.tar.gz: 4b61dc10372e6eb6f49203af948b3afc057becb8dbb4f4e48e423a4f9c2d33e2476aa4f656cacf7b51a5791a600cfc44aea2476efbb3d51868401bf559a2ef98
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ doc
4
4
  /gemfiles/*.lock
5
5
  /node_modules
6
6
  Gemfile.lock
7
+ *.log
@@ -5,7 +5,7 @@
5
5
  var SYMBOL_RE = /[!@#\$%^&*?_~]/;
6
6
 
7
7
  function escapeForRegexp(string) {
8
- return string.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
8
+ return (string || "").replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
9
9
  }
10
10
 
11
11
  function PasswordStrength() {
@@ -189,6 +189,11 @@
189
189
 
190
190
  PasswordStrength.fn.containInvalidRepetition = function() {
191
191
  var char = this.password[0];
192
+
193
+ if (!char) {
194
+ return;
195
+ }
196
+
192
197
  var regex = new RegExp("^" + escapeForRegexp(char) + "+$", "i");
193
198
 
194
199
  return regex.test(this.password);
@@ -227,6 +227,7 @@ module PasswordStrength
227
227
 
228
228
  def contain_invalid_repetion?
229
229
  char = password.to_s.chars.first
230
+ return unless char
230
231
  regex = /^#{Regexp.escape(char)}+$/i
231
232
  password.to_s =~ regex
232
233
  end
@@ -2,7 +2,7 @@ module PasswordStrength
2
2
  module Version # :nodoc: all
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
@@ -1,11 +1,15 @@
1
1
  {
2
- "name": "password_strength",
3
- "version": "1.1.0",
2
+ "name": "password__strength",
3
+ "version": "1.1.1",
4
4
  "repository": "http://github.com/fnando/password_strength",
5
5
  "license": "MIT",
6
6
  "main": "app/assets/javascripts/password_strength.js",
7
7
  "devDependencies": {
8
8
  "jquery": "^2.1.4",
9
9
  "qunitjs": "^1.20.0"
10
- }
10
+ },
11
+ "files": [
12
+ "app/assets/javascripts/jquery_strength.js",
13
+ "app/assets/javascripts/password_strength.js"
14
+ ]
11
15
  }
@@ -16,6 +16,13 @@ QUnit.test("shortcut", function(assert) {
16
16
  assert.ok(strength.status);
17
17
  });
18
18
 
19
+ QUnit.test("deal with empty password", function(assert) {
20
+ strength = PasswordStrength.test("johndoe", "");
21
+
22
+ assert.equal(strength.status, "weak");
23
+ assert.ok(strength.isWeak());
24
+ });
25
+
19
26
  QUnit.test("detect good strength", function(assert) {
20
27
  strength.status = "good";
21
28
 
@@ -13,6 +13,12 @@ class TestPasswordStrength < Minitest::Test
13
13
  assert_equal "mypass", @strength.password
14
14
  end
15
15
 
16
+ def test_deal_with_empty_password
17
+ @strength = PasswordStrength.test("johndoe", "")
18
+ assert @strength.weak?
19
+
20
+ end
21
+
16
22
  def test_good_strength
17
23
  @strength.instance_variable_set("@status", :good)
18
24
  assert @strength.good?
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: password_strength
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-17 00:00:00.000000000 Z
11
+ date: 2015-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel