devise 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (187) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +18 -3
  3. data/CHANGELOG.md +82 -9
  4. data/CONTRIBUTING.md +2 -2
  5. data/Gemfile +7 -9
  6. data/Gemfile.lock +102 -96
  7. data/MIT-LICENSE +1 -1
  8. data/README.md +94 -42
  9. data/Rakefile +1 -1
  10. data/app/controllers/devise/confirmations_controller.rb +5 -3
  11. data/app/controllers/devise/omniauth_callbacks_controller.rb +2 -2
  12. data/app/controllers/devise/passwords_controller.rb +5 -3
  13. data/app/controllers/devise/registrations_controller.rb +26 -10
  14. data/app/controllers/devise/sessions_controller.rb +39 -14
  15. data/app/controllers/devise/unlocks_controller.rb +4 -2
  16. data/app/controllers/devise_controller.rb +6 -6
  17. data/app/helpers/devise_helper.rb +2 -2
  18. data/app/views/devise/confirmations/new.html.erb +2 -2
  19. data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
  20. data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
  21. data/app/views/devise/mailer/unlock_instructions.html.erb +1 -1
  22. data/app/views/devise/passwords/edit.html.erb +3 -3
  23. data/app/views/devise/passwords/new.html.erb +2 -2
  24. data/app/views/devise/registrations/edit.html.erb +6 -6
  25. data/app/views/devise/registrations/new.html.erb +5 -5
  26. data/app/views/devise/sessions/new.html.erb +5 -5
  27. data/app/views/devise/shared/_links.erb +1 -1
  28. data/app/views/devise/unlocks/new.html.erb +2 -2
  29. data/config/locales/en.yml +17 -16
  30. data/devise.gemspec +2 -2
  31. data/gemfiles/{Gemfile.rails-3.2.x → Gemfile.rails-3.2-stable} +8 -10
  32. data/gemfiles/Gemfile.rails-3.2-stable.lock +166 -0
  33. data/gemfiles/Gemfile.rails-4.0-stable +29 -0
  34. data/gemfiles/Gemfile.rails-4.0-stable.lock +162 -0
  35. data/gemfiles/Gemfile.rails-head +32 -0
  36. data/gemfiles/Gemfile.rails-head.lock +190 -0
  37. data/lib/devise/controllers/helpers.rb +84 -29
  38. data/lib/devise/controllers/rememberable.rb +3 -3
  39. data/lib/devise/controllers/scoped_views.rb +1 -1
  40. data/lib/devise/controllers/sign_in_out.rb +9 -10
  41. data/lib/devise/controllers/store_location.rb +56 -0
  42. data/lib/devise/controllers/url_helpers.rb +3 -1
  43. data/lib/devise/failure_app.rb +12 -10
  44. data/lib/devise/hooks/activatable.rb +5 -6
  45. data/lib/devise/hooks/csrf_cleaner.rb +3 -1
  46. data/lib/devise/hooks/lockable.rb +1 -1
  47. data/lib/devise/hooks/proxy.rb +2 -2
  48. data/lib/devise/hooks/rememberable.rb +2 -2
  49. data/lib/devise/hooks/timeoutable.rb +10 -3
  50. data/lib/devise/hooks/trackable.rb +1 -1
  51. data/lib/devise/mailers/helpers.rb +8 -8
  52. data/lib/devise/mapping.rb +4 -1
  53. data/lib/devise/models/authenticatable.rb +5 -5
  54. data/lib/devise/models/confirmable.rb +14 -14
  55. data/lib/devise/models/database_authenticatable.rb +18 -5
  56. data/lib/devise/models/lockable.rb +14 -11
  57. data/lib/devise/models/omniauthable.rb +1 -1
  58. data/lib/devise/models/recoverable.rb +23 -7
  59. data/lib/devise/models/rememberable.rb +6 -6
  60. data/lib/devise/models/timeoutable.rb +2 -2
  61. data/lib/devise/models/trackable.rb +5 -2
  62. data/lib/devise/models/validatable.rb +6 -6
  63. data/lib/devise/modules.rb +10 -10
  64. data/lib/devise/omniauth/url_helpers.rb +2 -2
  65. data/lib/devise/orm/active_record.rb +1 -1
  66. data/lib/devise/orm/mongoid.rb +1 -1
  67. data/lib/devise/rails/routes.rb +107 -78
  68. data/lib/devise/rails.rb +7 -1
  69. data/lib/devise/strategies/authenticatable.rb +11 -4
  70. data/lib/devise/strategies/base.rb +1 -1
  71. data/lib/devise/strategies/database_authenticatable.rb +7 -4
  72. data/lib/devise/test_helpers.rb +2 -2
  73. data/lib/devise/time_inflector.rb +2 -2
  74. data/lib/devise/version.rb +1 -1
  75. data/lib/devise.rb +15 -10
  76. data/lib/generators/active_record/devise_generator.rb +27 -10
  77. data/lib/generators/active_record/templates/migration.rb +4 -4
  78. data/lib/generators/active_record/templates/migration_existing.rb +4 -4
  79. data/lib/generators/devise/devise_generator.rb +5 -3
  80. data/lib/generators/devise/install_generator.rb +5 -0
  81. data/lib/generators/devise/views_generator.rb +31 -18
  82. data/lib/generators/mongoid/devise_generator.rb +20 -19
  83. data/lib/generators/templates/README +4 -4
  84. data/lib/generators/templates/devise.rb +20 -11
  85. data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
  86. data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
  87. data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
  88. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +2 -2
  89. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +4 -4
  90. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +2 -2
  91. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +6 -6
  92. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +4 -4
  93. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +4 -4
  94. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +2 -2
  95. data/script/cached-bundle +49 -0
  96. data/script/s3-put +71 -0
  97. data/test/controllers/custom_registrations_controller_test.rb +35 -0
  98. data/test/controllers/helpers_test.rb +89 -31
  99. data/test/controllers/internal_helpers_test.rb +11 -8
  100. data/test/controllers/passwords_controller_test.rb +1 -1
  101. data/test/controllers/sessions_controller_test.rb +29 -25
  102. data/test/controllers/url_helpers_test.rb +4 -4
  103. data/test/delegator_test.rb +1 -1
  104. data/test/devise_test.rb +21 -8
  105. data/test/failure_app_test.rb +61 -25
  106. data/test/generators/active_record_generator_test.rb +10 -4
  107. data/test/generators/devise_generator_test.rb +2 -2
  108. data/test/generators/mongoid_generator_test.rb +3 -3
  109. data/test/generators/views_generator_test.rb +30 -1
  110. data/test/helpers/devise_helper_test.rb +14 -13
  111. data/test/integration/authenticatable_test.rb +61 -45
  112. data/test/integration/confirmable_test.rb +95 -55
  113. data/test/integration/database_authenticatable_test.rb +16 -16
  114. data/test/integration/http_authenticatable_test.rb +12 -12
  115. data/test/integration/lockable_test.rb +43 -43
  116. data/test/integration/omniauthable_test.rb +3 -3
  117. data/test/integration/recoverable_test.rb +53 -53
  118. data/test/integration/registerable_test.rb +90 -80
  119. data/test/integration/rememberable_test.rb +15 -15
  120. data/test/integration/timeoutable_test.rb +27 -16
  121. data/test/integration/trackable_test.rb +4 -4
  122. data/test/mailers/confirmation_instructions_test.rb +7 -7
  123. data/test/mailers/reset_password_instructions_test.rb +6 -6
  124. data/test/mailers/unlock_instructions_test.rb +5 -5
  125. data/test/mapping_test.rb +3 -3
  126. data/test/models/authenticatable_test.rb +3 -3
  127. data/test/models/confirmable_test.rb +32 -32
  128. data/test/models/database_authenticatable_test.rb +32 -27
  129. data/test/models/lockable_test.rb +57 -33
  130. data/test/models/recoverable_test.rb +34 -22
  131. data/test/models/rememberable_test.rb +29 -14
  132. data/test/models/serializable_test.rb +8 -8
  133. data/test/models/timeoutable_test.rb +1 -1
  134. data/test/models/trackable_test.rb +28 -0
  135. data/test/models/validatable_test.rb +13 -13
  136. data/test/omniauth/config_test.rb +4 -4
  137. data/test/omniauth/url_helpers_test.rb +3 -3
  138. data/test/orm/mongoid.rb +1 -1
  139. data/test/parameter_sanitizer_test.rb +1 -1
  140. data/test/rails_app/app/active_record/shim.rb +1 -1
  141. data/test/rails_app/app/active_record/user_on_engine.rb +7 -0
  142. data/test/rails_app/app/active_record/user_on_main_app.rb +7 -0
  143. data/test/rails_app/app/controllers/admins/sessions_controller.rb +1 -1
  144. data/test/rails_app/app/controllers/admins_controller.rb +1 -1
  145. data/test/rails_app/app/controllers/application_controller.rb +5 -2
  146. data/test/rails_app/app/controllers/application_with_fake_engine.rb +30 -0
  147. data/test/rails_app/app/controllers/custom/registrations_controller.rb +21 -0
  148. data/test/rails_app/app/controllers/home_controller.rb +1 -1
  149. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +1 -1
  150. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +1 -1
  151. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +4 -4
  152. data/test/rails_app/app/controllers/users_controller.rb +6 -6
  153. data/test/rails_app/app/mailers/users/mailer.rb +4 -4
  154. data/test/rails_app/app/mongoid/admin.rb +11 -11
  155. data/test/rails_app/app/mongoid/shim.rb +2 -2
  156. data/test/rails_app/app/mongoid/user.rb +19 -19
  157. data/test/rails_app/app/mongoid/user_on_engine.rb +39 -0
  158. data/test/rails_app/app/mongoid/user_on_main_app.rb +39 -0
  159. data/test/rails_app/app/views/admins/sessions/new.html.erb +1 -1
  160. data/test/rails_app/app/views/home/admin_dashboard.html.erb +1 -1
  161. data/test/rails_app/app/views/home/index.html.erb +1 -1
  162. data/test/rails_app/app/views/home/join.html.erb +1 -1
  163. data/test/rails_app/app/views/home/user_dashboard.html.erb +1 -1
  164. data/test/rails_app/app/views/layouts/application.html.erb +1 -1
  165. data/test/rails_app/config/application.rb +2 -2
  166. data/test/rails_app/config/boot.rb +7 -1
  167. data/test/rails_app/config/environments/development.rb +0 -4
  168. data/test/rails_app/config/environments/production.rb +0 -4
  169. data/test/rails_app/config/initializers/devise.rb +7 -5
  170. data/test/rails_app/config/initializers/secret_token.rb +1 -1
  171. data/test/rails_app/config/routes.rb +60 -42
  172. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +7 -7
  173. data/test/rails_app/db/schema.rb +21 -17
  174. data/test/rails_app/lib/shared_admin.rb +4 -4
  175. data/test/rails_app/lib/shared_user.rb +1 -1
  176. data/test/rails_app/lib/shared_user_without_omniauth.rb +13 -0
  177. data/test/routes_test.rb +72 -58
  178. data/test/support/action_controller/record_identifier.rb +10 -0
  179. data/test/support/assertions.rb +2 -3
  180. data/test/support/helpers.rb +4 -4
  181. data/test/support/integration.rb +14 -14
  182. data/test/support/mongoid.yml +6 -0
  183. data/test/test_helper.rb +2 -7
  184. data/test/test_helpers_test.rb +25 -35
  185. data/test/test_models.rb +12 -5
  186. metadata +53 -38
  187. data/gemfiles/Gemfile.rails-3.2.x.lock +0 -159
@@ -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, :param => 123),
21
- @controller.send("user_#{action}", provider, :param => 123)
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, :openid_url => "http://yahoo.com")
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
data/test/orm/mongoid.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'mongoid/version'
2
2
 
3
3
  Mongoid.configure do |config|
4
- config.connect_to("devise-test-suite")
4
+ config.load!('test/support/mongoid.yml')
5
5
  config.use_utc = true
6
6
  config.include_root_in_json = true
7
7
  end
@@ -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, :authentication_keys => {:email => true} do
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
@@ -1,2 +1,2 @@
1
1
  module Shim
2
- end
2
+ end
@@ -0,0 +1,7 @@
1
+ require 'shared_user_without_omniauth'
2
+
3
+ class UserOnEngine < ActiveRecord::Base
4
+ self.table_name = 'users'
5
+ include Shim
6
+ include SharedUserWithoutOmniauth
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'shared_user_without_omniauth'
2
+
3
+ class UserOnMainApp < ActiveRecord::Base
4
+ self.table_name = 'users'
5
+ include Shim
6
+ include SharedUserWithoutOmniauth
7
+ end
@@ -3,4 +3,4 @@ class Admins::SessionsController < Devise::SessionsController
3
3
  flash[:special] = "Welcome to #{controller_path.inspect} controller!"
4
4
  super
5
5
  end
6
- end
6
+ end
@@ -6,6 +6,6 @@ class AdminsController < ApplicationController
6
6
 
7
7
  def expire
8
8
  admin_session['last_request_at'] = 31.minutes.ago.utc
9
- render :text => 'Admin will be expired on next request'
9
+ render text: 'Admin will be expired on next request'
10
10
  end
11
11
  end
@@ -3,7 +3,10 @@
3
3
 
4
4
  class ApplicationController < ActionController::Base
5
5
  protect_from_forgery
6
- before_filter :current_user, :unless => :devise_controller?
7
- before_filter :authenticate_user!, :if => :devise_controller?
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
+
10
+ devise_group :commenter, contains: [:user, :admin]
9
11
  end
12
+
@@ -0,0 +1,30 @@
1
+ class ApplicationWithFakeEngine < ApplicationController
2
+ private
3
+
4
+ helper_method :fake_engine
5
+ def fake_engine
6
+ @fake_engine ||= FakeEngine.new
7
+ end
8
+ end
9
+
10
+ class FakeEngine
11
+ def user_on_engine_confirmation_path
12
+ '/user_on_engine/confirmation'
13
+ end
14
+
15
+ def new_user_on_engine_session_path
16
+ '/user_on_engine/confirmation/new'
17
+ end
18
+
19
+ def new_user_on_engine_registration_path
20
+ '/user_on_engine/registration/new'
21
+ end
22
+
23
+ def new_user_on_engine_password_path
24
+ '/user_on_engine/password/new'
25
+ end
26
+
27
+ def new_user_on_engine_unlock_path
28
+ '/user_on_engine/unlock/new'
29
+ end
30
+ end
@@ -0,0 +1,21 @@
1
+ class Custom::RegistrationsController < Devise::RegistrationsController
2
+ def create
3
+ super do |resource|
4
+ @create_block_called = true
5
+ end
6
+ end
7
+
8
+ def update
9
+ super do |resource|
10
+ @update_block_called = true
11
+ end
12
+ end
13
+
14
+ def create_block_called?
15
+ @create_block_called == true
16
+ end
17
+
18
+ def update_block_called?
19
+ @update_block_called == true
20
+ end
21
+ end
@@ -20,6 +20,6 @@ class HomeController < ApplicationController
20
20
  end
21
21
 
22
22
  def unauthenticated
23
- render :text => "unauthenticated", :status => :unauthorized
23
+ render text: "unauthenticated", status: :unauthorized
24
24
  end
25
25
  end
@@ -1,2 +1,2 @@
1
1
  class Publisher::RegistrationsController < ApplicationController
2
- end
2
+ end
@@ -1,2 +1,2 @@
1
1
  class Publisher::SessionsController < ApplicationController
2
- end
2
+ 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 :json => data
5
+ render json: data
6
6
  end
7
7
 
8
8
  def sign_in_facebook
9
- user = User.find_by_email('user@test.com')
9
+ user = User.to_adapter.find_first(email: 'user@test.com')
10
10
  user.remember_me = true
11
11
  sign_in user
12
- render :text => ""
12
+ render text: ""
13
13
  end
14
- end
14
+ end
@@ -1,6 +1,6 @@
1
1
  class UsersController < ApplicationController
2
- prepend_before_filter :current_user, :only => :exhibit
3
- before_filter :authenticate_user!, :except => [:accept, :exhibit]
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
@@ -9,11 +9,11 @@ class UsersController < ApplicationController
9
9
  end
10
10
 
11
11
  def edit_form
12
- user_session['last_request_at'] = 31.minutes.ago.utc
12
+ user_session['last_request_at'] = params.fetch(:last_request_at, 31.minutes.ago.utc)
13
13
  end
14
14
 
15
15
  def update_form
16
- render :text => 'Update'
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 :text => current_user ? "User is authenticated" : "User is not authenticated"
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 :text => 'User will be expired on next request'
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 :from => 'custom@example.com'
2
+ default from: 'custom@example.com'
3
3
  end
4
4
 
5
5
  class Users::ReplyToMailer < Devise::Mailer
6
- default :from => 'custom@example.com'
7
- default :reply_to => 'custom_reply_to@example.com'
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 :from => proc { 'custom@example.com' }
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, :type => String
10
- field :encrypted_password, :type => String
9
+ field :email, type: String
10
+ field :encrypted_password, type: String
11
11
 
12
12
  ## Recoverable
13
- field :reset_password_token, :type => String
14
- field :reset_password_sent_at, :type => Time
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, :type => Time
17
+ field :remember_created_at, type: Time
18
18
 
19
19
  ## Confirmable
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
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, :type => Time
26
+ field :locked_at, type: Time
27
27
 
28
- field :active, :type => Boolean, :default => false
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, :type => DateTime
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(:email => email)
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, :type => String
9
- field :facebook_token, :type => String
8
+ field :username, type: String
9
+ field :facebook_token, type: String
10
10
 
11
11
  ## Database authenticatable
12
- field :email, :type => String, :default => ""
13
- field :encrypted_password, :type => String, :default => ""
12
+ field :email, type: String, default: ""
13
+ field :encrypted_password, type: String, default: ""
14
14
 
15
15
  ## Recoverable
16
- field :reset_password_token, :type => String
17
- field :reset_password_sent_at, :type => Time
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, :type => Time
20
+ field :remember_created_at, type: Time
21
21
 
22
22
  ## Trackable
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
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, :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
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, :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
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
@@ -0,0 +1,39 @@
1
+ require 'shared_user_without_omniauth'
2
+
3
+ class UserOnEngine
4
+ include Mongoid::Document
5
+ include Shim
6
+ include SharedUserWithoutOmniauth
7
+
8
+ field :username, type: String
9
+ field :facebook_token, type: String
10
+
11
+ ## Database authenticatable
12
+ field :email, type: String, default: ""
13
+ field :encrypted_password, type: String, default: ""
14
+
15
+ ## Recoverable
16
+ field :reset_password_token, type: String
17
+ field :reset_password_sent_at, type: Time
18
+
19
+ ## Rememberable
20
+ field :remember_created_at, type: Time
21
+
22
+ ## Trackable
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
+
29
+ ## Confirmable
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
+
35
+ ## Lockable
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
+ end
@@ -0,0 +1,39 @@
1
+ require 'shared_user_without_omniauth'
2
+
3
+ class UserOnMainApp
4
+ include Mongoid::Document
5
+ include Shim
6
+ include SharedUserWithoutOmniauth
7
+
8
+ field :username, type: String
9
+ field :facebook_token, type: String
10
+
11
+ ## Database authenticatable
12
+ field :email, type: String, default: ""
13
+ field :encrypted_password, type: String, default: ""
14
+
15
+ ## Recoverable
16
+ field :reset_password_token, type: String
17
+ field :reset_password_sent_at, type: Time
18
+
19
+ ## Rememberable
20
+ field :remember_created_at, type: Time
21
+
22
+ ## Trackable
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
+
29
+ ## Confirmable
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
+
35
+ ## Lockable
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
+ end
@@ -1,2 +1,2 @@
1
1
  Welcome to "sessions/new" view!
2
- <%= render :file => "devise/sessions/new" %>
2
+ <%= render file: "devise/sessions/new" %>
@@ -1 +1 @@
1
- Admin dashboard
1
+ Admin dashboard
@@ -1 +1 @@
1
- Home!
1
+ Home!
@@ -1 +1 @@
1
- Join
1
+ Join
@@ -1 +1 @@
1
- User dashboard
1
+ User dashboard
@@ -7,7 +7,7 @@
7
7
  <body>
8
8
  <div id="container">
9
9
  <%- flash.each do |name, msg| -%>
10
- <%= content_tag :div, msg, :id => "flash_#{name}" %>
10
+ <%= content_tag :div, msg, id: "flash_#{name}" %>
11
11
  <%- end -%>
12
12
 
13
13
  <% if user_signed_in? -%>
@@ -23,14 +23,14 @@ module RailsApp
23
23
  # config.generators do |g|
24
24
  # g.orm :active_record
25
25
  # g.template_engine :erb
26
- # g.test_framework :test_unit, :fixture => true
26
+ # g.test_framework :test_unit, fixture: true
27
27
  # end
28
28
 
29
29
  # Configure sensitive parameters which will be filtered from the log file.
30
30
  config.filter_parameters << :password
31
31
  config.assets.enabled = false
32
32
 
33
- config.action_mailer.default_url_options = { :host => "localhost:3000" }
33
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
34
34
 
35
35
  # This was used to break devise in some situations
36
36
  config.to_prepare do
@@ -2,7 +2,13 @@ unless defined?(DEVISE_ORM)
2
2
  DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
3
3
  end
4
4
 
5
+ module Devise
6
+ # Detection for minor differences between Rails 3.2 and 4 in tests.
7
+ def self.rails4?
8
+ Rails.version.start_with? '4'
9
+ end
10
+ end
11
+
5
12
  # Set up gems listed in the Gemfile.
6
13
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
7
-
8
14
  require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -22,10 +22,6 @@ RailsApp::Application.configure do
22
22
  # Only use best-standards-support built into browsers.
23
23
  config.action_dispatch.best_standards_support = :builtin
24
24
 
25
- # Log the query plan for queries taking more than this (works
26
- # with SQLite, MySQL, and PostgreSQL).
27
- config.active_record.auto_explain_threshold_in_seconds = 0.5
28
-
29
25
  # Raise an error on page load if there are pending migrations
30
26
  config.active_record.migration_error = :page_load
31
27
 
@@ -72,10 +72,6 @@ RailsApp::Application.configure do
72
72
  # Send deprecation notices to registered listeners.
73
73
  config.active_support.deprecation = :notify
74
74
 
75
- # Log the query plan for queries taking more than this (works
76
- # with SQLite, MySQL, and PostgreSQL).
77
- # config.active_record.auto_explain_threshold_in_seconds = 0.5
78
-
79
75
  # Disable automatic flushing of the log to improve performance.
80
76
  # config.autoflush_log = false
81
77
 
@@ -12,6 +12,8 @@ Devise.setup do |config|
12
12
  # note that it will be overwritten if you use your own mailer class with default "from" parameter.
13
13
  config.mailer_sender = "please-change-me@config-initializers-devise.com"
14
14
 
15
+
16
+ config.parent_controller = "ApplicationWithFakeEngine"
15
17
  # Configure the class responsible to send e-mails.
16
18
  # config.mailer = "Devise::Mailer"
17
19
 
@@ -66,8 +68,8 @@ Devise.setup do |config|
66
68
  config.stretches = Rails.env.test? ? 1 : 10
67
69
 
68
70
  # ==> Configuration for :confirmable
69
- # The time you want to give your user to confirm his account. During this time
70
- # he will be able to access your application without confirming. Default is nil.
71
+ # The time you want to give your user to confirm their account. During this time
72
+ # they will be able to access your application without confirming. Default is nil.
71
73
  # When allow_unconfirmed_access_for is zero, the user won't be able to sign in without confirming.
72
74
  # You can use this to let your user access some features of your application
73
75
  # without confirming the account, but blocking it after a certain period
@@ -166,9 +168,9 @@ Devise.setup do |config|
166
168
  # config.sign_out_via = :get
167
169
 
168
170
  # ==> OmniAuth
169
- config.omniauth :facebook, 'APP_ID', 'APP_SECRET', :scope => 'email,offline_access'
171
+ config.omniauth :facebook, 'APP_ID', 'APP_SECRET', scope: 'email,offline_access'
170
172
  config.omniauth :openid
171
- config.omniauth :openid, :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
173
+ config.omniauth :openid, name: 'google', identifier: 'https://www.google.com/accounts/o8/id'
172
174
 
173
175
  # ==> Warden configuration
174
176
  # If you want to use other strategies, that are not supported by Devise, or
@@ -176,6 +178,6 @@ Devise.setup do |config|
176
178
  #
177
179
  # config.warden do |manager|
178
180
  # manager.failure_app = AnotherApp
179
- # manager.default_strategies(:scope => :user).unshift :some_external_strategy
181
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
180
182
  # end
181
183
  end
@@ -4,5 +4,5 @@ if Devise.rails4?
4
4
  config.secret_key_base = 'd588e99efff13a86461fd6ab82327823ad2f8feb5dc217ce652cdd9f0dfc5eb4b5a62a92d24d2574d7d51dfb1ea8dd453ea54e00cf672159a13104a135422a10'
5
5
  else
6
6
  config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
7
- config.session_store :cookie_store, :key => "_my_app"
7
+ config.session_store :cookie_store, key: "_my_app"
8
8
  end