shield-contrib 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/shield/contrib.rb +2 -2
- data/lib/shield/contrib/ohm/email_password.rb +10 -5
- metadata +3 -3
data/lib/shield/contrib.rb
CHANGED
@@ -4,7 +4,8 @@ module Shield
|
|
4
4
|
def self.included(model)
|
5
5
|
model.extend Shield::Model
|
6
6
|
model.extend Fetch
|
7
|
-
|
7
|
+
|
8
|
+
model.attributes << :email unless model.attributes.include?(:email)
|
8
9
|
model.index :email
|
9
10
|
|
10
11
|
model.attribute :crypted_password
|
@@ -20,6 +21,14 @@ module Shield
|
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
24
|
+
def email=(email)
|
25
|
+
write_local(:email, email.to_s.downcase.strip)
|
26
|
+
end
|
27
|
+
|
28
|
+
def email
|
29
|
+
read_local(:email)
|
30
|
+
end
|
31
|
+
|
23
32
|
attr_reader :password
|
24
33
|
attr_accessor :password_confirmation
|
25
34
|
|
@@ -35,10 +44,6 @@ module Shield
|
|
35
44
|
end
|
36
45
|
end
|
37
46
|
|
38
|
-
def email
|
39
|
-
read_local(:email).to_s.downcase.strip
|
40
|
-
end
|
41
|
-
|
42
47
|
def password=(password)
|
43
48
|
unless password.to_s.empty?
|
44
49
|
self.crypted_password = Shield::Password.encrypt(password)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michel Martens
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2011-01-03 00:00:00 +08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|