goma 0.0.1.rc1 → 0.0.1.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/Gemfile.lock +1 -1
- data/Rakefile +6 -0
- data/goma.gemspec +0 -5
- data/lib/goma/config.rb +3 -3
- data/lib/goma/models/confirmable.rb +2 -3
- data/lib/goma/models/lockable.rb +1 -0
- data/lib/goma/models/omniauthable.rb +9 -2
- data/lib/goma/models/password_authenticatable.rb +1 -1
- data/lib/goma/models/timeoutable.rb +1 -1
- data/lib/goma/models/validatable.rb +1 -1
- data/lib/goma/version.rb +1 -1
- data/test/fabricators/authentication_fabricator.rb +4 -0
- data/test/fabricators/{users_fabricator.rb → user_fabricator.rb} +8 -0
- data/test/integration/confirmable_integration_test.rb +5 -5
- data/test/integration/lockable_integration_test.rb +1 -1
- data/test/integration/recoverable_integration_test.rb +2 -2
- data/test/integration/timeoutable_integration_test.rb +171 -171
- data/test/models/confirmable_test.rb +207 -159
- data/test/{goma_test.rb → models/goma_test.rb} +0 -5
- data/test/models/lockable_test.rb +131 -0
- data/test/models/recoverable_test.rb +108 -0
- data/test/models/rememberable_test.rb +115 -0
- data/test/models/timeoutable_test.rb +33 -0
- data/test/models/trackable_test.rb +37 -0
- data/test/models/validatable_test.rb +131 -35
- data/test/rails_app/config/initializers/goma.rb +1 -1
- data/test/rails_app/db/migrate/20140515111009_create_users.rb +1 -0
- data/test/rails_app/db/schema.rb +1 -0
- data/test/test_helper.rb +1 -0
- metadata +19 -13
- data/test/config_test.rb +0 -2
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RecoverableTest < ActiveSupport::TestCase
|
4
|
+
test 'send_reset_password_instructions!' do
|
5
|
+
Goma.token_generator.expects(:friendly_token).returns('sesame')
|
6
|
+
|
7
|
+
user = Fabricate(:user)
|
8
|
+
assert_nil user.reset_password_token
|
9
|
+
assert_nil user.reset_password_token_sent_at
|
10
|
+
|
11
|
+
assert_emails 1 do
|
12
|
+
user.send_reset_password_instructions!
|
13
|
+
end
|
14
|
+
email = ActionMailer::Base.deliveries.last
|
15
|
+
assert_match %r{/passwords/sesame}, email.body.encoded
|
16
|
+
|
17
|
+
user.reload
|
18
|
+
assert user.reset_password_token
|
19
|
+
assert user.reset_password_token_sent_at
|
20
|
+
end
|
21
|
+
|
22
|
+
test 'change_password!' do
|
23
|
+
user = Fabricate(:user)
|
24
|
+
user.send_reset_password_instructions!
|
25
|
+
|
26
|
+
user.change_password!('newpassword', 'newpassword')
|
27
|
+
user.reload
|
28
|
+
assert_nil user.reset_password_token
|
29
|
+
assert_nil user.reset_password_token_sent_at
|
30
|
+
assert user.valid_password?('newpassword')
|
31
|
+
end
|
32
|
+
|
33
|
+
test 'load_from_reset_password_token_with_error with correct token' do
|
34
|
+
user = Fabricate(:user)
|
35
|
+
user.send_reset_password_instructions!
|
36
|
+
raw_token = user.raw_reset_password_token
|
37
|
+
loaded_user, error = User.load_from_reset_password_token_with_error(raw_token)
|
38
|
+
assert_equal user, loaded_user
|
39
|
+
assert_nil error
|
40
|
+
end
|
41
|
+
|
42
|
+
test 'load_from_reset_password_token_with_error with wrong token' do
|
43
|
+
user = Fabricate(:user)
|
44
|
+
user.send_reset_password_instructions!
|
45
|
+
loaded_user, error = User.load_from_reset_password_token_with_error('beans')
|
46
|
+
assert_nil loaded_user
|
47
|
+
assert_equal :not_found, error
|
48
|
+
end
|
49
|
+
|
50
|
+
test 'load_from_reset_password_token_with_error with expired token' do
|
51
|
+
user = Fabricate(:user)
|
52
|
+
user.send_reset_password_instructions!
|
53
|
+
raw_token = user.raw_reset_password_token
|
54
|
+
Timecop.travel 7.hours.from_now do
|
55
|
+
loaded_user, error = User.load_from_reset_password_token_with_error(raw_token)
|
56
|
+
assert_nil loaded_user
|
57
|
+
assert_equal :token_expired, error
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
test 'load_from_reset_password_token! with correct token' do
|
62
|
+
user = Fabricate(:user)
|
63
|
+
user.send_reset_password_instructions!
|
64
|
+
raw_token = user.raw_reset_password_token
|
65
|
+
assert_equal user, User.load_from_reset_password_token!(raw_token)
|
66
|
+
end
|
67
|
+
|
68
|
+
test 'load_from_reset_password_token! with wrong token' do
|
69
|
+
user = Fabricate(:user)
|
70
|
+
user.send_reset_password_instructions!
|
71
|
+
assert_raise Goma::NotFound do
|
72
|
+
User.load_from_reset_password_token!('beans')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
test 'load_from_reset_password_token! with expired token' do
|
77
|
+
user = Fabricate(:user)
|
78
|
+
user.send_reset_password_instructions!
|
79
|
+
raw_token = user.raw_reset_password_token
|
80
|
+
Timecop.travel 7.hours.from_now do
|
81
|
+
assert_raise Goma::TokenExpired do
|
82
|
+
User.load_from_reset_password_token!(raw_token)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
test 'load_from_reset_password_token with correct token' do
|
88
|
+
user = Fabricate(:user)
|
89
|
+
user.send_reset_password_instructions!
|
90
|
+
raw_token = user.raw_reset_password_token
|
91
|
+
assert_equal user, User.load_from_reset_password_token(raw_token)
|
92
|
+
end
|
93
|
+
|
94
|
+
test 'load_from_reset_password_token with wrong token' do
|
95
|
+
user = Fabricate(:user)
|
96
|
+
user.send_reset_password_instructions!
|
97
|
+
assert_nil User.load_from_reset_password_token('beans')
|
98
|
+
end
|
99
|
+
|
100
|
+
test 'load_from_reset_password_token with expired token' do
|
101
|
+
user = Fabricate(:user)
|
102
|
+
user.send_reset_password_instructions!
|
103
|
+
raw_token = user.raw_reset_password_token
|
104
|
+
Timecop.travel 7.hours.from_now do
|
105
|
+
assert_nil User.load_from_reset_password_token(raw_token)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class RememberableTest < ActiveSupport::TestCase
|
4
|
+
def setup
|
5
|
+
@user = Fabricate(:user)
|
6
|
+
end
|
7
|
+
|
8
|
+
test 'remember_me!' do
|
9
|
+
@user.remember_me!
|
10
|
+
|
11
|
+
assert_equal Time.now.utc.to_s, @user.remember_created_at.to_s
|
12
|
+
end
|
13
|
+
|
14
|
+
test 'remember_me! should not update remember_created_at' do
|
15
|
+
Timecop.freeze Time.now
|
16
|
+
@user.remember_me!
|
17
|
+
remember_created_at = Time.now.utc
|
18
|
+
|
19
|
+
Timecop.freeze (2.weeks - 1.second).from_now
|
20
|
+
@user.remember_me!
|
21
|
+
assert_equal remember_created_at.to_s, @user.remember_created_at.to_s
|
22
|
+
|
23
|
+
Timecop.return
|
24
|
+
end
|
25
|
+
|
26
|
+
test 'remember_me! should update remember_created_at if config.extend_remember_period == true' do
|
27
|
+
swap Goma.config(:user), extend_remember_period: true do
|
28
|
+
@user.remember_me!
|
29
|
+
assert_equal Time.now.utc.to_s, @user.remember_created_at.to_s
|
30
|
+
|
31
|
+
Timecop.freeze 1.day.from_now do
|
32
|
+
@user.remember_me!
|
33
|
+
assert_equal Time.now.utc.to_s, @user.remember_created_at.to_s
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
test 'remember_me! should update remember_created_at if remember period expired' do
|
39
|
+
@user.remember_me!
|
40
|
+
assert_equal Time.now.utc.to_s, @user.remember_created_at.to_s
|
41
|
+
|
42
|
+
Timecop.freeze 2.weeks.from_now do
|
43
|
+
@user.remember_me!
|
44
|
+
assert_equal Time.now.utc.to_s, @user.remember_created_at.to_s
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
test 'forget_me!' do
|
49
|
+
@user.remember_me!
|
50
|
+
@user.forget_me!
|
51
|
+
assert_nil @user.remember_created_at
|
52
|
+
end
|
53
|
+
|
54
|
+
test 'remember_me! should generate remember_token if config.remember_token_attribute_name != nil' do
|
55
|
+
@user.singleton_class.send :attr_accessor, :remember_token
|
56
|
+
swap Goma.config(:user), remember_token_attribute_name: :remember_token do
|
57
|
+
@user.remember_me!
|
58
|
+
assert @user.remember_token
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
test 'remember_me! should regenerate remember_token if config.remember_token_attribute_name != nil and remember period expired' do
|
63
|
+
@user.singleton_class.send :attr_accessor, :remember_token
|
64
|
+
swap Goma.config(:user), remember_token_attribute_name: :remember_token do
|
65
|
+
Timecop.freeze Time.now
|
66
|
+
@user.remember_me!
|
67
|
+
token = @user.remember_token
|
68
|
+
|
69
|
+
Timecop.freeze (2.weeks - 1.second).from_now
|
70
|
+
@user.remember_me!
|
71
|
+
assert_equal token, @user.remember_token
|
72
|
+
|
73
|
+
Timecop.freeze 1.second.from_now
|
74
|
+
@user.remember_me!
|
75
|
+
assert_not_equal token, @user.remember_token
|
76
|
+
assert @user.remember_token
|
77
|
+
Timecop.return
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
test 'serialize_into_cookie and serialize_from_cookie' do
|
82
|
+
@user.remember_me!
|
83
|
+
serialized = User.serialize_into_cookie(@user)
|
84
|
+
assert serialized
|
85
|
+
assert_equal @user, User.serialize_from_cookie(*serialized)
|
86
|
+
end
|
87
|
+
|
88
|
+
test 'serialize_from_cookie return nil if it is wrong' do
|
89
|
+
@user.remember_me!
|
90
|
+
serialized = User.serialize_into_cookie(@user)
|
91
|
+
serialized.last << 'aaa'
|
92
|
+
assert_nil User.serialize_from_cookie(*serialized)
|
93
|
+
end
|
94
|
+
|
95
|
+
test 'serialize_from_cookie return nil if user changed her password' do
|
96
|
+
@user.remember_me!
|
97
|
+
serialized = User.serialize_into_cookie(@user)
|
98
|
+
@user.update(password: 'newpassword', password_confirmation: 'newpassword')
|
99
|
+
assert_nil User.serialize_from_cookie(*serialized)
|
100
|
+
end
|
101
|
+
|
102
|
+
test 'serialize_from_cookie return nil if remember period expired' do
|
103
|
+
Timecop.freeze Time.now
|
104
|
+
@user.remember_me!
|
105
|
+
serialized = User.serialize_into_cookie(@user)
|
106
|
+
|
107
|
+
Timecop.freeze (2.weeks - 1.second).from_now
|
108
|
+
assert_equal @user, User.serialize_from_cookie(*serialized)
|
109
|
+
|
110
|
+
Timecop.freeze 1.second.from_now
|
111
|
+
assert_nil User.serialize_from_cookie(*serialized)
|
112
|
+
|
113
|
+
Timecop.return
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class TimeoutableTest < ActiveSupport::TestCase
|
4
|
+
test 'timeout? return false if remembered' do
|
5
|
+
user = Fabricate(:user)
|
6
|
+
user.stubs(:rememberable?).returns(true)
|
7
|
+
user.stubs(:remember_expired?).returns(false)
|
8
|
+
|
9
|
+
refute user.timeout?(1.hour.ago)
|
10
|
+
end
|
11
|
+
|
12
|
+
test 'timeout? return false if last_request_at == nil' do
|
13
|
+
user = Fabricate(:user)
|
14
|
+
refute user.timeout?(nil)
|
15
|
+
end
|
16
|
+
|
17
|
+
test 'timeout? return true if last_request_at <= config.timeout_in.ago' do
|
18
|
+
user = Fabricate(:user)
|
19
|
+
assert user.timeout?(30.minutes.ago)
|
20
|
+
end
|
21
|
+
|
22
|
+
test 'timeout? return false if last_request_at > config.timeout_in.ago' do
|
23
|
+
user = Fabricate(:user)
|
24
|
+
refute user.timeout?(29.minutes.ago)
|
25
|
+
end
|
26
|
+
|
27
|
+
test 'timeout? return false if timeout_in == nil' do
|
28
|
+
swap Goma.config(:user), timeout_in: nil do
|
29
|
+
user = Fabricate(:user)
|
30
|
+
refute user.timeout?(29.minutes.ago)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class TrackableTest < ActiveSupport::TestCase
|
4
|
+
test 'update_tracked_fields!' do
|
5
|
+
Timecop.freeze Time.now do
|
6
|
+
user = Fabricate(:user, last_login_at: 2.days.ago.utc,
|
7
|
+
current_login_at: 1.hour.ago.utc,
|
8
|
+
last_login_ip: '127.0.0.1',
|
9
|
+
current_login_ip: '127.0.0.2',
|
10
|
+
login_count: 2)
|
11
|
+
request = stub(remote_ip: '127.0.0.3')
|
12
|
+
user.update_tracked_fields!(request)
|
13
|
+
|
14
|
+
user.reload
|
15
|
+
assert_equal 1.hour.ago.utc.to_s, user.last_login_at.to_s
|
16
|
+
assert_equal Time.now.utc.to_s, user.current_login_at.to_s
|
17
|
+
assert_equal '127.0.0.2', user.last_login_ip
|
18
|
+
assert_equal '127.0.0.3', user.current_login_ip
|
19
|
+
assert_equal 3, user.login_count
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
test 'update_tracked_fields! for the first time' do
|
24
|
+
Timecop.freeze Time.now do
|
25
|
+
user = Fabricate(:user)
|
26
|
+
request = stub(remote_ip: '127.0.0.3')
|
27
|
+
user.update_tracked_fields!(request)
|
28
|
+
|
29
|
+
user.reload
|
30
|
+
assert_equal Time.now.utc.to_s, user.last_login_at.to_s
|
31
|
+
assert_equal Time.now.utc.to_s, user.current_login_at.to_s
|
32
|
+
assert_equal '127.0.0.3', user.last_login_ip
|
33
|
+
assert_equal '127.0.0.3', user.current_login_ip
|
34
|
+
assert_equal 1, user.login_count
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,59 +1,155 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
|
3
|
+
module ValidatableTests
|
4
|
+
extend ActiveSupport::Testing::Declarative
|
5
|
+
|
6
|
+
test 'should pass all the validations with valid data' do
|
7
|
+
user = Fabricate.build(:unactivated_user)
|
8
|
+
assert user.valid?
|
9
|
+
end
|
10
|
+
|
11
|
+
test 'validates_uniqueness_of a value of an authentication key other than email' do
|
12
|
+
@user.assign_attributes(username: 'foo')
|
13
|
+
refute @user.valid?
|
14
|
+
assert_equal 1, @user.errors.count
|
15
|
+
assert_equal "Username has already been taken", @user.errors.full_messages.first
|
16
|
+
end
|
17
|
+
|
18
|
+
test 'validates_uniqueness_of :email' do
|
19
|
+
@user.assign_attributes(email: 'foo@example.com')
|
20
|
+
refute @user.valid?
|
21
|
+
assert_equal 1, @user.errors.count
|
22
|
+
assert_equal "Email has already been taken", @user.errors.full_messages.first
|
23
|
+
end
|
24
|
+
|
25
|
+
test 'validates_format_of :email' do
|
26
|
+
@user.assign_attributes(email: 'foo.example.com')
|
27
|
+
refute @user.valid?
|
28
|
+
assert_equal 1, @user.errors.count
|
29
|
+
assert_equal "Email is invalid", @user.errors.full_messages.first
|
30
|
+
end
|
31
|
+
|
32
|
+
test 'validates_length_of :password with too short password' do
|
33
|
+
@user.assign_attributes(password: 's' * 7, password_confirmation: 's' * 7)
|
34
|
+
refute @user.valid?
|
35
|
+
assert_equal 1, @user.errors.count
|
36
|
+
assert_equal "Password is too short (minimum is 8 characters)", @user.errors.full_messages.first
|
37
|
+
end
|
38
|
+
|
39
|
+
test 'validates_length_of :password with too long password' do
|
40
|
+
@user.assign_attributes(password: 's' * 129, password_confirmation: 's' * 129)
|
41
|
+
refute @user.valid?
|
42
|
+
assert_equal 1, @user.errors.count
|
43
|
+
assert_equal "Password is too long (maximum is 128 characters)", @user.errors.full_messages.first
|
44
|
+
|
45
|
+
@user.assign_attributes(password: 's' * 128, password_confirmation: 's' * 128)
|
46
|
+
assert @user.valid?
|
47
|
+
end
|
48
|
+
|
49
|
+
test 'validates_confirmation_of :password' do
|
50
|
+
@user.assign_attributes(password: 'password', password_confirmation: 'oops')
|
51
|
+
refute @user.valid?
|
52
|
+
assert_equal 1, @user.errors.count
|
53
|
+
assert_equal "Password confirmation doesn't match Password", @user.errors.full_messages.first
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class NewUserValidatableTest < ActiveSupport::TestCase
|
58
|
+
include ValidatableTests
|
59
|
+
|
4
60
|
def setup
|
5
|
-
|
61
|
+
Fabricate(:user, username: 'foo', email: 'foo@example.com')
|
62
|
+
@user = Fabricate.build(:user)
|
6
63
|
end
|
7
64
|
|
8
|
-
test '
|
9
|
-
|
10
|
-
|
11
|
-
|
65
|
+
test 'validates_presence_of a value of an authentication key other than email' do
|
66
|
+
@user.assign_attributes(username: nil)
|
67
|
+
refute @user.valid?
|
68
|
+
assert_equal 1, @user.errors.count
|
69
|
+
assert_equal "Username can't be blank", @user.errors.full_messages.first
|
12
70
|
end
|
13
71
|
|
14
|
-
test '
|
15
|
-
|
16
|
-
|
17
|
-
|
72
|
+
test 'validates_presence_of :email' do
|
73
|
+
@user.assign_attributes(email: nil)
|
74
|
+
refute @user.valid?
|
75
|
+
assert_equal 1, @user.errors.count
|
76
|
+
assert_equal "Email can't be blank", @user.errors.full_messages.first
|
18
77
|
end
|
19
78
|
|
20
|
-
test '
|
21
|
-
|
22
|
-
|
23
|
-
|
79
|
+
test 'validates_presense_of :password' do
|
80
|
+
@user.assign_attributes(password: '', password_confirmation: '')
|
81
|
+
refute @user.valid?
|
82
|
+
assert_equal 1, @user.errors.count
|
83
|
+
assert_equal "Password can't be blank", @user.errors.full_messages.first
|
24
84
|
end
|
85
|
+
end
|
25
86
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
87
|
+
class ExistingUserValidatableTest < ActiveSupport::TestCase
|
88
|
+
include ValidatableTests
|
89
|
+
|
90
|
+
def setup
|
91
|
+
Fabricate(:user, username: 'foo', email: 'foo@example.com')
|
92
|
+
@user = Fabricate(:user)
|
30
93
|
end
|
31
94
|
|
32
|
-
test '
|
33
|
-
|
34
|
-
|
35
|
-
|
95
|
+
test 'validates_presence_of a value of an authentication key other than email' do
|
96
|
+
@user.assign_attributes(username: nil)
|
97
|
+
refute @user.valid?
|
98
|
+
assert_equal 1, @user.errors.count
|
99
|
+
assert_equal "Username can't be blank", @user.errors.full_messages.first
|
36
100
|
end
|
37
101
|
|
38
|
-
test '
|
39
|
-
|
40
|
-
|
41
|
-
|
102
|
+
test 'validates_presence_of :email' do
|
103
|
+
@user.assign_attributes(email: nil)
|
104
|
+
refute @user.valid?
|
105
|
+
assert_equal 1, @user.errors.count
|
106
|
+
assert_equal "Email can't be blank", @user.errors.full_messages.first
|
42
107
|
end
|
108
|
+
end
|
43
109
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
110
|
+
class UserCreatingWithOmniauthValidatableTest < ActiveSupport::TestCase
|
111
|
+
include ValidatableTests
|
112
|
+
|
113
|
+
def setup
|
114
|
+
Fabricate(:user, username: 'foo', email: 'foo@example.com')
|
115
|
+
@user = User.build_with_omniauth!(Fabricate.attributes_for(:authentication))
|
48
116
|
end
|
49
117
|
|
50
|
-
test 'should
|
51
|
-
|
52
|
-
|
118
|
+
test 'should check validations if *_required? returns true' do
|
119
|
+
class NamedUser < User
|
120
|
+
def username_required?
|
121
|
+
true
|
122
|
+
end
|
53
123
|
end
|
124
|
+
user = NamedUser.build_with_omniauth!(Fabricate.attributes_for(:authentication))
|
125
|
+
refute user.valid?
|
126
|
+
assert_equal 1, user.errors.count
|
127
|
+
assert_equal "Username can't be blank", user.errors.full_messages.first
|
128
|
+
user.username = 'Ugo'
|
129
|
+
assert user.valid?
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
class OAuthUserValidatableTest < ActiveSupport::TestCase
|
134
|
+
include ValidatableTests
|
135
|
+
|
136
|
+
def setup
|
137
|
+
Fabricate(:user, username: 'foo', email: 'foo@example.com')
|
138
|
+
@user = Fabricate(:oauth_user)
|
139
|
+
end
|
54
140
|
|
55
|
-
|
56
|
-
|
141
|
+
test 'should check validations if *_required? returns true' do
|
142
|
+
class NamedUser < User
|
143
|
+
def username_required?
|
144
|
+
true
|
145
|
+
end
|
57
146
|
end
|
147
|
+
user = NamedUser.build_with_omniauth!(Fabricate.attributes_for(:authentication))
|
148
|
+
user.save!(validate: false)
|
149
|
+
refute user.valid?
|
150
|
+
assert_equal 1, user.errors.count
|
151
|
+
assert_equal "Username can't be blank", user.errors.full_messages.first
|
152
|
+
user.username = 'Ugo'
|
153
|
+
assert user.valid?
|
58
154
|
end
|
59
155
|
end
|
@@ -63,7 +63,7 @@ Goma.configure do |config|
|
|
63
63
|
# Timeoutable
|
64
64
|
# config.timeout_in = 30.minutes
|
65
65
|
# config.logout_all_scopes = false
|
66
|
-
|
66
|
+
config.validate_session_even_in_not_login_area = ENV['VALIDATE_SESSION_EVEN_IN_NOT_LOGIN_AREA'] == 'true'
|
67
67
|
|
68
68
|
####################################################
|
69
69
|
# Lockable
|
data/test/rails_app/db/schema.rb
CHANGED
@@ -32,6 +32,7 @@ ActiveRecord::Schema.define(version: 20140515111010) do
|
|
32
32
|
t.string "confirmation_token"
|
33
33
|
t.datetime "confirmation_token_sent_at"
|
34
34
|
t.string "activated_at"
|
35
|
+
t.string "remember_token"
|
35
36
|
t.datetime "remember_created_at"
|
36
37
|
t.integer "failed_attempts", default: 0, null: false
|
37
38
|
t.datetime "locked_at"
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kentaro Imai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -280,12 +280,11 @@ files:
|
|
280
280
|
- lib/goma/version.rb
|
281
281
|
- lib/goma/warden.rb
|
282
282
|
- lib/tasks/goma_tasks.rake
|
283
|
-
- test/config_test.rb
|
284
283
|
- test/controllers/helpers_test.rb
|
285
284
|
- test/controllers/lockable_controller_test.rb
|
286
285
|
- test/controllers/sessions_controller_test.rb
|
287
|
-
- test/fabricators/
|
288
|
-
- test/
|
286
|
+
- test/fabricators/authentication_fabricator.rb
|
287
|
+
- test/fabricators/user_fabricator.rb
|
289
288
|
- test/integration/confirmable_integration_test.rb
|
290
289
|
- test/integration/lockable_integration_test.rb
|
291
290
|
- test/integration/omniauthable_integration_test.rb
|
@@ -297,8 +296,14 @@ files:
|
|
297
296
|
- test/integration/trackable_integration_test.rb
|
298
297
|
- test/models/authenticatable_test.rb
|
299
298
|
- test/models/confirmable_test.rb
|
299
|
+
- test/models/goma_test.rb
|
300
|
+
- test/models/lockable_test.rb
|
300
301
|
- test/models/omniauthable_test.rb
|
301
302
|
- test/models/password_authenticatable_test.rb
|
303
|
+
- test/models/recoverable_test.rb
|
304
|
+
- test/models/rememberable_test.rb
|
305
|
+
- test/models/timeoutable_test.rb
|
306
|
+
- test/models/trackable_test.rb
|
302
307
|
- test/models/validatable_test.rb
|
303
308
|
- test/orm/active_record.rb
|
304
309
|
- test/rails_app/README.rdoc
|
@@ -407,11 +412,7 @@ post_install_message: "\n\e[32mThank you for installing!\n\nYou can use this gem
|
|
407
412
|
\ \e[0mconfig.action_mailer.default_url_options = { host: 'localhost:3000' }\e[32m\n\n
|
408
413
|
\ in production, :host should be set to the actual host of your application.\n\n===========================================================================\n\n\nThat's
|
409
414
|
it.\n\nThis gem is in early development phase and I do not recommend you to use
|
410
|
-
this for production for a while.\nBug reports and pull requests are welcome.\n\
|
411
|
-
am surprised that this gem has been downloaded over 200 times, in spite of pre release
|
412
|
-
versions of v0.0.1.\nAnd, I feel bad about there were lots of bugs and incomplete
|
413
|
-
implementations in previous versions.\n\nI will release this as a release candidate,
|
414
|
-
but will add lots of code before v0.0.1.\n\nEnjoy!\e[0m\n"
|
415
|
+
this for production for a while.\nBug reports and pull requests are welcome.\n\nEnjoy!\e[0m\n"
|
415
416
|
rdoc_options: []
|
416
417
|
require_paths:
|
417
418
|
- lib
|
@@ -432,12 +433,11 @@ signing_key:
|
|
432
433
|
specification_version: 4
|
433
434
|
summary: An authentication solution for Rails 4
|
434
435
|
test_files:
|
435
|
-
- test/config_test.rb
|
436
436
|
- test/controllers/helpers_test.rb
|
437
437
|
- test/controllers/lockable_controller_test.rb
|
438
438
|
- test/controllers/sessions_controller_test.rb
|
439
|
-
- test/fabricators/
|
440
|
-
- test/
|
439
|
+
- test/fabricators/authentication_fabricator.rb
|
440
|
+
- test/fabricators/user_fabricator.rb
|
441
441
|
- test/integration/confirmable_integration_test.rb
|
442
442
|
- test/integration/lockable_integration_test.rb
|
443
443
|
- test/integration/omniauthable_integration_test.rb
|
@@ -449,8 +449,14 @@ test_files:
|
|
449
449
|
- test/integration/trackable_integration_test.rb
|
450
450
|
- test/models/authenticatable_test.rb
|
451
451
|
- test/models/confirmable_test.rb
|
452
|
+
- test/models/goma_test.rb
|
453
|
+
- test/models/lockable_test.rb
|
452
454
|
- test/models/omniauthable_test.rb
|
453
455
|
- test/models/password_authenticatable_test.rb
|
456
|
+
- test/models/recoverable_test.rb
|
457
|
+
- test/models/rememberable_test.rb
|
458
|
+
- test/models/timeoutable_test.rb
|
459
|
+
- test/models/trackable_test.rb
|
454
460
|
- test/models/validatable_test.rb
|
455
461
|
- test/orm/active_record.rb
|
456
462
|
- test/rails_app/README.rdoc
|
data/test/config_test.rb
DELETED