devise 4.5.0 → 4.6.0
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 +5 -5
- data/CHANGELOG.md +30 -1
- data/MIT-LICENSE +1 -1
- data/README.md +18 -0
- data/app/controllers/devise/passwords_controller.rb +1 -0
- data/app/controllers/devise/registrations_controller.rb +25 -7
- data/app/helpers/devise_helper.rb +10 -19
- data/app/views/devise/confirmations/new.html.erb +1 -1
- data/app/views/devise/passwords/edit.html.erb +1 -1
- data/app/views/devise/passwords/new.html.erb +1 -1
- data/app/views/devise/registrations/edit.html.erb +1 -1
- data/app/views/devise/registrations/new.html.erb +1 -1
- data/app/views/devise/sessions/new.html.erb +2 -2
- data/app/views/devise/shared/_error_messages.html.erb +15 -0
- data/app/views/devise/shared/_links.html.erb +7 -7
- data/app/views/devise/unlocks/new.html.erb +1 -1
- data/config/locales/en.yml +1 -0
- data/lib/devise.rb +4 -0
- data/lib/devise/controllers/helpers.rb +1 -1
- data/lib/devise/failure_app.rb +28 -3
- data/lib/devise/models/authenticatable.rb +7 -15
- data/lib/devise/models/confirmable.rb +4 -1
- data/lib/devise/models/database_authenticatable.rb +41 -6
- data/lib/devise/models/lockable.rb +2 -2
- data/lib/devise/models/registerable.rb +2 -0
- data/lib/devise/strategies/database_authenticatable.rb +3 -0
- data/lib/devise/test/controller_helpers.rb +1 -1
- data/lib/devise/version.rb +1 -1
- data/lib/generators/active_record/devise_generator.rb +4 -4
- data/lib/generators/devise/controllers_generator.rb +1 -1
- data/lib/generators/templates/devise.rb +12 -3
- data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +1 -1
- data/lib/generators/templates/simple_form_for/registrations/new.html.erb +1 -1
- metadata +5 -305
- data/.gitignore +0 -10
- data/.travis.yml +0 -69
- data/.yardopts +0 -9
- data/CODE_OF_CONDUCT.md +0 -22
- data/CONTRIBUTING.md +0 -79
- data/Gemfile +0 -39
- data/Gemfile.lock +0 -202
- 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 -346
- 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 -110
- 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 -290
- 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 -80
- 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 -105
- 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.ru +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 -187
- 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/db/migrate/20100401102949_create_tables.rb +0 -77
- data/test/rails_app/db/schema.rb +0 -57
- data/test/rails_app/lib/lazy_load_test_module.rb +0 -5
- 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 -121
- 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,128 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
Rails.application.routes.draw do
|
4
|
-
# Resources for testing
|
5
|
-
resources :users, only: [:index] do
|
6
|
-
member do
|
7
|
-
get :expire
|
8
|
-
get :accept
|
9
|
-
get :edit_form
|
10
|
-
put :update_form
|
11
|
-
end
|
12
|
-
|
13
|
-
authenticate do
|
14
|
-
post :exhibit, on: :member
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
resources :admins, only: [:index]
|
19
|
-
|
20
|
-
# Users scope
|
21
|
-
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
|
22
|
-
|
23
|
-
devise_for :user_on_main_apps,
|
24
|
-
class_name: 'UserOnMainApp',
|
25
|
-
router_name: :main_app,
|
26
|
-
module: :devise
|
27
|
-
|
28
|
-
devise_for :user_on_engines,
|
29
|
-
class_name: 'UserOnEngine',
|
30
|
-
router_name: :fake_engine,
|
31
|
-
module: :devise
|
32
|
-
|
33
|
-
devise_for :user_without_email,
|
34
|
-
class_name: 'UserWithoutEmail',
|
35
|
-
router_name: :main_app,
|
36
|
-
module: :devise
|
37
|
-
|
38
|
-
as :user do
|
39
|
-
get "/as/sign_in", to: "devise/sessions#new"
|
40
|
-
end
|
41
|
-
|
42
|
-
get "/sign_in", to: "devise/sessions#new"
|
43
|
-
|
44
|
-
# Routes for custom controller testing
|
45
|
-
devise_for :user, only: [:registrations], controllers: { registrations: "custom/registrations" }, as: :custom, path: :custom
|
46
|
-
|
47
|
-
# Admin scope
|
48
|
-
devise_for :admin, path: "admin_area", controllers: { sessions: :"admins/sessions" }, skip: :passwords
|
49
|
-
|
50
|
-
get "/admin_area/home", to: "admins#index", as: :admin_root
|
51
|
-
get "/anywhere", to: "foo#bar", as: :new_admin_password
|
52
|
-
|
53
|
-
authenticate(:admin) do
|
54
|
-
get "/private", to: "home#private", as: :private
|
55
|
-
end
|
56
|
-
|
57
|
-
authenticate(:admin, lambda { |admin| admin.active? }) do
|
58
|
-
get "/private/active", to: "home#private", as: :private_active
|
59
|
-
end
|
60
|
-
|
61
|
-
authenticated :admin do
|
62
|
-
get "/dashboard", to: "home#admin_dashboard"
|
63
|
-
end
|
64
|
-
|
65
|
-
authenticated :admin, lambda { |admin| admin.active? } do
|
66
|
-
get "/dashboard/active", to: "home#admin_dashboard"
|
67
|
-
end
|
68
|
-
|
69
|
-
authenticated do
|
70
|
-
get "/dashboard", to: "home#user_dashboard"
|
71
|
-
end
|
72
|
-
|
73
|
-
unauthenticated do
|
74
|
-
get "/join", to: "home#join"
|
75
|
-
end
|
76
|
-
|
77
|
-
# Routes for constraints testing
|
78
|
-
devise_for :headquarters_admin, class_name: "Admin", path: "headquarters", constraints: {host: /192\.168\.1\.\d\d\d/}
|
79
|
-
|
80
|
-
constraints(host: /192\.168\.1\.\d\d\d/) do
|
81
|
-
devise_for :homebase_admin, class_name: "Admin", path: "homebase"
|
82
|
-
end
|
83
|
-
|
84
|
-
scope(subdomain: 'sub') do
|
85
|
-
devise_for :subdomain_users, class_name: "User", only: [:sessions]
|
86
|
-
end
|
87
|
-
|
88
|
-
devise_for :skip_admin, class_name: "Admin", skip: :all
|
89
|
-
|
90
|
-
# Routes for format=false testing
|
91
|
-
devise_for :htmlonly_admin, class_name: "Admin", skip: [:confirmations, :unlocks], path: "htmlonly_admin", format: false, skip_helpers: [:confirmations, :unlocks]
|
92
|
-
devise_for :htmlonly_users, class_name: "User", only: [:confirmations, :unlocks], path: "htmlonly_users", format: false, skip_helpers: true
|
93
|
-
|
94
|
-
# Other routes for routing_test.rb
|
95
|
-
devise_for :reader, class_name: "User", only: :passwords
|
96
|
-
|
97
|
-
scope host: "sub.example.com" do
|
98
|
-
devise_for :sub_admin, class_name: "Admin"
|
99
|
-
end
|
100
|
-
|
101
|
-
namespace :publisher, path_names: { sign_in: "i_dont_care", sign_out: "get_out" } do
|
102
|
-
devise_for :accounts, class_name: "Admin", path_names: { sign_in: "get_in" }
|
103
|
-
end
|
104
|
-
|
105
|
-
scope ":locale", module: :invalid do
|
106
|
-
devise_for :accounts, singular: "manager", class_name: "Admin",
|
107
|
-
path_names: {
|
108
|
-
sign_in: "login", sign_out: "logout",
|
109
|
-
password: "secret", confirmation: "verification",
|
110
|
-
unlock: "unblock", sign_up: "register",
|
111
|
-
registration: "management",
|
112
|
-
cancel: "giveup", edit: "edit/profile"
|
113
|
-
}, failure_app: lambda { |env| [404, {"Content-Type" => "text/plain"}, ["Oops, not found"]] }, module: :devise
|
114
|
-
end
|
115
|
-
|
116
|
-
namespace :sign_out_via, module: "devise" do
|
117
|
-
devise_for :deletes, sign_out_via: :delete, class_name: "Admin"
|
118
|
-
devise_for :posts, sign_out_via: :post, class_name: "Admin"
|
119
|
-
devise_for :gets, sign_out_via: :get, class_name: "Admin"
|
120
|
-
devise_for :delete_or_posts, sign_out_via: [:delete, :post], class_name: "Admin"
|
121
|
-
end
|
122
|
-
|
123
|
-
get "/set", to: "home#set"
|
124
|
-
get "/unauthenticated", to: "home#unauthenticated"
|
125
|
-
get "/custom_strategy/new"
|
126
|
-
|
127
|
-
root to: "home#index", via: [:get, :post]
|
128
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
superclass = ActiveRecord::Migration
|
4
|
-
# TODO: Inherit from the 5.0 Migration class directly when we drop support for Rails 4.
|
5
|
-
superclass = ActiveRecord::Migration[5.0] if superclass.respond_to?(:[])
|
6
|
-
|
7
|
-
class CreateTables < superclass
|
8
|
-
def self.up
|
9
|
-
create_table :users do |t|
|
10
|
-
t.string :username
|
11
|
-
t.string :facebook_token
|
12
|
-
|
13
|
-
## Database authenticatable
|
14
|
-
t.string :email, null: false, default: ""
|
15
|
-
t.string :encrypted_password, null: false, default: ""
|
16
|
-
|
17
|
-
## Recoverable
|
18
|
-
t.string :reset_password_token
|
19
|
-
t.datetime :reset_password_sent_at
|
20
|
-
|
21
|
-
## Rememberable
|
22
|
-
t.datetime :remember_created_at
|
23
|
-
|
24
|
-
## Trackable
|
25
|
-
t.integer :sign_in_count, default: 0
|
26
|
-
t.datetime :current_sign_in_at
|
27
|
-
t.datetime :last_sign_in_at
|
28
|
-
t.string :current_sign_in_ip
|
29
|
-
t.string :last_sign_in_ip
|
30
|
-
|
31
|
-
## Confirmable
|
32
|
-
t.string :confirmation_token
|
33
|
-
t.datetime :confirmed_at
|
34
|
-
t.datetime :confirmation_sent_at
|
35
|
-
# t.string :unconfirmed_email # Only if using reconfirmable
|
36
|
-
|
37
|
-
## Lockable
|
38
|
-
t.integer :failed_attempts, default: 0 # Only if lock strategy is :failed_attempts
|
39
|
-
t.string :unlock_token # Only if unlock strategy is :email or :both
|
40
|
-
t.datetime :locked_at
|
41
|
-
|
42
|
-
t.timestamps null: false
|
43
|
-
end
|
44
|
-
|
45
|
-
create_table :admins do |t|
|
46
|
-
## Database authenticatable
|
47
|
-
t.string :email, null: true
|
48
|
-
t.string :encrypted_password, null: true
|
49
|
-
|
50
|
-
## Recoverable
|
51
|
-
t.string :reset_password_token
|
52
|
-
t.datetime :reset_password_sent_at
|
53
|
-
|
54
|
-
## Rememberable
|
55
|
-
t.datetime :remember_created_at
|
56
|
-
|
57
|
-
## Confirmable
|
58
|
-
t.string :confirmation_token
|
59
|
-
t.datetime :confirmed_at
|
60
|
-
t.datetime :confirmation_sent_at
|
61
|
-
t.string :unconfirmed_email # Only if using reconfirmable
|
62
|
-
|
63
|
-
## Lockable
|
64
|
-
t.datetime :locked_at
|
65
|
-
|
66
|
-
## Attribute for testing route blocks
|
67
|
-
t.boolean :active, default: false
|
68
|
-
|
69
|
-
t.timestamps null: false
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def self.down
|
74
|
-
drop_table :users
|
75
|
-
drop_table :admins
|
76
|
-
end
|
77
|
-
end
|
data/test/rails_app/db/schema.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
# This file is auto-generated from the current state of the database. Instead
|
5
|
-
# of editing this file, please use the migrations feature of Active Record to
|
6
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
7
|
-
#
|
8
|
-
# Note that this schema.rb definition is the authoritative source for your
|
9
|
-
# database schema. If you need to create the application database on another
|
10
|
-
# system, you should be using db:schema:load, not running all the migrations
|
11
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
12
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
13
|
-
#
|
14
|
-
# It's strongly recommended that you check this file into your version control system.
|
15
|
-
|
16
|
-
ActiveRecord::Schema.define(version: 20100401102949) do
|
17
|
-
|
18
|
-
create_table "admins", force: true do |t|
|
19
|
-
t.string "email"
|
20
|
-
t.string "encrypted_password"
|
21
|
-
t.string "reset_password_token"
|
22
|
-
t.datetime "reset_password_sent_at"
|
23
|
-
t.datetime "remember_created_at"
|
24
|
-
t.string "confirmation_token"
|
25
|
-
t.datetime "confirmed_at"
|
26
|
-
t.datetime "confirmation_sent_at"
|
27
|
-
t.string "unconfirmed_email"
|
28
|
-
t.datetime "locked_at"
|
29
|
-
t.boolean "active", default: false
|
30
|
-
t.datetime "created_at"
|
31
|
-
t.datetime "updated_at"
|
32
|
-
end
|
33
|
-
|
34
|
-
create_table "users", force: true do |t|
|
35
|
-
t.string "username"
|
36
|
-
t.string "facebook_token"
|
37
|
-
t.string "email", default: "", null: false
|
38
|
-
t.string "encrypted_password", default: "", null: false
|
39
|
-
t.string "reset_password_token"
|
40
|
-
t.datetime "reset_password_sent_at"
|
41
|
-
t.datetime "remember_created_at"
|
42
|
-
t.integer "sign_in_count", default: 0
|
43
|
-
t.datetime "current_sign_in_at"
|
44
|
-
t.datetime "last_sign_in_at"
|
45
|
-
t.string "current_sign_in_ip"
|
46
|
-
t.string "last_sign_in_ip"
|
47
|
-
t.string "confirmation_token"
|
48
|
-
t.datetime "confirmed_at"
|
49
|
-
t.datetime "confirmation_sent_at"
|
50
|
-
t.integer "failed_attempts", default: 0
|
51
|
-
t.string "unlock_token"
|
52
|
-
t.datetime "locked_at"
|
53
|
-
t.datetime "created_at"
|
54
|
-
t.datetime "updated_at"
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SharedAdmin
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
devise :database_authenticatable, :registerable,
|
8
|
-
:timeoutable, :recoverable, :lockable, :confirmable,
|
9
|
-
unlock_strategy: :time, lock_strategy: :none,
|
10
|
-
allow_unconfirmed_access_for: 2.weeks, reconfirmable: true
|
11
|
-
|
12
|
-
validates_length_of :reset_password_token, minimum: 3, allow_blank: true
|
13
|
-
if Devise::Test.rails51?
|
14
|
-
validates_uniqueness_of :email, allow_blank: true, if: :will_save_change_to_email?
|
15
|
-
else
|
16
|
-
validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def raw_confirmation_token
|
21
|
-
@raw_confirmation_token
|
22
|
-
end
|
23
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SharedUser
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
devise :database_authenticatable, :confirmable, :lockable, :recoverable,
|
8
|
-
:registerable, :rememberable, :timeoutable,
|
9
|
-
:trackable, :validatable, :omniauthable, password_length: 7..72,
|
10
|
-
reconfirmable: false
|
11
|
-
|
12
|
-
attr_accessor :other_key
|
13
|
-
|
14
|
-
# They need to be included after Devise is called.
|
15
|
-
extend ExtendMethods
|
16
|
-
end
|
17
|
-
|
18
|
-
def raw_confirmation_token
|
19
|
-
@raw_confirmation_token
|
20
|
-
end
|
21
|
-
|
22
|
-
module ExtendMethods
|
23
|
-
def new_with_session(params, session)
|
24
|
-
super.tap do |user|
|
25
|
-
if data = session["devise.facebook_data"]
|
26
|
-
user.email = data["email"]
|
27
|
-
user.confirmed_at = Time.now
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SharedUserWithoutEmail
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
# NOTE: This is missing :validatable and :confirmable, as they both require
|
8
|
-
# an email field at the moment. It is also missing :omniauthable because that
|
9
|
-
# adds unnecessary complexity to the setup
|
10
|
-
devise :database_authenticatable, :lockable, :recoverable,
|
11
|
-
:registerable, :rememberable, :timeoutable,
|
12
|
-
:trackable
|
13
|
-
end
|
14
|
-
|
15
|
-
# This test stub is a bit rubbish because it's tied very closely to the
|
16
|
-
# implementation where we care about this one case. However, completely
|
17
|
-
# removing the email field breaks "recoverable" tests completely, so we are
|
18
|
-
# just taking the approach here that "email" is something that is a not an
|
19
|
-
# ActiveRecord field.
|
20
|
-
def email_changed?
|
21
|
-
raise NoMethodError
|
22
|
-
end
|
23
|
-
|
24
|
-
def respond_to?(method_name, include_all=false)
|
25
|
-
return false if method_name.to_sym == :email_changed?
|
26
|
-
super(method_name, include_all)
|
27
|
-
end
|
28
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module SharedUserWithoutOmniauth
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
devise :database_authenticatable, :confirmable, :lockable, :recoverable,
|
8
|
-
:registerable, :rememberable, :timeoutable,
|
9
|
-
:trackable, :validatable, reconfirmable: false
|
10
|
-
end
|
11
|
-
|
12
|
-
def raw_confirmation_token
|
13
|
-
@raw_confirmation_token
|
14
|
-
end
|
15
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|