passwordValidator 0.0.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 +7 -0
- data/lib/passwordValidator.rb +33 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fed1fe73ed5a490502d1bbf228e7055268291dac6234150e5a227cf04700f1ff
|
4
|
+
data.tar.gz: aa67ee26c8d542ae32ceb4b34b1b727d15062b0a7f2967fc27b0d17d3bfdbebc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 40ee52f868721f8f76ffd3be4b0779ba4370b2e1fc1837e6f902938122a5a3d1a7ae484c9470e313dbecb0f3c09cd46c5f6a300ab9e8fe7e94714f2e284578a2
|
7
|
+
data.tar.gz: 7dfa4551a040961daa498402b75cddbcc648eb1789469db18804607f014e4626a658e070ea31bd2fef73fd3f33832c79d95c7edc1476e90fceab0b84582cb888
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'passwordValidator/version.rb'
|
2
|
+
|
3
|
+
class PasswordComplexity
|
4
|
+
attr_reader :password, :required_complexity
|
5
|
+
|
6
|
+
def initialize(password, required_complexity)
|
7
|
+
@password = password
|
8
|
+
@required_complexity = required_complexity
|
9
|
+
end
|
10
|
+
|
11
|
+
def valid?
|
12
|
+
score = has_uppercase_letters? + has_digits? + has_extra_chars? + has_downcase_letters?
|
13
|
+
score >= required_complexity
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def has_uppercase_letters?
|
19
|
+
password.match(/[A-Z]/) ? 1 : 0
|
20
|
+
end
|
21
|
+
|
22
|
+
def has_digits?
|
23
|
+
password.match(/\d/) ? 1 : 0
|
24
|
+
end
|
25
|
+
|
26
|
+
def has_extra_chars?
|
27
|
+
password.match(/\W/) ? 1 : 0
|
28
|
+
end
|
29
|
+
|
30
|
+
def has_downcase_letters?
|
31
|
+
password.match(/[a-z]{1}/) ? 1 : 0
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: passwordValidator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Priyesh Shah
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-11-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Verifies if the password meets the required complexity criteria. Returns
|
14
|
+
True if yes, False if no
|
15
|
+
email: shahpriyesh2005@yahoo.co.in
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/passwordValidator.rb
|
21
|
+
homepage: http://rubygems.org/gems/passwordValidator
|
22
|
+
licenses: []
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubygems_version: 3.0.3
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: Verifies if the password meets the required complexity criteria
|
43
|
+
test_files: []
|