toolrack 0.9.1 → 0.9.2
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 +4 -4
- data/lib/toolrack/password_utils.rb +7 -16
- data/lib/toolrack/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2252d8ade57bb6f6bb8792c05eafdd148e6949f0ba161232f28cad4deba98d0
|
4
|
+
data.tar.gz: 10f5349171d87a626c13e6a84c990eadf64f03c772f68ef439194a3f7fbc6aa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/toolrack/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2021-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tlogger
|