mini_auth 0.1.0.pre2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.0 (2011-12-13)
2
+
3
+ * The `authenticate` method returns `self` instead of `true`
4
+
1
5
  ## 0.1.0.pre2 (2011-12-13)
2
6
 
3
7
  * The `password_digest` field is protected against mass-assignment
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  mini_auth
2
2
  =========
3
3
 
4
- A minimal authentication module for Rails
4
+ A replacement for `has_secure_password` of ActiveModel
5
5
 
6
6
  Install
7
7
  -------
@@ -37,9 +37,14 @@ Usage
37
37
 
38
38
  a.save # => true
39
39
  a.password_digest # => "$2a$10$F5YbEd..."
40
- a.authenticate("hotyoga) # => true
40
+ a.authenticate("hotyoga) # => a
41
41
  a.authenticate("wrong") # => false
42
42
 
43
+ Requirements
44
+ ------------
45
+
46
+ * Ruby on Rails 3.1 or higher
47
+
43
48
  Remarks
44
49
  -------
45
50
 
@@ -1,3 +1,3 @@
1
1
  module MiniAuth
2
- VERSION = "0.1.0.pre2"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/mini_auth.rb CHANGED
@@ -28,6 +28,10 @@ module MiniAuth
28
28
  end
29
29
 
30
30
  def authenticate(password)
31
- password_digest && BCrypt::Password.new(password_digest) == password
31
+ if password_digest && BCrypt::Password.new(password_digest) == password
32
+ self
33
+ else
34
+ false
35
+ end
32
36
  end
33
37
  end
@@ -5,7 +5,7 @@ describe "authenticate" do
5
5
  u = User.new(:name => 'alice', :password => 'hotyoga')
6
6
  u.save!
7
7
 
8
- u.authenticate('hotyoga').should be_true
8
+ u.authenticate('hotyoga').should == u
9
9
  end
10
10
 
11
11
  it "should not authenticate with a wrong password" do
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre2
5
- prerelease: 6
4
+ version: 0.1.0
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Tsutomu Kuroda
@@ -13,7 +13,7 @@ date: 2011-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &20055060 !ruby/object:Gem::Requirement
16
+ requirement: &13259840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *20055060
24
+ version_requirements: *13259840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bcrypt-ruby
27
- requirement: &20054420 !ruby/object:Gem::Requirement
27
+ requirement: &13259180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *20054420
35
+ version_requirements: *13259180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec-rails
38
- requirement: &20053460 !ruby/object:Gem::Requirement
38
+ requirement: &13258540 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.7.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *20053460
46
+ version_requirements: *13258540
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sqlite3
49
- requirement: &20052960 !ruby/object:Gem::Requirement
49
+ requirement: &13258120 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *20052960
57
+ version_requirements: *13258120
58
58
  description: A minimal authentication module for Rails
59
59
  email:
60
60
  - t-kuroda@oiax.jp
@@ -91,9 +91,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  none: false
93
93
  requirements:
94
- - - ! '>'
94
+ - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
- version: 1.3.1
96
+ version: '0'
97
97
  requirements: []
98
98
  rubyforge_project: mini_auth
99
99
  rubygems_version: 1.8.10