cop-detective 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cop_detective.rb +2 -2
- data/lib/validator.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b798995e62622a81120bf2663a5255ed2dc3a2cc
|
4
|
+
data.tar.gz: 16b49827e5098b0387f814a104e1a4d96e306b67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e24389e4ab559f8c7054256744b73940799b2d22bc64c6f338ddfbaa33f182d8fd4363503739cce12b49a352a6c46b7e2ade19c3d667ddbf130e0b86a18929c4
|
7
|
+
data.tar.gz: deb866aaa231b916f4e294be7dc1fa47d871c3fa207d652f9e73d1cb81d9514116c3a95869f36e687276b40c4ead25210f5e2ee3c19fc55b87dd106bf3fa5079
|
data/lib/cop_detective.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'active_model'
|
2
2
|
require 'active_support'
|
3
|
+
require 'active_record'
|
3
4
|
require_relative 'errors'
|
4
5
|
require_relative 'validator'
|
5
6
|
|
6
7
|
class CopDetective
|
7
8
|
cattr_reader :messages
|
8
9
|
class << self
|
9
|
-
|
10
10
|
include ActiveModel::SecurePassword
|
11
11
|
@@messages = CopDetectiveValidator.messages
|
12
12
|
|
@@ -28,7 +28,7 @@ class CopDetective
|
|
28
28
|
user.save
|
29
29
|
@@messages[:notice] = "Account created. You may now log in."
|
30
30
|
else
|
31
|
-
|
31
|
+
user.errors.full_messages << "Passwords don't match or other params are not valid."
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
data/lib/validator.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'active_support'
|
2
|
+
require 'active_record'
|
3
|
+
|
2
4
|
class CopDetectiveValidator
|
3
5
|
include CopDetective::ErrorMessages
|
4
6
|
cattr_accessor :messages
|
5
7
|
|
6
8
|
class << self
|
7
|
-
@@messages = {notice: nil
|
9
|
+
@@messages = {notice: nil}
|
8
10
|
@@options_errors = {option_nil: "is nil.",
|
9
11
|
empty: "is an empty string."
|
10
12
|
}
|
@@ -14,7 +16,7 @@ class CopDetectiveValidator
|
|
14
16
|
user.update_attributes(password: password)
|
15
17
|
@@messages[:notice] = "Password updated"
|
16
18
|
else
|
17
|
-
|
19
|
+
user.errors.full_messages << CopDetective::ErrorMessages.unsaved_password(CopDetective::ErrorMessages.non_matching)
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cop-detective
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Kamin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|