minimalist_authentication 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +74 -61
- data/lib/minimalist/authentication.rb +1 -1
- data/lib/minimalist/version.rb +1 -1
- data/minimalist_authentication.gemspec +1 -1
- data/test/authentication_test.rb +9 -9
- data/test/authorization_test.rb +2 -2
- data/test/factories.rb +8 -6
- data/test/sessions_test.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f7c9974d5123adc207f585ba87d63be93f7e2d1
|
4
|
+
data.tar.gz: e79d7be17c1761184e15b01d663022c26be8a47a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06ee1715286f3c8fba8456759710b7aaaeed61de15c45ffee0db2faf47362612af73519c65f305e9347e1636f61e0ec1a4d71c78ed6ff1c23fee89cb3163d5f0
|
7
|
+
data.tar.gz: d92bb2ea985da401c4292541d2a8262e23bd7939fa523191ec42c83b42171688f0329374f462c6f1d98609c63d87ca4f814b7f6d6df3ac4f341bc13cf7e00935
|
data/Gemfile.lock
CHANGED
@@ -1,79 +1,92 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
minimalist_authentication (0.6.
|
4
|
+
minimalist_authentication (0.6.8)
|
5
5
|
bcrypt-ruby (~> 3.1.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rack (~> 1.2
|
21
|
-
rack-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
arel (
|
38
|
-
bcrypt-ruby (3.1.
|
39
|
-
builder (
|
40
|
-
erubis (2.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
i18n (0.6.
|
45
|
-
|
46
|
-
|
47
|
-
|
10
|
+
actionmailer (3.2.14)
|
11
|
+
actionpack (= 3.2.14)
|
12
|
+
mail (~> 2.5.4)
|
13
|
+
actionpack (3.2.14)
|
14
|
+
activemodel (= 3.2.14)
|
15
|
+
activesupport (= 3.2.14)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
journey (~> 1.0.4)
|
19
|
+
rack (~> 1.4.5)
|
20
|
+
rack-cache (~> 1.2)
|
21
|
+
rack-test (~> 0.6.1)
|
22
|
+
sprockets (~> 2.2.1)
|
23
|
+
activemodel (3.2.14)
|
24
|
+
activesupport (= 3.2.14)
|
25
|
+
builder (~> 3.0.0)
|
26
|
+
activerecord (3.2.14)
|
27
|
+
activemodel (= 3.2.14)
|
28
|
+
activesupport (= 3.2.14)
|
29
|
+
arel (~> 3.0.2)
|
30
|
+
tzinfo (~> 0.3.29)
|
31
|
+
activeresource (3.2.14)
|
32
|
+
activemodel (= 3.2.14)
|
33
|
+
activesupport (= 3.2.14)
|
34
|
+
activesupport (3.2.14)
|
35
|
+
i18n (~> 0.6, >= 0.6.4)
|
36
|
+
multi_json (~> 1.0)
|
37
|
+
arel (3.0.2)
|
38
|
+
bcrypt-ruby (3.1.2)
|
39
|
+
builder (3.0.4)
|
40
|
+
erubis (2.7.0)
|
41
|
+
factory_girl (4.2.0)
|
42
|
+
activesupport (>= 3.0.0)
|
43
|
+
hike (1.2.3)
|
44
|
+
i18n (0.6.5)
|
45
|
+
journey (1.0.4)
|
46
|
+
json (1.8.0)
|
47
|
+
mail (2.5.4)
|
48
48
|
mime-types (~> 1.16)
|
49
49
|
treetop (~> 1.4.8)
|
50
|
-
mime-types (1.
|
50
|
+
mime-types (1.25)
|
51
|
+
multi_json (1.8.0)
|
51
52
|
polyglot (0.3.3)
|
52
|
-
rack (1.
|
53
|
-
rack-
|
54
|
-
rack (>=
|
55
|
-
rack-
|
53
|
+
rack (1.4.5)
|
54
|
+
rack-cache (1.2)
|
55
|
+
rack (>= 0.4)
|
56
|
+
rack-ssl (1.3.3)
|
57
|
+
rack
|
58
|
+
rack-test (0.6.2)
|
56
59
|
rack (>= 1.0)
|
57
|
-
rails (3.
|
58
|
-
actionmailer (= 3.
|
59
|
-
actionpack (= 3.
|
60
|
-
activerecord (= 3.
|
61
|
-
activeresource (= 3.
|
62
|
-
activesupport (= 3.
|
60
|
+
rails (3.2.14)
|
61
|
+
actionmailer (= 3.2.14)
|
62
|
+
actionpack (= 3.2.14)
|
63
|
+
activerecord (= 3.2.14)
|
64
|
+
activeresource (= 3.2.14)
|
65
|
+
activesupport (= 3.2.14)
|
63
66
|
bundler (~> 1.0)
|
64
|
-
railties (= 3.
|
65
|
-
railties (3.
|
66
|
-
actionpack (= 3.
|
67
|
-
activesupport (= 3.
|
67
|
+
railties (= 3.2.14)
|
68
|
+
railties (3.2.14)
|
69
|
+
actionpack (= 3.2.14)
|
70
|
+
activesupport (= 3.2.14)
|
71
|
+
rack-ssl (~> 1.3.2)
|
68
72
|
rake (>= 0.8.7)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
rdoc (~> 3.4)
|
74
|
+
thor (>= 0.14.6, < 2.0)
|
75
|
+
rake (10.1.0)
|
76
|
+
rdoc (3.12.2)
|
77
|
+
json (~> 1.4)
|
78
|
+
sprockets (2.2.2)
|
79
|
+
hike (~> 1.2)
|
80
|
+
multi_json (~> 1.0)
|
81
|
+
rack (~> 1.0)
|
82
|
+
tilt (~> 1.1, != 1.3.0)
|
83
|
+
sqlite3 (1.3.8)
|
84
|
+
thor (0.18.1)
|
85
|
+
tilt (1.4.1)
|
86
|
+
treetop (1.4.15)
|
74
87
|
polyglot
|
75
88
|
polyglot (>= 0.3.1)
|
76
|
-
tzinfo (0.3.
|
89
|
+
tzinfo (0.3.37)
|
77
90
|
|
78
91
|
PLATFORMS
|
79
92
|
ruby
|
@@ -81,5 +94,5 @@ PLATFORMS
|
|
81
94
|
DEPENDENCIES
|
82
95
|
factory_girl
|
83
96
|
minimalist_authentication!
|
84
|
-
rails (= 3.
|
97
|
+
rails (= 3.2.14)
|
85
98
|
sqlite3
|
@@ -81,7 +81,7 @@ module Minimalist
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def logged_in
|
84
|
-
|
84
|
+
update_column(:last_logged_in_at, Time.now.to_s(:db)) # use update_column to avoid updated_on trigger
|
85
85
|
end
|
86
86
|
|
87
87
|
def is_guest?
|
data/lib/minimalist/version.rb
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
|
18
18
|
s.add_dependency 'bcrypt-ruby', '~> 3.1.1'
|
19
19
|
|
20
|
-
s.add_development_dependency 'rails','3.
|
20
|
+
s.add_development_dependency 'rails','3.2.14'
|
21
21
|
s.add_development_dependency 'sqlite3'
|
22
22
|
s.add_development_dependency 'factory_girl'
|
23
23
|
end
|
data/test/authentication_test.rb
CHANGED
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
class AuthenticationTest < ActiveSupport::TestCase
|
4
4
|
|
5
5
|
test "should not be able to set crypted_password through mass assignment" do
|
6
|
-
user =
|
6
|
+
user = FactoryGirl.create(:user)
|
7
7
|
old_crypted_password = user.crypted_password
|
8
8
|
old_digest_version = user.using_digest_version
|
9
9
|
old_salt = user.salt
|
@@ -14,32 +14,32 @@ class AuthenticationTest < ActiveSupport::TestCase
|
|
14
14
|
end
|
15
15
|
|
16
16
|
test "should return active user" do
|
17
|
-
user =
|
17
|
+
user = FactoryGirl.create(:user)
|
18
18
|
assert_equal([user], User.active)
|
19
19
|
end
|
20
20
|
|
21
21
|
test "should authenticate user" do
|
22
|
-
user =
|
22
|
+
user = FactoryGirl.create(:user)
|
23
23
|
assert_equal(user, User.authenticate(user.email, 'password'))
|
24
24
|
end
|
25
25
|
|
26
26
|
test "should fail to authenticate when email is blank" do
|
27
|
-
user =
|
27
|
+
user = FactoryGirl.create(:user)
|
28
28
|
assert_nil(User.authenticate('', 'password'))
|
29
29
|
end
|
30
30
|
|
31
31
|
test "should fail to authenticate when password is blank" do
|
32
|
-
user =
|
32
|
+
user = FactoryGirl.create(:user)
|
33
33
|
assert_nil(User.authenticate(user.email, ''))
|
34
34
|
end
|
35
35
|
|
36
36
|
test "should fail to authenticate when user is not active" do
|
37
|
-
user =
|
37
|
+
user = FactoryGirl.create(:user, :active => false)
|
38
38
|
assert_nil(User.authenticate(user.email, 'password'))
|
39
39
|
end
|
40
40
|
|
41
41
|
test "should fail to authenticate for incorrect password" do
|
42
|
-
user =
|
42
|
+
user = FactoryGirl.create(:user)
|
43
43
|
assert_nil(User.authenticate(user.email, 'incorrect_password'))
|
44
44
|
end
|
45
45
|
|
@@ -52,7 +52,7 @@ class AuthenticationTest < ActiveSupport::TestCase
|
|
52
52
|
end
|
53
53
|
|
54
54
|
test "should update last_logged_in_at without updating updated_at timestamp" do
|
55
|
-
user =
|
55
|
+
user = FactoryGirl.create(:user, :updated_at => 1.day.ago)
|
56
56
|
updated_at = user.updated_at
|
57
57
|
user.logged_in
|
58
58
|
assert(user.updated_at == updated_at)
|
@@ -79,7 +79,7 @@ class AuthenticationTest < ActiveSupport::TestCase
|
|
79
79
|
end
|
80
80
|
|
81
81
|
test "should use latest digest version for new users" do
|
82
|
-
assert_equal(User::PREFERRED_DIGEST_VERSION,
|
82
|
+
assert_equal(User::PREFERRED_DIGEST_VERSION,FactoryGirl.create(:user).using_digest_version)
|
83
83
|
end
|
84
84
|
|
85
85
|
test "should migrate legacy users to new digest version" do
|
data/test/authorization_test.rb
CHANGED
@@ -9,13 +9,13 @@ class AuthorizationTest < ActiveSupport::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
test "should return logged_in user for current_user" do
|
12
|
-
user =
|
12
|
+
user = FactoryGirl.create(:user)
|
13
13
|
session[:user_id] = user.id
|
14
14
|
assert_equal(user, current_user)
|
15
15
|
end
|
16
16
|
|
17
17
|
test "should pass authorization" do
|
18
|
-
user =
|
18
|
+
user = FactoryGirl.create(:user)
|
19
19
|
session[:user_id] = user.id
|
20
20
|
assert(authorization_required)
|
21
21
|
end
|
data/test/factories.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
module Factories
|
2
2
|
salt = User.make_token
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
FactoryGirl.define do
|
4
|
+
factory :user do
|
5
|
+
active true
|
6
|
+
email 'test@testing.com'
|
7
|
+
salt salt
|
8
|
+
crypted_password User.secure_digest('password',salt,Minimalist::Authentication::PREFERRED_DIGEST_VERSION)
|
9
|
+
using_digest_version Minimalist::Authentication::PREFERRED_DIGEST_VERSION
|
10
|
+
end
|
9
11
|
end
|
10
12
|
end
|
data/test/sessions_test.rb
CHANGED
@@ -8,14 +8,14 @@ class SessionsControllerTest < ActionController::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
test "should create session" do
|
11
|
-
user =
|
11
|
+
user = FactoryGirl.create(:user)
|
12
12
|
post :create, :email => 'test@testing.com', :password => 'password'
|
13
13
|
assert_equal(user.id, session[:user_id])
|
14
14
|
assert_redirected_to '/'
|
15
15
|
end
|
16
16
|
|
17
17
|
test "should fail to create session" do
|
18
|
-
user =
|
18
|
+
user = FactoryGirl.create(:user)
|
19
19
|
post :create, :email => 'test@testing.com', :password => 'wrong_password'
|
20
20
|
assert_nil(session[:user_id])
|
21
21
|
assert_response :success
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minimalist_authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Baldwin
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 3.
|
35
|
+
version: 3.2.14
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 3.
|
42
|
+
version: 3.2.14
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: sqlite3
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|