simplest_auth 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +1 -1
- data/lib/simplest_auth/model.rb +7 -7
- data/lib/simplest_auth/version.rb +1 -1
- metadata +6 -2
data/README.textile
CHANGED
@@ -21,7 +21,7 @@ SimplestAuth depends (for now) on the BCrypt gem, so install that first:
|
|
21
21
|
|
22
22
|
Configure for the gem:
|
23
23
|
|
24
|
-
<pre><code>config.gem '
|
24
|
+
<pre><code>config.gem 'simplest_auth'</code></pre>
|
25
25
|
|
26
26
|
h2. Usage
|
27
27
|
|
data/lib/simplest_auth/model.rb
CHANGED
@@ -8,28 +8,28 @@ module SimplestAuth
|
|
8
8
|
attr_accessor :password, :password_confirmation
|
9
9
|
end
|
10
10
|
|
11
|
-
if base.
|
11
|
+
if base.data_mapper?
|
12
12
|
base.class_eval do
|
13
|
-
|
13
|
+
before(:save) {hash_password if password_required?}
|
14
14
|
end
|
15
|
-
elsif base.
|
15
|
+
elsif base.active_record? || base.mongo_mapper?
|
16
16
|
base.class_eval do
|
17
|
-
|
17
|
+
before_save :hash_password, :if => :password_required?
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
module ClassMethods
|
23
23
|
def active_record?
|
24
|
-
defined?(ActiveRecord)
|
24
|
+
defined?(ActiveRecord) && ancestors.include?(ActiveRecord::Base)
|
25
25
|
end
|
26
26
|
|
27
27
|
def data_mapper?
|
28
|
-
defined?(DataMapper)
|
28
|
+
defined?(DataMapper) && ancestors.include?(DataMapper::Resource)
|
29
29
|
end
|
30
30
|
|
31
31
|
def mongo_mapper?
|
32
|
-
defined?(MongoMapper)
|
32
|
+
defined?(MongoMapper) && ancestors.include?(MongoMapper::Document)
|
33
33
|
end
|
34
34
|
|
35
35
|
def authenticate(email, password)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplest_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitale
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-21 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -37,6 +37,10 @@ files:
|
|
37
37
|
- lib/simplest_auth/model.rb
|
38
38
|
- lib/simplest_auth/version.rb
|
39
39
|
- lib/simplest_auth.rb
|
40
|
+
- test/unit/simplest_auth/ar_model_test.rb
|
41
|
+
- test/unit/simplest_auth/controller_test.rb
|
42
|
+
- test/unit/simplest_auth/dm_model_test.rb
|
43
|
+
- test/unit/simplest_auth/model_test.rb
|
40
44
|
has_rdoc: true
|
41
45
|
homepage: http://viget.com/extend
|
42
46
|
licenses: []
|