devise 4.4.3 → 4.9.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +159 -3
- data/MIT-LICENSE +2 -1
- data/README.md +128 -64
- data/app/controllers/devise/confirmations_controller.rb +1 -0
- data/app/controllers/devise/passwords_controller.rb +3 -2
- data/app/controllers/devise/registrations_controller.rb +27 -9
- data/app/controllers/devise/sessions_controller.rb +1 -1
- data/app/controllers/devise/unlocks_controller.rb +1 -0
- data/app/controllers/devise_controller.rb +4 -3
- data/app/helpers/devise_helper.rb +21 -18
- data/app/mailers/devise/mailer.rb +5 -5
- data/app/views/devise/confirmations/new.html.erb +1 -1
- data/app/views/devise/passwords/edit.html.erb +3 -3
- data/app/views/devise/passwords/new.html.erb +1 -1
- data/app/views/devise/registrations/edit.html.erb +5 -5
- data/app/views/devise/registrations/new.html.erb +3 -3
- data/app/views/devise/sessions/new.html.erb +3 -3
- data/app/views/devise/shared/_error_messages.html.erb +15 -0
- data/app/views/devise/shared/_links.html.erb +8 -8
- data/app/views/devise/unlocks/new.html.erb +1 -1
- data/config/locales/en.yml +3 -2
- data/lib/devise/controllers/helpers.rb +8 -8
- data/lib/devise/controllers/responder.rb +35 -0
- data/lib/devise/controllers/sign_in_out.rb +8 -3
- data/lib/devise/controllers/url_helpers.rb +1 -1
- data/lib/devise/failure_app.rb +31 -7
- data/lib/devise/hooks/csrf_cleaner.rb +6 -1
- data/lib/devise/hooks/lockable.rb +2 -5
- data/lib/devise/hooks/timeoutable.rb +2 -2
- data/lib/devise/mapping.rb +1 -1
- data/lib/devise/models/authenticatable.rb +51 -48
- data/lib/devise/models/confirmable.rb +34 -40
- data/lib/devise/models/database_authenticatable.rb +54 -35
- data/lib/devise/models/lockable.rb +13 -5
- data/lib/devise/models/omniauthable.rb +2 -2
- data/lib/devise/models/recoverable.rb +8 -19
- data/lib/devise/models/registerable.rb +2 -0
- data/lib/devise/models/rememberable.rb +2 -2
- data/lib/devise/models/timeoutable.rb +1 -1
- data/lib/devise/models/trackable.rb +9 -2
- data/lib/devise/models/validatable.rb +4 -9
- data/lib/devise/models.rb +1 -0
- data/lib/devise/omniauth.rb +2 -5
- data/lib/devise/orm.rb +71 -0
- data/lib/devise/parameter_filter.rb +2 -0
- data/lib/devise/parameter_sanitizer.rb +13 -1
- data/lib/devise/rails/deprecated_constant_accessor.rb +39 -0
- data/lib/devise/rails/routes.rb +6 -6
- data/lib/devise/secret_key_finder.rb +2 -0
- data/lib/devise/strategies/authenticatable.rb +1 -1
- data/lib/devise/strategies/database_authenticatable.rb +6 -1
- data/lib/devise/test/controller_helpers.rb +4 -2
- data/lib/devise/test/integration_helpers.rb +1 -1
- data/lib/devise/version.rb +1 -1
- data/lib/devise.rb +34 -11
- data/lib/generators/active_record/devise_generator.rb +26 -11
- data/lib/generators/devise/controllers_generator.rb +1 -1
- data/lib/generators/devise/devise_generator.rb +1 -1
- data/lib/generators/devise/install_generator.rb +1 -5
- data/lib/generators/devise/orm_helpers.rb +2 -2
- data/lib/generators/devise/views_generator.rb +1 -1
- data/lib/generators/mongoid/devise_generator.rb +5 -5
- data/lib/generators/templates/README +9 -1
- data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +1 -1
- data/lib/generators/templates/devise.rb +38 -8
- data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +5 -1
- data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +10 -2
- data/lib/generators/templates/simple_form_for/passwords/new.html.erb +4 -1
- data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +12 -4
- data/lib/generators/templates/simple_form_for/registrations/new.html.erb +11 -3
- data/lib/generators/templates/simple_form_for/sessions/new.html.erb +7 -2
- data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +4 -1
- metadata +23 -316
- data/.gitignore +0 -10
- data/.travis.yml +0 -68
- data/.yardopts +0 -9
- data/CODE_OF_CONDUCT.md +0 -22
- data/CONTRIBUTING.md +0 -79
- data/Gemfile +0 -39
- data/Gemfile.lock +0 -193
- data/ISSUE_TEMPLATE.md +0 -19
- data/Rakefile +0 -37
- data/bin/test +0 -13
- data/devise.gemspec +0 -28
- data/devise.png +0 -0
- data/gemfiles/Gemfile.rails-4.1-stable +0 -32
- data/gemfiles/Gemfile.rails-4.1-stable.lock +0 -171
- data/gemfiles/Gemfile.rails-4.2-stable +0 -32
- data/gemfiles/Gemfile.rails-4.2-stable.lock +0 -192
- data/gemfiles/Gemfile.rails-5.0-stable +0 -33
- data/gemfiles/Gemfile.rails-5.0-stable.lock +0 -192
- data/gemfiles/Gemfile.rails-5.2-rc1 +0 -26
- data/gemfiles/Gemfile.rails-5.2-rc1.lock +0 -201
- data/guides/bug_report_templates/integration_test.rb +0 -106
- data/test/controllers/custom_registrations_controller_test.rb +0 -42
- data/test/controllers/custom_strategy_test.rb +0 -66
- data/test/controllers/helper_methods_test.rb +0 -24
- data/test/controllers/helpers_test.rb +0 -318
- data/test/controllers/inherited_controller_i18n_messages_test.rb +0 -53
- data/test/controllers/internal_helpers_test.rb +0 -129
- data/test/controllers/load_hooks_controller_test.rb +0 -21
- data/test/controllers/passwords_controller_test.rb +0 -34
- data/test/controllers/sessions_controller_test.rb +0 -108
- data/test/controllers/url_helpers_test.rb +0 -67
- data/test/delegator_test.rb +0 -21
- data/test/devise_test.rb +0 -109
- data/test/failure_app_test.rb +0 -340
- data/test/generators/active_record_generator_test.rb +0 -130
- data/test/generators/controllers_generator_test.rb +0 -50
- data/test/generators/devise_generator_test.rb +0 -41
- data/test/generators/install_generator_test.rb +0 -26
- data/test/generators/mongoid_generator_test.rb +0 -25
- data/test/generators/views_generator_test.rb +0 -105
- data/test/helpers/devise_helper_test.rb +0 -51
- data/test/integration/authenticatable_test.rb +0 -706
- data/test/integration/confirmable_test.rb +0 -326
- data/test/integration/database_authenticatable_test.rb +0 -97
- data/test/integration/http_authenticatable_test.rb +0 -114
- data/test/integration/lockable_test.rb +0 -242
- data/test/integration/mounted_engine_test.rb +0 -38
- data/test/integration/omniauthable_test.rb +0 -148
- data/test/integration/recoverable_test.rb +0 -349
- data/test/integration/registerable_test.rb +0 -365
- data/test/integration/rememberable_test.rb +0 -219
- data/test/integration/timeoutable_test.rb +0 -186
- data/test/integration/trackable_test.rb +0 -99
- data/test/mailers/confirmation_instructions_test.rb +0 -117
- data/test/mailers/email_changed_test.rb +0 -132
- data/test/mailers/mailer_test.rb +0 -20
- data/test/mailers/reset_password_instructions_test.rb +0 -98
- data/test/mailers/unlock_instructions_test.rb +0 -93
- data/test/mapping_test.rb +0 -136
- data/test/models/authenticatable_test.rb +0 -25
- data/test/models/confirmable_test.rb +0 -549
- data/test/models/database_authenticatable_test.rb +0 -283
- data/test/models/lockable_test.rb +0 -352
- data/test/models/omniauthable_test.rb +0 -9
- data/test/models/recoverable_test.rb +0 -263
- data/test/models/registerable_test.rb +0 -9
- data/test/models/rememberable_test.rb +0 -184
- data/test/models/serializable_test.rb +0 -60
- data/test/models/timeoutable_test.rb +0 -53
- data/test/models/trackable_test.rb +0 -62
- data/test/models/validatable_test.rb +0 -121
- data/test/models_test.rb +0 -155
- data/test/omniauth/config_test.rb +0 -61
- data/test/omniauth/url_helpers_test.rb +0 -53
- data/test/orm/active_record.rb +0 -24
- data/test/orm/mongoid.rb +0 -15
- data/test/parameter_sanitizer_test.rb +0 -77
- data/test/rails_app/Rakefile +0 -6
- data/test/rails_app/app/active_record/admin.rb +0 -8
- data/test/rails_app/app/active_record/shim.rb +0 -4
- data/test/rails_app/app/active_record/user.rb +0 -20
- data/test/rails_app/app/active_record/user_on_engine.rb +0 -9
- data/test/rails_app/app/active_record/user_on_main_app.rb +0 -9
- data/test/rails_app/app/active_record/user_with_validations.rb +0 -12
- data/test/rails_app/app/active_record/user_without_email.rb +0 -10
- data/test/rails_app/app/controllers/admins/sessions_controller.rb +0 -8
- data/test/rails_app/app/controllers/admins_controller.rb +0 -8
- data/test/rails_app/app/controllers/application_controller.rb +0 -13
- data/test/rails_app/app/controllers/application_with_fake_engine.rb +0 -32
- data/test/rails_app/app/controllers/custom/registrations_controller.rb +0 -33
- data/test/rails_app/app/controllers/home_controller.rb +0 -31
- data/test/rails_app/app/controllers/publisher/registrations_controller.rb +0 -4
- data/test/rails_app/app/controllers/publisher/sessions_controller.rb +0 -4
- data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +0 -16
- data/test/rails_app/app/controllers/users_controller.rb +0 -33
- data/test/rails_app/app/helpers/application_helper.rb +0 -5
- data/test/rails_app/app/mailers/users/from_proc_mailer.rb +0 -5
- data/test/rails_app/app/mailers/users/mailer.rb +0 -5
- data/test/rails_app/app/mailers/users/reply_to_mailer.rb +0 -6
- data/test/rails_app/app/mongoid/admin.rb +0 -31
- data/test/rails_app/app/mongoid/shim.rb +0 -25
- data/test/rails_app/app/mongoid/user.rb +0 -50
- data/test/rails_app/app/mongoid/user_on_engine.rb +0 -41
- data/test/rails_app/app/mongoid/user_on_main_app.rb +0 -41
- data/test/rails_app/app/mongoid/user_with_validations.rb +0 -37
- data/test/rails_app/app/mongoid/user_without_email.rb +0 -35
- data/test/rails_app/app/views/admins/index.html.erb +0 -1
- data/test/rails_app/app/views/admins/sessions/new.html.erb +0 -2
- data/test/rails_app/app/views/home/admin_dashboard.html.erb +0 -1
- data/test/rails_app/app/views/home/index.html.erb +0 -1
- data/test/rails_app/app/views/home/join.html.erb +0 -1
- data/test/rails_app/app/views/home/private.html.erb +0 -1
- data/test/rails_app/app/views/home/user_dashboard.html.erb +0 -1
- data/test/rails_app/app/views/layouts/application.html.erb +0 -24
- data/test/rails_app/app/views/users/edit_form.html.erb +0 -1
- data/test/rails_app/app/views/users/index.html.erb +0 -1
- data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +0 -1
- data/test/rails_app/app/views/users/sessions/new.html.erb +0 -1
- data/test/rails_app/bin/bundle +0 -3
- data/test/rails_app/bin/rails +0 -4
- data/test/rails_app/bin/rake +0 -4
- data/test/rails_app/config/application.rb +0 -48
- data/test/rails_app/config/boot.rb +0 -27
- data/test/rails_app/config/database.yml +0 -18
- data/test/rails_app/config/environment.rb +0 -7
- data/test/rails_app/config/environments/development.rb +0 -32
- data/test/rails_app/config/environments/production.rb +0 -88
- data/test/rails_app/config/environments/test.rb +0 -47
- data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -9
- data/test/rails_app/config/initializers/devise.rb +0 -182
- data/test/rails_app/config/initializers/inflections.rb +0 -4
- data/test/rails_app/config/initializers/secret_token.rb +0 -5
- data/test/rails_app/config/initializers/session_store.rb +0 -3
- data/test/rails_app/config/routes.rb +0 -128
- data/test/rails_app/config.ru +0 -4
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -77
- data/test/rails_app/db/schema.rb +0 -57
- data/test/rails_app/lib/shared_admin.rb +0 -23
- data/test/rails_app/lib/shared_user.rb +0 -32
- data/test/rails_app/lib/shared_user_without_email.rb +0 -28
- data/test/rails_app/lib/shared_user_without_omniauth.rb +0 -15
- data/test/rails_app/public/404.html +0 -26
- data/test/rails_app/public/422.html +0 -26
- data/test/rails_app/public/500.html +0 -26
- data/test/rails_app/public/favicon.ico +0 -0
- data/test/rails_test.rb +0 -11
- data/test/routes_test.rb +0 -281
- data/test/secret_key_finder_test.rb +0 -97
- data/test/support/action_controller/record_identifier.rb +0 -12
- data/test/support/assertions.rb +0 -30
- data/test/support/helpers.rb +0 -83
- data/test/support/http_method_compatibility.rb +0 -53
- data/test/support/integration.rb +0 -95
- data/test/support/locale/en.yml +0 -8
- data/test/support/mongoid.yml +0 -6
- data/test/support/webrat/integrations/rails.rb +0 -35
- data/test/test/controller_helpers_test.rb +0 -193
- data/test/test/integration_helpers_test.rb +0 -34
- data/test/test_helper.rb +0 -36
- data/test/test_models.rb +0 -35
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class Custom::RegistrationsController < Devise::RegistrationsController
|
|
4
|
-
def new
|
|
5
|
-
super do |resource|
|
|
6
|
-
@new_block_called = true
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def create
|
|
11
|
-
super do |resource|
|
|
12
|
-
@create_block_called = true
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def update
|
|
17
|
-
super do |resource|
|
|
18
|
-
@update_block_called = true
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def create_block_called?
|
|
23
|
-
@create_block_called == true
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def update_block_called?
|
|
27
|
-
@update_block_called == true
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def new_block_called?
|
|
31
|
-
@new_block_called == true
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class HomeController < ApplicationController
|
|
4
|
-
def index
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
def private
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def user_dashboard
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def admin_dashboard
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def join
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def set
|
|
20
|
-
session["devise.foo_bar"] = "something"
|
|
21
|
-
head :ok
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def unauthenticated
|
|
25
|
-
if Devise::Test.rails5?
|
|
26
|
-
render body: "unauthenticated", status: :unauthorized
|
|
27
|
-
else
|
|
28
|
-
render text: "unauthenticated", status: :unauthorized
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
4
|
-
def facebook
|
|
5
|
-
data = request.respond_to?(:get_header) ? request.get_header("omniauth.auth") : request.env["omniauth.auth"]
|
|
6
|
-
session["devise.facebook_data"] = data["extra"]["user_hash"]
|
|
7
|
-
render json: data
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def sign_in_facebook
|
|
11
|
-
user = User.to_adapter.find_first(email: 'user@test.com')
|
|
12
|
-
user.remember_me = true
|
|
13
|
-
sign_in user
|
|
14
|
-
render (Devise::Test.rails5? ? :body : :text) => ""
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class UsersController < ApplicationController
|
|
4
|
-
prepend_before_action :current_user, only: :exhibit
|
|
5
|
-
before_action :authenticate_user!, except: [:accept, :exhibit]
|
|
6
|
-
respond_to :html, :xml
|
|
7
|
-
|
|
8
|
-
def index
|
|
9
|
-
user_session[:cart] = "Cart"
|
|
10
|
-
respond_with(current_user)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def edit_form
|
|
14
|
-
user_session['last_request_at'] = params.fetch(:last_request_at, 31.minutes.ago.utc)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def update_form
|
|
18
|
-
render (Devise::Test.rails5? ? :body : :text) => 'Update'
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def accept
|
|
22
|
-
@current_user = current_user
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def exhibit
|
|
26
|
-
render (Devise::Test.rails5? ? :body : :text) => current_user ? "User is authenticated" : "User is not authenticated"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def expire
|
|
30
|
-
user_session['last_request_at'] = 31.minutes.ago.utc
|
|
31
|
-
render (Devise::Test.rails5? ? :body : :text) => 'User will be expired on next request'
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'shared_admin'
|
|
4
|
-
|
|
5
|
-
class Admin
|
|
6
|
-
include Mongoid::Document
|
|
7
|
-
include Shim
|
|
8
|
-
include SharedAdmin
|
|
9
|
-
|
|
10
|
-
## Database authenticatable
|
|
11
|
-
field :email, type: String
|
|
12
|
-
field :encrypted_password, type: String
|
|
13
|
-
|
|
14
|
-
## Recoverable
|
|
15
|
-
field :reset_password_token, type: String
|
|
16
|
-
field :reset_password_sent_at, type: Time
|
|
17
|
-
|
|
18
|
-
## Rememberable
|
|
19
|
-
field :remember_created_at, type: Time
|
|
20
|
-
|
|
21
|
-
## Confirmable
|
|
22
|
-
field :confirmation_token, type: String
|
|
23
|
-
field :confirmed_at, type: Time
|
|
24
|
-
field :confirmation_sent_at, type: Time
|
|
25
|
-
field :unconfirmed_email, type: String # Only if using reconfirmable
|
|
26
|
-
|
|
27
|
-
## Lockable
|
|
28
|
-
field :locked_at, type: Time
|
|
29
|
-
|
|
30
|
-
field :active, type: Boolean, default: false
|
|
31
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Shim
|
|
4
|
-
extend ::ActiveSupport::Concern
|
|
5
|
-
|
|
6
|
-
included do
|
|
7
|
-
include ::Mongoid::Timestamps
|
|
8
|
-
field :created_at, type: DateTime
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
module ClassMethods
|
|
12
|
-
def order(attribute)
|
|
13
|
-
asc(attribute)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def find_by_email(email)
|
|
17
|
-
find_by(email: email)
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# overwrite equality (because some devise tests use this for asserting model equality)
|
|
22
|
-
def ==(other)
|
|
23
|
-
other.is_a?(self.class) && _id == other._id
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'shared_user'
|
|
4
|
-
|
|
5
|
-
class User
|
|
6
|
-
include Mongoid::Document
|
|
7
|
-
include Shim
|
|
8
|
-
include SharedUser
|
|
9
|
-
|
|
10
|
-
field :username, type: String
|
|
11
|
-
field :facebook_token, type: String
|
|
12
|
-
|
|
13
|
-
## Database authenticatable
|
|
14
|
-
field :email, type: String, default: ""
|
|
15
|
-
field :encrypted_password, type: String, default: ""
|
|
16
|
-
|
|
17
|
-
## Recoverable
|
|
18
|
-
field :reset_password_token, type: String
|
|
19
|
-
field :reset_password_sent_at, type: Time
|
|
20
|
-
|
|
21
|
-
## Rememberable
|
|
22
|
-
field :remember_created_at, type: Time
|
|
23
|
-
|
|
24
|
-
## Trackable
|
|
25
|
-
field :sign_in_count, type: Integer, default: 0
|
|
26
|
-
field :current_sign_in_at, type: Time
|
|
27
|
-
field :last_sign_in_at, type: Time
|
|
28
|
-
field :current_sign_in_ip, type: String
|
|
29
|
-
field :last_sign_in_ip, type: String
|
|
30
|
-
|
|
31
|
-
## Confirmable
|
|
32
|
-
field :confirmation_token, type: String
|
|
33
|
-
field :confirmed_at, type: Time
|
|
34
|
-
field :confirmation_sent_at, type: Time
|
|
35
|
-
# field :unconfirmed_email, type: String # Only if using reconfirmable
|
|
36
|
-
|
|
37
|
-
## Lockable
|
|
38
|
-
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
|
|
39
|
-
field :unlock_token, type: String # Only if unlock strategy is :email or :both
|
|
40
|
-
field :locked_at, type: Time
|
|
41
|
-
|
|
42
|
-
cattr_accessor :validations_performed
|
|
43
|
-
|
|
44
|
-
after_validation :after_validation_callback
|
|
45
|
-
|
|
46
|
-
def after_validation_callback
|
|
47
|
-
# used to check in our test if the validations were called
|
|
48
|
-
@@validations_performed = true
|
|
49
|
-
end
|
|
50
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'shared_user_without_omniauth'
|
|
4
|
-
|
|
5
|
-
class UserOnEngine
|
|
6
|
-
include Mongoid::Document
|
|
7
|
-
include Shim
|
|
8
|
-
include SharedUserWithoutOmniauth
|
|
9
|
-
|
|
10
|
-
field :username, type: String
|
|
11
|
-
field :facebook_token, type: String
|
|
12
|
-
|
|
13
|
-
## Database authenticatable
|
|
14
|
-
field :email, type: String, default: ""
|
|
15
|
-
field :encrypted_password, type: String, default: ""
|
|
16
|
-
|
|
17
|
-
## Recoverable
|
|
18
|
-
field :reset_password_token, type: String
|
|
19
|
-
field :reset_password_sent_at, type: Time
|
|
20
|
-
|
|
21
|
-
## Rememberable
|
|
22
|
-
field :remember_created_at, type: Time
|
|
23
|
-
|
|
24
|
-
## Trackable
|
|
25
|
-
field :sign_in_count, type: Integer, default: 0
|
|
26
|
-
field :current_sign_in_at, type: Time
|
|
27
|
-
field :last_sign_in_at, type: Time
|
|
28
|
-
field :current_sign_in_ip, type: String
|
|
29
|
-
field :last_sign_in_ip, type: String
|
|
30
|
-
|
|
31
|
-
## Confirmable
|
|
32
|
-
field :confirmation_token, type: String
|
|
33
|
-
field :confirmed_at, type: Time
|
|
34
|
-
field :confirmation_sent_at, type: Time
|
|
35
|
-
# field :unconfirmed_email, type: String # Only if using reconfirmable
|
|
36
|
-
|
|
37
|
-
## Lockable
|
|
38
|
-
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
|
|
39
|
-
field :unlock_token, type: String # Only if unlock strategy is :email or :both
|
|
40
|
-
field :locked_at, type: Time
|
|
41
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'shared_user_without_omniauth'
|
|
4
|
-
|
|
5
|
-
class UserOnMainApp
|
|
6
|
-
include Mongoid::Document
|
|
7
|
-
include Shim
|
|
8
|
-
include SharedUserWithoutOmniauth
|
|
9
|
-
|
|
10
|
-
field :username, type: String
|
|
11
|
-
field :facebook_token, type: String
|
|
12
|
-
|
|
13
|
-
## Database authenticatable
|
|
14
|
-
field :email, type: String, default: ""
|
|
15
|
-
field :encrypted_password, type: String, default: ""
|
|
16
|
-
|
|
17
|
-
## Recoverable
|
|
18
|
-
field :reset_password_token, type: String
|
|
19
|
-
field :reset_password_sent_at, type: Time
|
|
20
|
-
|
|
21
|
-
## Rememberable
|
|
22
|
-
field :remember_created_at, type: Time
|
|
23
|
-
|
|
24
|
-
## Trackable
|
|
25
|
-
field :sign_in_count, type: Integer, default: 0
|
|
26
|
-
field :current_sign_in_at, type: Time
|
|
27
|
-
field :last_sign_in_at, type: Time
|
|
28
|
-
field :current_sign_in_ip, type: String
|
|
29
|
-
field :last_sign_in_ip, type: String
|
|
30
|
-
|
|
31
|
-
## Confirmable
|
|
32
|
-
field :confirmation_token, type: String
|
|
33
|
-
field :confirmed_at, type: Time
|
|
34
|
-
field :confirmation_sent_at, type: Time
|
|
35
|
-
# field :unconfirmed_email, type: String # Only if using reconfirmable
|
|
36
|
-
|
|
37
|
-
## Lockable
|
|
38
|
-
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
|
|
39
|
-
field :unlock_token, type: String # Only if unlock strategy is :email or :both
|
|
40
|
-
field :locked_at, type: Time
|
|
41
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "shared_user"
|
|
4
|
-
|
|
5
|
-
class UserWithValidations
|
|
6
|
-
include Mongoid::Document
|
|
7
|
-
include Shim
|
|
8
|
-
include SharedUser
|
|
9
|
-
|
|
10
|
-
field :username, type: String
|
|
11
|
-
field :facebook_token, type: String
|
|
12
|
-
|
|
13
|
-
## Database authenticatable
|
|
14
|
-
field :email, type: String, default: ""
|
|
15
|
-
field :encrypted_password, type: String, default: ""
|
|
16
|
-
|
|
17
|
-
## Recoverable
|
|
18
|
-
field :reset_password_token, type: String
|
|
19
|
-
field :reset_password_sent_at, type: Time
|
|
20
|
-
|
|
21
|
-
## Rememberable
|
|
22
|
-
field :remember_created_at, type: Time
|
|
23
|
-
|
|
24
|
-
## Trackable
|
|
25
|
-
field :sign_in_count, type: Integer, default: 0
|
|
26
|
-
field :current_sign_in_at, type: Time
|
|
27
|
-
field :last_sign_in_at, type: Time
|
|
28
|
-
field :current_sign_in_ip, type: String
|
|
29
|
-
field :last_sign_in_ip, type: String
|
|
30
|
-
|
|
31
|
-
## Lockable
|
|
32
|
-
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
|
|
33
|
-
field :unlock_token, type: String # Only if unlock strategy is :email or :both
|
|
34
|
-
field :locked_at, type: Time
|
|
35
|
-
|
|
36
|
-
validates :email, presence: true
|
|
37
|
-
end
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "shared_user_without_email"
|
|
4
|
-
|
|
5
|
-
class UserWithoutEmail
|
|
6
|
-
include Mongoid::Document
|
|
7
|
-
include Shim
|
|
8
|
-
include SharedUserWithoutEmail
|
|
9
|
-
|
|
10
|
-
field :username, type: String
|
|
11
|
-
field :facebook_token, type: String
|
|
12
|
-
|
|
13
|
-
## Database authenticatable
|
|
14
|
-
field :email, type: String, default: ""
|
|
15
|
-
field :encrypted_password, type: String, default: ""
|
|
16
|
-
|
|
17
|
-
## Recoverable
|
|
18
|
-
field :reset_password_token, type: String
|
|
19
|
-
field :reset_password_sent_at, type: Time
|
|
20
|
-
|
|
21
|
-
## Rememberable
|
|
22
|
-
field :remember_created_at, type: Time
|
|
23
|
-
|
|
24
|
-
## Trackable
|
|
25
|
-
field :sign_in_count, type: Integer, default: 0
|
|
26
|
-
field :current_sign_in_at, type: Time
|
|
27
|
-
field :last_sign_in_at, type: Time
|
|
28
|
-
field :current_sign_in_ip, type: String
|
|
29
|
-
field :last_sign_in_ip, type: String
|
|
30
|
-
|
|
31
|
-
## Lockable
|
|
32
|
-
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
|
|
33
|
-
field :unlock_token, type: String # Only if unlock strategy is :email or :both
|
|
34
|
-
field :locked_at, type: Time
|
|
35
|
-
end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Welcome Admin!
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Admin dashboard
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Home!
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Join
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Private!
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
User dashboard
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<title>Devise Test App</title>
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<div id="container">
|
|
9
|
-
<%- flash.each do |name, msg| -%>
|
|
10
|
-
<%= content_tag :div, msg, id: "flash_#{name}" %>
|
|
11
|
-
<%- end -%>
|
|
12
|
-
|
|
13
|
-
<% if user_signed_in? -%>
|
|
14
|
-
<p>Hello User <%= current_user.email %>! You are signed in!</p>
|
|
15
|
-
<% end -%>
|
|
16
|
-
|
|
17
|
-
<% if admin_signed_in? -%>
|
|
18
|
-
<p>Hello Admin <%= current_admin.email %>! You are signed in!</p>
|
|
19
|
-
<% end -%>
|
|
20
|
-
|
|
21
|
-
<%= yield %>
|
|
22
|
-
</div>
|
|
23
|
-
</body>
|
|
24
|
-
</html>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= button_to 'Update', update_form_user_path(current_user), method: 'put' %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Welcome User #<%= current_user.id %>!
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= @resource.email %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Special user view
|
data/test/rails_app/bin/bundle
DELETED
data/test/rails_app/bin/rails
DELETED
data/test/rails_app/bin/rake
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require File.expand_path('../boot', __FILE__)
|
|
4
|
-
|
|
5
|
-
require "action_controller/railtie"
|
|
6
|
-
require "action_mailer/railtie"
|
|
7
|
-
require "rails/test_unit/railtie"
|
|
8
|
-
|
|
9
|
-
Bundler.require :default, DEVISE_ORM
|
|
10
|
-
|
|
11
|
-
begin
|
|
12
|
-
require "#{DEVISE_ORM}/railtie"
|
|
13
|
-
rescue LoadError
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
require "devise"
|
|
17
|
-
|
|
18
|
-
module RailsApp
|
|
19
|
-
class Application < Rails::Application
|
|
20
|
-
# Add additional load paths for your own custom dirs
|
|
21
|
-
config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers mailers views).include?($1) }
|
|
22
|
-
config.autoload_paths += ["#{config.root}/app/#{DEVISE_ORM}"]
|
|
23
|
-
|
|
24
|
-
# Configure generators values. Many other options are available, be sure to check the documentation.
|
|
25
|
-
# config.generators do |g|
|
|
26
|
-
# g.orm :active_record
|
|
27
|
-
# g.template_engine :erb
|
|
28
|
-
# g.test_framework :test_unit, fixture: true
|
|
29
|
-
# end
|
|
30
|
-
|
|
31
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
|
32
|
-
config.filter_parameters << :password
|
|
33
|
-
# config.assets.enabled = false
|
|
34
|
-
|
|
35
|
-
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
|
|
36
|
-
rails_version = Gem::Version.new(Rails.version)
|
|
37
|
-
if DEVISE_ORM == :active_record &&
|
|
38
|
-
rails_version >= Gem::Version.new('4.2.0') &&
|
|
39
|
-
rails_version < Gem::Version.new('5.1.0')
|
|
40
|
-
config.active_record.raise_in_transactional_callbacks = true
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# This was used to break devise in some situations
|
|
44
|
-
config.to_prepare do
|
|
45
|
-
Devise::SessionsController.layout "application"
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
unless defined?(DEVISE_ORM)
|
|
4
|
-
DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
module Devise
|
|
8
|
-
module Test
|
|
9
|
-
# Detection for minor differences between Rails 4 and 5, 5.1, and 5.2 in tests.
|
|
10
|
-
|
|
11
|
-
def self.rails52?
|
|
12
|
-
Rails.version.start_with? '5.2'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def self.rails51?
|
|
16
|
-
Rails.version.start_with? '5.1'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def self.rails5?
|
|
20
|
-
Rails.version.start_with? '5'
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
# Set up gems listed in the Gemfile.
|
|
26
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
|
27
|
-
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# SQLite version 3.x
|
|
2
|
-
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
|
3
|
-
development:
|
|
4
|
-
adapter: sqlite3
|
|
5
|
-
database: db/development.sqlite3
|
|
6
|
-
pool: 5
|
|
7
|
-
timeout: 5000
|
|
8
|
-
|
|
9
|
-
# Warning: The database defined as "test" will be erased and
|
|
10
|
-
# re-generated from your development database when you run "rake".
|
|
11
|
-
# Do not set this db to the same as development or production.
|
|
12
|
-
test:
|
|
13
|
-
adapter: sqlite3
|
|
14
|
-
database: ":memory:"
|
|
15
|
-
|
|
16
|
-
production:
|
|
17
|
-
adapter: sqlite3
|
|
18
|
-
database: ":memory:"
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RailsApp::Application.configure do
|
|
4
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
|
5
|
-
|
|
6
|
-
# In the development environment your application's code is reloaded on
|
|
7
|
-
# every request. This slows down response time but is perfect for development
|
|
8
|
-
# since you don't have to restart the web server when you make code changes.
|
|
9
|
-
config.cache_classes = false
|
|
10
|
-
|
|
11
|
-
# Do not eager load code on boot.
|
|
12
|
-
config.eager_load = false
|
|
13
|
-
|
|
14
|
-
# Show full error reports and disable caching.
|
|
15
|
-
config.consider_all_requests_local = true
|
|
16
|
-
config.action_controller.perform_caching = false
|
|
17
|
-
|
|
18
|
-
# Don't care if the mailer can't send.
|
|
19
|
-
config.action_mailer.raise_delivery_errors = false
|
|
20
|
-
|
|
21
|
-
# Print deprecation notices to the Rails logger.
|
|
22
|
-
config.active_support.deprecation = :log
|
|
23
|
-
|
|
24
|
-
# Only use best-standards-support built into browsers.
|
|
25
|
-
config.action_dispatch.best_standards_support = :builtin
|
|
26
|
-
|
|
27
|
-
# Raise an error on page load if there are pending migrations
|
|
28
|
-
config.active_record.migration_error = :page_load
|
|
29
|
-
|
|
30
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
|
31
|
-
config.assets.debug = true
|
|
32
|
-
end
|