toolrack 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 571e36485e6a124ee83052bd40d53b1612973e3f7636bf8432ae5d4d4f641f35
4
- data.tar.gz: 7042d576dec084cc3eccbbb49e74c2ff8e7175d4e69c3ddb2fe9027b7a65d0cd
3
+ metadata.gz: e2252d8ade57bb6f6bb8792c05eafdd148e6949f0ba161232f28cad4deba98d0
4
+ data.tar.gz: 10f5349171d87a626c13e6a84c990eadf64f03c772f68ef439194a3f7fbc6aa5
5
5
  SHA512:
6
- metadata.gz: 32a5ebec97858317a3a500db4e2bd315a80e67bee888b302fc45ff0aacd46749b77c25b9485d3faf6588fe0efbb1a72041a731366809dd8471fe73c1aa16437e
7
- data.tar.gz: e76ec4875a11dbf84634e527a665492ec9665f55747ba6aaf5007b28cb92bd1ba682072c3186b218b87a8954f4623d64908ce0b4a406573b521fb62f36128b25
6
+ metadata.gz: 12e80e95f7326b95365df855b9b56ceb71663d31794e257b304fc1baf24df9144cad100a52bd3fc695347806dcc2173da0d80f9a6b5004c27cd480dfbb264367
7
+ data.tar.gz: 1b535e82f1c75c4bee974ed41f3c1d6f0705c352572a332cb2f4f4a670d4be77fb63fd2d68a15b8591ae626b6721f8473f4049d4a276aa21131da7eb15640ff3
@@ -1,18 +1,3 @@
1
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
- # Version 2, December 2004
3
- #
4
- # Copyright (C) 2021 Chris Liaw <chrisliaw@antrapol.com>
5
- # Author: Chris Liaw <chrisliaw@antrapol.com>
6
- #
7
- # Everyone is permitted to copy and distribute verbatim or modified
8
- # copies of this license document, and changing it is allowed as long
9
- # as the name is changed.
10
- #
11
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
12
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
13
- #
14
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
15
-
16
1
 
17
2
  require 'securerandom'
18
3
 
@@ -20,6 +5,8 @@ module Antrapol
20
5
  module ToolRack
21
6
  module PasswordUtils
22
7
  include Antrapol::ToolRack::ConditionUtils
8
+
9
+ class PasswordUtilsError < StandardError; end
23
10
 
24
11
  # complexity
25
12
  # 1 : lowercase alphabet
@@ -27,7 +14,8 @@ module Antrapol
27
14
  # 3 : lower + upper + number
28
15
  # 4 : lower + upper + number + symbol
29
16
  def generate_random_password(length = 12, opts = { complexity: 4, enforce_quality: true })
30
-
17
+
18
+
31
19
  length = 12 if is_empty?(length)
32
20
  length = length.to_i
33
21
  length = 12 if length <= 0
@@ -36,6 +24,9 @@ module Antrapol
36
24
 
37
25
  if not_empty?(opts)
38
26
  complexity = opts[:complexity] || 4
27
+
28
+ raise PasswordUtilsError, "Password length too short but complexity too high. Not able generate the password with required complexity." if length <= complexity
29
+
39
30
  enforce_quality = opts[:enforce_quality] || true
40
31
  end
41
32
 
@@ -1,6 +1,6 @@
1
1
  module Antrapol
2
2
  module ToolRack
3
- VERSION = "0.9.1"
3
+ VERSION = "0.9.2"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toolrack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-09 00:00:00.000000000 Z
11
+ date: 2021-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tlogger