devise 3.2.3 → 3.2.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of devise might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +6 -6
- data/README.md +7 -0
- data/Rakefile +1 -1
- data/app/controllers/devise/confirmations_controller.rb +2 -2
- data/app/controllers/devise/omniauth_callbacks_controller.rb +2 -2
- data/app/controllers/devise/passwords_controller.rb +3 -3
- data/app/controllers/devise/registrations_controller.rb +7 -7
- data/app/controllers/devise/sessions_controller.rb +6 -6
- data/app/controllers/devise/unlocks_controller.rb +2 -2
- data/app/controllers/devise_controller.rb +3 -3
- data/app/helpers/devise_helper.rb +2 -2
- data/app/views/devise/confirmations/new.html.erb +2 -2
- data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
- data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
- data/app/views/devise/mailer/unlock_instructions.html.erb +1 -1
- data/app/views/devise/passwords/edit.html.erb +3 -3
- data/app/views/devise/passwords/new.html.erb +2 -2
- data/app/views/devise/registrations/edit.html.erb +6 -6
- data/app/views/devise/registrations/new.html.erb +4 -4
- data/app/views/devise/sessions/new.html.erb +3 -3
- data/app/views/devise/unlocks/new.html.erb +2 -2
- data/devise.gemspec +1 -1
- data/gemfiles/Gemfile.rails-3.2-stable +3 -3
- data/gemfiles/Gemfile.rails-4.0-stable +3 -3
- data/gemfiles/Gemfile.rails-head +3 -3
- data/lib/devise.rb +3 -3
- data/lib/devise/controllers/helpers.rb +5 -5
- data/lib/devise/controllers/rememberable.rb +3 -3
- data/lib/devise/controllers/sign_in_out.rb +8 -8
- data/lib/devise/failure_app.rb +3 -3
- data/lib/devise/hooks/activatable.rb +1 -1
- data/lib/devise/hooks/lockable.rb +1 -1
- data/lib/devise/hooks/proxy.rb +1 -1
- data/lib/devise/hooks/rememberable.rb +1 -1
- data/lib/devise/hooks/timeoutable.rb +1 -1
- data/lib/devise/hooks/trackable.rb +1 -1
- data/lib/devise/mailers/helpers.rb +8 -8
- data/lib/devise/models/authenticatable.rb +3 -3
- data/lib/devise/models/confirmable.rb +9 -9
- data/lib/devise/models/database_authenticatable.rb +1 -1
- data/lib/devise/models/lockable.rb +6 -6
- data/lib/devise/models/omniauthable.rb +1 -1
- data/lib/devise/models/recoverable.rb +1 -1
- data/lib/devise/models/rememberable.rb +3 -3
- data/lib/devise/models/trackable.rb +1 -1
- data/lib/devise/models/validatable.rb +6 -6
- data/lib/devise/modules.rb +9 -9
- data/lib/devise/omniauth/url_helpers.rb +2 -2
- data/lib/devise/rails.rb +1 -1
- data/lib/devise/rails/routes.rb +81 -81
- data/lib/devise/test_helpers.rb +2 -2
- data/lib/devise/time_inflector.rb +1 -1
- data/lib/devise/version.rb +1 -1
- data/lib/generators/active_record/devise_generator.rb +6 -6
- data/lib/generators/active_record/templates/migration.rb +4 -4
- data/lib/generators/active_record/templates/migration_existing.rb +4 -4
- data/lib/generators/devise/devise_generator.rb +3 -3
- data/lib/generators/devise/views_generator.rb +29 -18
- data/lib/generators/mongoid/devise_generator.rb +19 -19
- data/lib/generators/templates/README +2 -2
- data/lib/generators/templates/devise.rb +9 -7
- data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
- data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
- data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
- data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +2 -2
- data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +4 -4
- data/lib/generators/templates/simple_form_for/passwords/new.html.erb +2 -2
- data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +6 -6
- data/lib/generators/templates/simple_form_for/registrations/new.html.erb +4 -4
- data/lib/generators/templates/simple_form_for/sessions/new.html.erb +4 -4
- data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +2 -2
- data/test/controllers/helpers_test.rb +31 -31
- data/test/controllers/internal_helpers_test.rb +6 -6
- data/test/controllers/sessions_controller_test.rb +18 -18
- data/test/controllers/url_helpers_test.rb +4 -4
- data/test/delegator_test.rb +1 -1
- data/test/devise_test.rb +3 -3
- data/test/failure_app_test.rb +21 -21
- data/test/generators/active_record_generator_test.rb +4 -4
- data/test/generators/devise_generator_test.rb +2 -2
- data/test/generators/mongoid_generator_test.rb +1 -1
- data/test/generators/views_generator_test.rb +30 -1
- data/test/helpers/devise_helper_test.rb +11 -11
- data/test/integration/authenticatable_test.rb +42 -42
- data/test/integration/confirmable_test.rb +46 -46
- data/test/integration/database_authenticatable_test.rb +16 -16
- data/test/integration/http_authenticatable_test.rb +11 -11
- data/test/integration/lockable_test.rb +37 -37
- data/test/integration/omniauthable_test.rb +3 -3
- data/test/integration/recoverable_test.rb +41 -41
- data/test/integration/registerable_test.rb +49 -49
- data/test/integration/rememberable_test.rb +13 -13
- data/test/integration/timeoutable_test.rb +7 -7
- data/test/integration/trackable_test.rb +2 -2
- data/test/mailers/confirmation_instructions_test.rb +4 -4
- data/test/mailers/reset_password_instructions_test.rb +3 -3
- data/test/mailers/unlock_instructions_test.rb +2 -2
- data/test/models/authenticatable_test.rb +3 -3
- data/test/models/confirmable_test.rb +31 -31
- data/test/models/database_authenticatable_test.rb +27 -27
- data/test/models/lockable_test.rb +29 -29
- data/test/models/recoverable_test.rb +19 -19
- data/test/models/rememberable_test.rb +8 -8
- data/test/models/serializable_test.rb +8 -8
- data/test/models/timeoutable_test.rb +1 -1
- data/test/models/validatable_test.rb +11 -11
- data/test/omniauth/config_test.rb +3 -3
- data/test/omniauth/url_helpers_test.rb +3 -3
- data/test/parameter_sanitizer_test.rb +1 -1
- data/test/rails_app/app/controllers/admins_controller.rb +1 -1
- data/test/rails_app/app/controllers/application_controller.rb +2 -2
- data/test/rails_app/app/controllers/home_controller.rb +1 -1
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +2 -2
- data/test/rails_app/app/controllers/users_controller.rb +5 -5
- data/test/rails_app/app/mailers/users/mailer.rb +4 -4
- data/test/rails_app/app/mongoid/admin.rb +11 -11
- data/test/rails_app/app/mongoid/shim.rb +2 -2
- data/test/rails_app/app/mongoid/user.rb +19 -19
- data/test/rails_app/app/views/admins/sessions/new.html.erb +1 -1
- data/test/rails_app/app/views/layouts/application.html.erb +1 -1
- data/test/rails_app/config/application.rb +2 -2
- data/test/rails_app/config/initializers/devise.rb +3 -3
- data/test/rails_app/config/initializers/secret_token.rb +1 -1
- data/test/rails_app/config/routes.rb +43 -43
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +7 -7
- data/test/rails_app/lib/shared_admin.rb +4 -4
- data/test/routes_test.rb +59 -59
- data/test/support/helpers.rb +4 -4
- data/test/support/integration.rb +12 -12
- data/test/test_helpers_test.rb +3 -3
- data/test/test_models.rb +5 -5
- metadata +4 -4
@@ -86,7 +86,7 @@ class RememberableTest < ActiveSupport::TestCase
|
|
86
86
|
end
|
87
87
|
|
88
88
|
test 'remember for should fallback to devise remember for default configuration' do
|
89
|
-
swap Devise, :
|
89
|
+
swap Devise, remember_for: 1.day do
|
90
90
|
resource = create_resource
|
91
91
|
resource.remember_me!
|
92
92
|
assert_not resource.remember_expired?
|
@@ -94,7 +94,7 @@ class RememberableTest < ActiveSupport::TestCase
|
|
94
94
|
end
|
95
95
|
|
96
96
|
test 'remember expires at should sum date of creation with remember for configuration' do
|
97
|
-
swap Devise, :
|
97
|
+
swap Devise, remember_for: 3.days do
|
98
98
|
resource = create_resource
|
99
99
|
resource.remember_me!
|
100
100
|
assert_equal 3.days.from_now.to_date, resource.remember_expires_at.to_date
|
@@ -105,7 +105,7 @@ class RememberableTest < ActiveSupport::TestCase
|
|
105
105
|
end
|
106
106
|
|
107
107
|
test 'remember should be expired if remember_for is zero' do
|
108
|
-
swap Devise, :
|
108
|
+
swap Devise, remember_for: 0.days do
|
109
109
|
Devise.remember_for = 0.days
|
110
110
|
resource = create_resource
|
111
111
|
resource.remember_me!
|
@@ -114,7 +114,7 @@ class RememberableTest < ActiveSupport::TestCase
|
|
114
114
|
end
|
115
115
|
|
116
116
|
test 'remember should be expired if it was created before limit time' do
|
117
|
-
swap Devise, :
|
117
|
+
swap Devise, remember_for: 1.day do
|
118
118
|
resource = create_resource
|
119
119
|
resource.remember_me!
|
120
120
|
resource.remember_created_at = 2.days.ago
|
@@ -124,7 +124,7 @@ class RememberableTest < ActiveSupport::TestCase
|
|
124
124
|
end
|
125
125
|
|
126
126
|
test 'remember should not be expired if it was created within the limit time' do
|
127
|
-
swap Devise, :
|
127
|
+
swap Devise, remember_for: 30.days do
|
128
128
|
resource = create_resource
|
129
129
|
resource.remember_me!
|
130
130
|
resource.remember_created_at = (30.days.ago + 2.minutes)
|
@@ -134,7 +134,7 @@ class RememberableTest < ActiveSupport::TestCase
|
|
134
134
|
end
|
135
135
|
|
136
136
|
test 'if extend_remember_period is false, remember_me! should generate a new timestamp if expired' do
|
137
|
-
swap Devise, :
|
137
|
+
swap Devise, remember_for: 5.minutes do
|
138
138
|
resource = create_resource
|
139
139
|
resource.remember_me!(false)
|
140
140
|
assert resource.remember_created_at
|
@@ -148,7 +148,7 @@ class RememberableTest < ActiveSupport::TestCase
|
|
148
148
|
end
|
149
149
|
|
150
150
|
test 'if extend_remember_period is false, remember_me! should not generate a new timestamp' do
|
151
|
-
swap Devise, :
|
151
|
+
swap Devise, remember_for: 1.year do
|
152
152
|
resource = create_resource
|
153
153
|
resource.remember_me!(false)
|
154
154
|
assert resource.remember_created_at
|
@@ -162,7 +162,7 @@ class RememberableTest < ActiveSupport::TestCase
|
|
162
162
|
end
|
163
163
|
|
164
164
|
test 'if extend_remember_period is true, remember_me! should always generate a new timestamp' do
|
165
|
-
swap Devise, :
|
165
|
+
swap Devise, remember_for: 1.year do
|
166
166
|
resource = create_resource
|
167
167
|
resource.remember_me!(true)
|
168
168
|
assert resource.remember_created_at
|
@@ -11,13 +11,13 @@ class SerializableTest < ActiveSupport::TestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
test 'should not include unsafe keys on XML even if a new except is provided' do
|
14
|
-
assert_no_match(/email/, @user.to_xml(:
|
15
|
-
assert_no_match(/confirmation-token/, @user.to_xml(:
|
14
|
+
assert_no_match(/email/, @user.to_xml(except: :email))
|
15
|
+
assert_no_match(/confirmation-token/, @user.to_xml(except: :email))
|
16
16
|
end
|
17
17
|
|
18
18
|
test 'should include unsafe keys on XML if a force_except is provided' do
|
19
|
-
assert_no_match(/<email/, @user.to_xml(:
|
20
|
-
assert_match(/confirmation-token/, @user.to_xml(:
|
19
|
+
assert_no_match(/<email/, @user.to_xml(force_except: :email))
|
20
|
+
assert_match(/confirmation-token/, @user.to_xml(force_except: :email))
|
21
21
|
end
|
22
22
|
|
23
23
|
test 'should not include unsafe keys on JSON' do
|
@@ -26,13 +26,13 @@ class SerializableTest < ActiveSupport::TestCase
|
|
26
26
|
end
|
27
27
|
|
28
28
|
test 'should not include unsafe keys on JSON even if a new except is provided' do
|
29
|
-
assert_no_key "email", from_json(:
|
30
|
-
assert_no_key "confirmation_token", from_json(:
|
29
|
+
assert_no_key "email", from_json(except: :email)
|
30
|
+
assert_no_key "confirmation_token", from_json(except: :email)
|
31
31
|
end
|
32
32
|
|
33
33
|
test 'should include unsafe keys on JSON if a force_except is provided' do
|
34
|
-
assert_no_key "email", from_json(:
|
35
|
-
assert_key "confirmation_token", from_json(:
|
34
|
+
assert_no_key "email", from_json(force_except: :email)
|
35
|
+
assert_key "confirmation_token", from_json(force_except: :email)
|
36
36
|
end
|
37
37
|
|
38
38
|
def assert_key(key, subject)
|
@@ -29,7 +29,7 @@ class TimeoutableTest < ActiveSupport::TestCase
|
|
29
29
|
end
|
30
30
|
|
31
31
|
test 'fallback to Devise config option' do
|
32
|
-
swap Devise, :
|
32
|
+
swap Devise, timeout_in: 1.minute do
|
33
33
|
user = new_user
|
34
34
|
assert user.timedout?(2.minutes.ago)
|
35
35
|
assert_not user.timedout?(30.seconds.ago)
|
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
|
4
4
|
class ValidatableTest < ActiveSupport::TestCase
|
5
5
|
test 'should require email to be set' do
|
6
|
-
user = new_user(:
|
6
|
+
user = new_user(email: nil)
|
7
7
|
assert user.invalid?
|
8
8
|
assert user.errors[:email]
|
9
9
|
assert_equal 'can\'t be blank', user.errors[:email].join
|
@@ -12,7 +12,7 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
12
12
|
test 'should require uniqueness of email if email has changed, allowing blank' do
|
13
13
|
existing_user = create_user
|
14
14
|
|
15
|
-
user = new_user(:
|
15
|
+
user = new_user(email: '')
|
16
16
|
assert user.invalid?
|
17
17
|
assert_no_match(/taken/, user.errors[:email].join)
|
18
18
|
|
@@ -20,12 +20,12 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
20
20
|
assert user.invalid?
|
21
21
|
assert_match(/taken/, user.errors[:email].join)
|
22
22
|
|
23
|
-
user.save(:
|
23
|
+
user.save(validate: false)
|
24
24
|
assert user.valid?
|
25
25
|
end
|
26
26
|
|
27
27
|
test 'should require correct email format if email has changed, allowing blank' do
|
28
|
-
user = new_user(:
|
28
|
+
user = new_user(email: '')
|
29
29
|
assert user.invalid?
|
30
30
|
assert_not_equal 'is invalid', user.errors[:email].join
|
31
31
|
|
@@ -35,26 +35,26 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
35
35
|
assert_equal 'is invalid', user.errors[:email].join
|
36
36
|
end
|
37
37
|
|
38
|
-
user.save(:
|
38
|
+
user.save(validate: false)
|
39
39
|
assert user.valid?
|
40
40
|
end
|
41
41
|
|
42
42
|
test 'should accept valid emails' do
|
43
43
|
%w(a.b.c@example.com test_mail@gmail.com any@any.net email@test.br 123@mail.test 1☃3@mail.test).each do |email|
|
44
|
-
user = new_user(:
|
44
|
+
user = new_user(email: email)
|
45
45
|
assert user.valid?, 'should be valid with email ' << email
|
46
46
|
assert_blank user.errors[:email]
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
test 'should require password to be set when creating a new record' do
|
51
|
-
user = new_user(:
|
51
|
+
user = new_user(password: '', password_confirmation: '')
|
52
52
|
assert user.invalid?
|
53
53
|
assert_equal 'can\'t be blank', user.errors[:password].join
|
54
54
|
end
|
55
55
|
|
56
56
|
test 'should require confirmation to be set when creating a new record' do
|
57
|
-
user = new_user(:
|
57
|
+
user = new_user(password: 'new_password', password_confirmation: 'blabla')
|
58
58
|
assert user.invalid?
|
59
59
|
|
60
60
|
if Devise.rails4?
|
@@ -87,13 +87,13 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
87
87
|
end
|
88
88
|
|
89
89
|
test 'should require a password with minimum of 6 characters' do
|
90
|
-
user = new_user(:
|
90
|
+
user = new_user(password: '12345', password_confirmation: '12345')
|
91
91
|
assert user.invalid?
|
92
92
|
assert_equal 'is too short (minimum is 6 characters)', user.errors[:password].join
|
93
93
|
end
|
94
94
|
|
95
95
|
test 'should require a password with maximum of 128 characters long' do
|
96
|
-
user = new_user(:
|
96
|
+
user = new_user(password: 'x'*129, password_confirmation: 'x'*129)
|
97
97
|
assert user.invalid?
|
98
98
|
assert_equal 'is too long (maximum is 128 characters)', user.errors[:password].join
|
99
99
|
end
|
@@ -109,7 +109,7 @@ class ValidatableTest < ActiveSupport::TestCase
|
|
109
109
|
end
|
110
110
|
|
111
111
|
test 'should complain about length even if password is not required' do
|
112
|
-
user = new_user(:
|
112
|
+
user = new_user(password: 'x'*129, password_confirmation: 'x'*129)
|
113
113
|
user.stubs(:password_required?).returns(false)
|
114
114
|
assert user.invalid?
|
115
115
|
assert_equal 'is too long (maximum is 128 characters)', user.errors[:password].join
|
@@ -11,12 +11,12 @@ class OmniAuthConfigTest < ActiveSupport::TestCase
|
|
11
11
|
end
|
12
12
|
|
13
13
|
test 'strategy_name returns provider if no name option are given' do
|
14
|
-
config = Devise::OmniAuth::Config.new :facebook, [{ :
|
14
|
+
config = Devise::OmniAuth::Config.new :facebook, [{ other: :option }]
|
15
15
|
assert_equal :facebook, config.strategy_name
|
16
16
|
end
|
17
17
|
|
18
18
|
test 'returns name option when have a name' do
|
19
|
-
config = Devise::OmniAuth::Config.new :facebook, [{ :
|
19
|
+
config = Devise::OmniAuth::Config.new :facebook, [{ name: :github }]
|
20
20
|
assert_equal :github, config.strategy_name
|
21
21
|
end
|
22
22
|
|
@@ -50,7 +50,7 @@ class OmniAuthConfigTest < ActiveSupport::TestCase
|
|
50
50
|
end
|
51
51
|
|
52
52
|
test 'allows the user to define a custom require path' do
|
53
|
-
config = Devise::OmniAuth::Config.new :my_strategy, [{:
|
53
|
+
config = Devise::OmniAuth::Config.new :my_strategy, [{strategy_class: MyStrategy}]
|
54
54
|
config_class = config.strategy_class
|
55
55
|
assert_equal MyStrategy, config_class
|
56
56
|
end
|
@@ -17,8 +17,8 @@ class OmniAuthRoutesTest < ActionController::TestCase
|
|
17
17
|
|
18
18
|
if with_param
|
19
19
|
# Default url params
|
20
|
-
assert_equal @controller.send(action, :user, provider, :
|
21
|
-
@controller.send("user_#{action}", provider, :
|
20
|
+
assert_equal @controller.send(action, :user, provider, param: 123),
|
21
|
+
@controller.send("user_#{action}", provider, param: 123)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -44,7 +44,7 @@ class OmniAuthRoutesTest < ActionController::TestCase
|
|
44
44
|
|
45
45
|
test 'should generate authorization path with params' do
|
46
46
|
assert_match "/users/auth/openid?openid_url=http%3A%2F%2Fyahoo.com",
|
47
|
-
@controller.omniauth_authorize_path(:user, :openid, :
|
47
|
+
@controller.omniauth_authorize_path(:user, :openid, openid_url: "http://yahoo.com")
|
48
48
|
end
|
49
49
|
|
50
50
|
test 'should not add a "?" if no param was sent' do
|
@@ -27,7 +27,7 @@ if defined?(ActionController::StrongParameters)
|
|
27
27
|
end
|
28
28
|
|
29
29
|
test 'handles auth keys as a hash' do
|
30
|
-
swap Devise, :
|
30
|
+
swap Devise, authentication_keys: {email: true} do
|
31
31
|
sanitizer = sanitizer(user: { "email" => "jose", "password" => "invalid" })
|
32
32
|
assert_equal({ "email" => "jose", "password" => "invalid" }, sanitizer.sanitize(:sign_in))
|
33
33
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
class ApplicationController < ActionController::Base
|
5
5
|
protect_from_forgery
|
6
|
-
before_filter :current_user, :
|
7
|
-
before_filter :authenticate_user!, :
|
6
|
+
before_filter :current_user, unless: :devise_controller?
|
7
|
+
before_filter :authenticate_user!, if: :devise_controller?
|
8
8
|
respond_to *Mime::SET.map(&:to_sym)
|
9
9
|
end
|
@@ -2,13 +2,13 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
2
2
|
def facebook
|
3
3
|
data = env["omniauth.auth"]
|
4
4
|
session["devise.facebook_data"] = data["extra"]["user_hash"]
|
5
|
-
render :
|
5
|
+
render json: data
|
6
6
|
end
|
7
7
|
|
8
8
|
def sign_in_facebook
|
9
9
|
user = User.find_by_email('user@test.com')
|
10
10
|
user.remember_me = true
|
11
11
|
sign_in user
|
12
|
-
render :
|
12
|
+
render text: ""
|
13
13
|
end
|
14
14
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class UsersController < ApplicationController
|
2
|
-
prepend_before_filter :current_user, :
|
3
|
-
before_filter :authenticate_user!, :
|
2
|
+
prepend_before_filter :current_user, only: :exhibit
|
3
|
+
before_filter :authenticate_user!, except: [:accept, :exhibit]
|
4
4
|
respond_to :html, :xml
|
5
5
|
|
6
6
|
def index
|
@@ -13,7 +13,7 @@ class UsersController < ApplicationController
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def update_form
|
16
|
-
render :
|
16
|
+
render text: 'Update'
|
17
17
|
end
|
18
18
|
|
19
19
|
def accept
|
@@ -21,11 +21,11 @@ class UsersController < ApplicationController
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def exhibit
|
24
|
-
render :
|
24
|
+
render text: current_user ? "User is authenticated" : "User is not authenticated"
|
25
25
|
end
|
26
26
|
|
27
27
|
def expire
|
28
28
|
user_session['last_request_at'] = 31.minutes.ago.utc
|
29
|
-
render :
|
29
|
+
render text: 'User will be expired on next request'
|
30
30
|
end
|
31
31
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class Users::Mailer < Devise::Mailer
|
2
|
-
default :
|
2
|
+
default from: 'custom@example.com'
|
3
3
|
end
|
4
4
|
|
5
5
|
class Users::ReplyToMailer < Devise::Mailer
|
6
|
-
default :
|
7
|
-
default :
|
6
|
+
default from: 'custom@example.com'
|
7
|
+
default reply_to: 'custom_reply_to@example.com'
|
8
8
|
end
|
9
9
|
|
10
10
|
class Users::FromProcMailer < Devise::Mailer
|
11
|
-
default :
|
11
|
+
default from: proc { 'custom@example.com' }
|
12
12
|
end
|
@@ -6,24 +6,24 @@ class Admin
|
|
6
6
|
include SharedAdmin
|
7
7
|
|
8
8
|
## Database authenticatable
|
9
|
-
field :email, :
|
10
|
-
field :encrypted_password, :
|
9
|
+
field :email, type: String
|
10
|
+
field :encrypted_password, type: String
|
11
11
|
|
12
12
|
## Recoverable
|
13
|
-
field :reset_password_token, :
|
14
|
-
field :reset_password_sent_at, :
|
13
|
+
field :reset_password_token, type: String
|
14
|
+
field :reset_password_sent_at, type: Time
|
15
15
|
|
16
16
|
## Rememberable
|
17
|
-
field :remember_created_at, :
|
17
|
+
field :remember_created_at, type: Time
|
18
18
|
|
19
19
|
## Confirmable
|
20
|
-
field :confirmation_token, :
|
21
|
-
field :confirmed_at, :
|
22
|
-
field :confirmation_sent_at, :
|
23
|
-
field :unconfirmed_email, :
|
20
|
+
field :confirmation_token, type: String
|
21
|
+
field :confirmed_at, type: Time
|
22
|
+
field :confirmation_sent_at, type: Time
|
23
|
+
field :unconfirmed_email, type: String # Only if using reconfirmable
|
24
24
|
|
25
25
|
## Lockable
|
26
|
-
field :locked_at, :
|
26
|
+
field :locked_at, type: Time
|
27
27
|
|
28
|
-
field :active, :
|
28
|
+
field :active, type: Boolean, default: false
|
29
29
|
end
|
@@ -3,7 +3,7 @@ module Shim
|
|
3
3
|
|
4
4
|
included do
|
5
5
|
include ::Mongoid::Timestamps
|
6
|
-
field :created_at, :
|
6
|
+
field :created_at, type: DateTime
|
7
7
|
end
|
8
8
|
|
9
9
|
module ClassMethods
|
@@ -12,7 +12,7 @@ module Shim
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def find_by_email(email)
|
15
|
-
find_by(:
|
15
|
+
find_by(email: email)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -5,35 +5,35 @@ class User
|
|
5
5
|
include Shim
|
6
6
|
include SharedUser
|
7
7
|
|
8
|
-
field :username, :
|
9
|
-
field :facebook_token, :
|
8
|
+
field :username, type: String
|
9
|
+
field :facebook_token, type: String
|
10
10
|
|
11
11
|
## Database authenticatable
|
12
|
-
field :email, :
|
13
|
-
field :encrypted_password, :
|
12
|
+
field :email, type: String, default: ""
|
13
|
+
field :encrypted_password, type: String, default: ""
|
14
14
|
|
15
15
|
## Recoverable
|
16
|
-
field :reset_password_token, :
|
17
|
-
field :reset_password_sent_at, :
|
16
|
+
field :reset_password_token, type: String
|
17
|
+
field :reset_password_sent_at, type: Time
|
18
18
|
|
19
19
|
## Rememberable
|
20
|
-
field :remember_created_at, :
|
20
|
+
field :remember_created_at, type: Time
|
21
21
|
|
22
22
|
## Trackable
|
23
|
-
field :sign_in_count, :
|
24
|
-
field :current_sign_in_at, :
|
25
|
-
field :last_sign_in_at, :
|
26
|
-
field :current_sign_in_ip, :
|
27
|
-
field :last_sign_in_ip, :
|
23
|
+
field :sign_in_count, type: Integer, default: 0
|
24
|
+
field :current_sign_in_at, type: Time
|
25
|
+
field :last_sign_in_at, type: Time
|
26
|
+
field :current_sign_in_ip, type: String
|
27
|
+
field :last_sign_in_ip, type: String
|
28
28
|
|
29
29
|
## Confirmable
|
30
|
-
field :confirmation_token, :
|
31
|
-
field :confirmed_at, :
|
32
|
-
field :confirmation_sent_at, :
|
33
|
-
# field :unconfirmed_email, :
|
30
|
+
field :confirmation_token, type: String
|
31
|
+
field :confirmed_at, type: Time
|
32
|
+
field :confirmation_sent_at, type: Time
|
33
|
+
# field :unconfirmed_email, type: String # Only if using reconfirmable
|
34
34
|
|
35
35
|
## Lockable
|
36
|
-
field :failed_attempts, :
|
37
|
-
field :unlock_token, :
|
38
|
-
field :locked_at, :
|
36
|
+
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
|
37
|
+
field :unlock_token, type: String # Only if unlock strategy is :email or :both
|
38
|
+
field :locked_at, type: Time
|
39
39
|
end
|