devise 4.4.3 → 4.7.3

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.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +98 -4
  3. data/MIT-LICENSE +2 -1
  4. data/README.md +96 -59
  5. data/app/controllers/devise/passwords_controller.rb +1 -0
  6. data/app/controllers/devise/registrations_controller.rb +26 -8
  7. data/app/controllers/devise_controller.rb +3 -3
  8. data/app/helpers/devise_helper.rb +21 -18
  9. data/app/mailers/devise/mailer.rb +5 -5
  10. data/app/views/devise/confirmations/new.html.erb +1 -1
  11. data/app/views/devise/passwords/edit.html.erb +3 -3
  12. data/app/views/devise/passwords/new.html.erb +1 -1
  13. data/app/views/devise/registrations/edit.html.erb +4 -4
  14. data/app/views/devise/registrations/new.html.erb +3 -3
  15. data/app/views/devise/sessions/new.html.erb +3 -3
  16. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  17. data/app/views/devise/shared/_links.html.erb +7 -7
  18. data/app/views/devise/unlocks/new.html.erb +1 -1
  19. data/config/locales/en.yml +3 -2
  20. data/lib/devise.rb +4 -4
  21. data/lib/devise/controllers/helpers.rb +8 -8
  22. data/lib/devise/controllers/sign_in_out.rb +6 -3
  23. data/lib/devise/controllers/url_helpers.rb +1 -1
  24. data/lib/devise/failure_app.rb +25 -5
  25. data/lib/devise/hooks/timeoutable.rb +2 -2
  26. data/lib/devise/mapping.rb +1 -1
  27. data/lib/devise/models/authenticatable.rb +44 -45
  28. data/lib/devise/models/confirmable.rb +18 -3
  29. data/lib/devise/models/database_authenticatable.rb +50 -12
  30. data/lib/devise/models/lockable.rb +3 -3
  31. data/lib/devise/models/recoverable.rb +2 -2
  32. data/lib/devise/models/registerable.rb +2 -0
  33. data/lib/devise/models/rememberable.rb +1 -1
  34. data/lib/devise/models/trackable.rb +9 -2
  35. data/lib/devise/models/validatable.rb +1 -1
  36. data/lib/devise/parameter_filter.rb +2 -0
  37. data/lib/devise/parameter_sanitizer.rb +13 -1
  38. data/lib/devise/rails/routes.rb +6 -6
  39. data/lib/devise/secret_key_finder.rb +2 -0
  40. data/lib/devise/strategies/authenticatable.rb +1 -1
  41. data/lib/devise/strategies/database_authenticatable.rb +6 -1
  42. data/lib/devise/test/controller_helpers.rb +4 -2
  43. data/lib/devise/test/integration_helpers.rb +1 -1
  44. data/lib/devise/version.rb +1 -1
  45. data/lib/generators/active_record/devise_generator.rb +9 -9
  46. data/lib/generators/devise/controllers_generator.rb +1 -1
  47. data/lib/generators/devise/devise_generator.rb +1 -1
  48. data/lib/generators/devise/install_generator.rb +1 -5
  49. data/lib/generators/devise/orm_helpers.rb +2 -2
  50. data/lib/generators/devise/views_generator.rb +1 -1
  51. data/lib/generators/mongoid/devise_generator.rb +5 -5
  52. data/lib/generators/templates/README +9 -1
  53. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +1 -1
  54. data/lib/generators/templates/devise.rb +34 -6
  55. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +5 -1
  56. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +10 -2
  57. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +4 -1
  58. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +11 -3
  59. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +11 -3
  60. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +7 -2
  61. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +4 -1
  62. metadata +7 -312
  63. data/.gitignore +0 -10
  64. data/.travis.yml +0 -68
  65. data/.yardopts +0 -9
  66. data/CODE_OF_CONDUCT.md +0 -22
  67. data/CONTRIBUTING.md +0 -79
  68. data/Gemfile +0 -39
  69. data/Gemfile.lock +0 -193
  70. data/ISSUE_TEMPLATE.md +0 -19
  71. data/Rakefile +0 -37
  72. data/bin/test +0 -13
  73. data/devise.gemspec +0 -28
  74. data/devise.png +0 -0
  75. data/gemfiles/Gemfile.rails-4.1-stable +0 -32
  76. data/gemfiles/Gemfile.rails-4.1-stable.lock +0 -171
  77. data/gemfiles/Gemfile.rails-4.2-stable +0 -32
  78. data/gemfiles/Gemfile.rails-4.2-stable.lock +0 -192
  79. data/gemfiles/Gemfile.rails-5.0-stable +0 -33
  80. data/gemfiles/Gemfile.rails-5.0-stable.lock +0 -192
  81. data/gemfiles/Gemfile.rails-5.2-rc1 +0 -26
  82. data/gemfiles/Gemfile.rails-5.2-rc1.lock +0 -201
  83. data/guides/bug_report_templates/integration_test.rb +0 -106
  84. data/test/controllers/custom_registrations_controller_test.rb +0 -42
  85. data/test/controllers/custom_strategy_test.rb +0 -66
  86. data/test/controllers/helper_methods_test.rb +0 -24
  87. data/test/controllers/helpers_test.rb +0 -318
  88. data/test/controllers/inherited_controller_i18n_messages_test.rb +0 -53
  89. data/test/controllers/internal_helpers_test.rb +0 -129
  90. data/test/controllers/load_hooks_controller_test.rb +0 -21
  91. data/test/controllers/passwords_controller_test.rb +0 -34
  92. data/test/controllers/sessions_controller_test.rb +0 -108
  93. data/test/controllers/url_helpers_test.rb +0 -67
  94. data/test/delegator_test.rb +0 -21
  95. data/test/devise_test.rb +0 -109
  96. data/test/failure_app_test.rb +0 -340
  97. data/test/generators/active_record_generator_test.rb +0 -130
  98. data/test/generators/controllers_generator_test.rb +0 -50
  99. data/test/generators/devise_generator_test.rb +0 -41
  100. data/test/generators/install_generator_test.rb +0 -26
  101. data/test/generators/mongoid_generator_test.rb +0 -25
  102. data/test/generators/views_generator_test.rb +0 -105
  103. data/test/helpers/devise_helper_test.rb +0 -51
  104. data/test/integration/authenticatable_test.rb +0 -706
  105. data/test/integration/confirmable_test.rb +0 -326
  106. data/test/integration/database_authenticatable_test.rb +0 -97
  107. data/test/integration/http_authenticatable_test.rb +0 -114
  108. data/test/integration/lockable_test.rb +0 -242
  109. data/test/integration/mounted_engine_test.rb +0 -38
  110. data/test/integration/omniauthable_test.rb +0 -148
  111. data/test/integration/recoverable_test.rb +0 -349
  112. data/test/integration/registerable_test.rb +0 -365
  113. data/test/integration/rememberable_test.rb +0 -219
  114. data/test/integration/timeoutable_test.rb +0 -186
  115. data/test/integration/trackable_test.rb +0 -99
  116. data/test/mailers/confirmation_instructions_test.rb +0 -117
  117. data/test/mailers/email_changed_test.rb +0 -132
  118. data/test/mailers/mailer_test.rb +0 -20
  119. data/test/mailers/reset_password_instructions_test.rb +0 -98
  120. data/test/mailers/unlock_instructions_test.rb +0 -93
  121. data/test/mapping_test.rb +0 -136
  122. data/test/models/authenticatable_test.rb +0 -25
  123. data/test/models/confirmable_test.rb +0 -549
  124. data/test/models/database_authenticatable_test.rb +0 -283
  125. data/test/models/lockable_test.rb +0 -352
  126. data/test/models/omniauthable_test.rb +0 -9
  127. data/test/models/recoverable_test.rb +0 -263
  128. data/test/models/registerable_test.rb +0 -9
  129. data/test/models/rememberable_test.rb +0 -184
  130. data/test/models/serializable_test.rb +0 -60
  131. data/test/models/timeoutable_test.rb +0 -53
  132. data/test/models/trackable_test.rb +0 -62
  133. data/test/models/validatable_test.rb +0 -121
  134. data/test/models_test.rb +0 -155
  135. data/test/omniauth/config_test.rb +0 -61
  136. data/test/omniauth/url_helpers_test.rb +0 -53
  137. data/test/orm/active_record.rb +0 -24
  138. data/test/orm/mongoid.rb +0 -15
  139. data/test/parameter_sanitizer_test.rb +0 -77
  140. data/test/rails_app/Rakefile +0 -6
  141. data/test/rails_app/app/active_record/admin.rb +0 -8
  142. data/test/rails_app/app/active_record/shim.rb +0 -4
  143. data/test/rails_app/app/active_record/user.rb +0 -20
  144. data/test/rails_app/app/active_record/user_on_engine.rb +0 -9
  145. data/test/rails_app/app/active_record/user_on_main_app.rb +0 -9
  146. data/test/rails_app/app/active_record/user_with_validations.rb +0 -12
  147. data/test/rails_app/app/active_record/user_without_email.rb +0 -10
  148. data/test/rails_app/app/controllers/admins/sessions_controller.rb +0 -8
  149. data/test/rails_app/app/controllers/admins_controller.rb +0 -8
  150. data/test/rails_app/app/controllers/application_controller.rb +0 -13
  151. data/test/rails_app/app/controllers/application_with_fake_engine.rb +0 -32
  152. data/test/rails_app/app/controllers/custom/registrations_controller.rb +0 -33
  153. data/test/rails_app/app/controllers/home_controller.rb +0 -31
  154. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +0 -4
  155. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +0 -4
  156. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +0 -16
  157. data/test/rails_app/app/controllers/users_controller.rb +0 -33
  158. data/test/rails_app/app/helpers/application_helper.rb +0 -5
  159. data/test/rails_app/app/mailers/users/from_proc_mailer.rb +0 -5
  160. data/test/rails_app/app/mailers/users/mailer.rb +0 -5
  161. data/test/rails_app/app/mailers/users/reply_to_mailer.rb +0 -6
  162. data/test/rails_app/app/mongoid/admin.rb +0 -31
  163. data/test/rails_app/app/mongoid/shim.rb +0 -25
  164. data/test/rails_app/app/mongoid/user.rb +0 -50
  165. data/test/rails_app/app/mongoid/user_on_engine.rb +0 -41
  166. data/test/rails_app/app/mongoid/user_on_main_app.rb +0 -41
  167. data/test/rails_app/app/mongoid/user_with_validations.rb +0 -37
  168. data/test/rails_app/app/mongoid/user_without_email.rb +0 -35
  169. data/test/rails_app/app/views/admins/index.html.erb +0 -1
  170. data/test/rails_app/app/views/admins/sessions/new.html.erb +0 -2
  171. data/test/rails_app/app/views/home/admin_dashboard.html.erb +0 -1
  172. data/test/rails_app/app/views/home/index.html.erb +0 -1
  173. data/test/rails_app/app/views/home/join.html.erb +0 -1
  174. data/test/rails_app/app/views/home/private.html.erb +0 -1
  175. data/test/rails_app/app/views/home/user_dashboard.html.erb +0 -1
  176. data/test/rails_app/app/views/layouts/application.html.erb +0 -24
  177. data/test/rails_app/app/views/users/edit_form.html.erb +0 -1
  178. data/test/rails_app/app/views/users/index.html.erb +0 -1
  179. data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +0 -1
  180. data/test/rails_app/app/views/users/sessions/new.html.erb +0 -1
  181. data/test/rails_app/bin/bundle +0 -3
  182. data/test/rails_app/bin/rails +0 -4
  183. data/test/rails_app/bin/rake +0 -4
  184. data/test/rails_app/config.ru +0 -4
  185. data/test/rails_app/config/application.rb +0 -48
  186. data/test/rails_app/config/boot.rb +0 -27
  187. data/test/rails_app/config/database.yml +0 -18
  188. data/test/rails_app/config/environment.rb +0 -7
  189. data/test/rails_app/config/environments/development.rb +0 -32
  190. data/test/rails_app/config/environments/production.rb +0 -88
  191. data/test/rails_app/config/environments/test.rb +0 -47
  192. data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -9
  193. data/test/rails_app/config/initializers/devise.rb +0 -182
  194. data/test/rails_app/config/initializers/inflections.rb +0 -4
  195. data/test/rails_app/config/initializers/secret_token.rb +0 -5
  196. data/test/rails_app/config/initializers/session_store.rb +0 -3
  197. data/test/rails_app/config/routes.rb +0 -128
  198. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -77
  199. data/test/rails_app/db/schema.rb +0 -57
  200. data/test/rails_app/lib/shared_admin.rb +0 -23
  201. data/test/rails_app/lib/shared_user.rb +0 -32
  202. data/test/rails_app/lib/shared_user_without_email.rb +0 -28
  203. data/test/rails_app/lib/shared_user_without_omniauth.rb +0 -15
  204. data/test/rails_app/public/404.html +0 -26
  205. data/test/rails_app/public/422.html +0 -26
  206. data/test/rails_app/public/500.html +0 -26
  207. data/test/rails_app/public/favicon.ico +0 -0
  208. data/test/rails_test.rb +0 -11
  209. data/test/routes_test.rb +0 -281
  210. data/test/secret_key_finder_test.rb +0 -97
  211. data/test/support/action_controller/record_identifier.rb +0 -12
  212. data/test/support/assertions.rb +0 -30
  213. data/test/support/helpers.rb +0 -83
  214. data/test/support/http_method_compatibility.rb +0 -53
  215. data/test/support/integration.rb +0 -95
  216. data/test/support/locale/en.yml +0 -8
  217. data/test/support/mongoid.yml +0 -6
  218. data/test/support/webrat/integrations/rails.rb +0 -35
  219. data/test/test/controller_helpers_test.rb +0 -193
  220. data/test/test/integration_helpers_test.rb +0 -34
  221. data/test/test_helper.rb +0 -36
  222. data/test/test_models.rb +0 -35
@@ -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
@@ -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>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</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/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
- </div>
25
- </body>
26
- </html>
File without changes
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- class RailsTest < ActiveSupport::TestCase
6
- test 'correct initializer position' do
7
- initializer = Devise::Engine.initializers.detect { |i| i.name == 'devise.omniauth' }
8
- assert_equal :load_config_initializers, initializer.after
9
- assert_equal :build_middleware_stack, initializer.before
10
- end
11
- end
@@ -1,281 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'test_helper'
4
-
5
- ExpectedRoutingError = MiniTest::Assertion
6
-
7
- class DefaultRoutingTest < ActionController::TestCase
8
- test 'map new user session' do
9
- assert_recognizes({controller: 'devise/sessions', action: 'new'}, {path: 'users/sign_in', method: :get})
10
- assert_named_route "/users/sign_in", :new_user_session_path
11
- end
12
-
13
- test 'map create user session' do
14
- assert_recognizes({controller: 'devise/sessions', action: 'create'}, {path: 'users/sign_in', method: :post})
15
- assert_named_route "/users/sign_in", :user_session_path
16
- end
17
-
18
- test 'map destroy user session' do
19
- assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: 'users/sign_out', method: :delete})
20
- assert_named_route "/users/sign_out", :destroy_user_session_path
21
- end
22
-
23
- test 'map new user confirmation' do
24
- assert_recognizes({controller: 'devise/confirmations', action: 'new'}, 'users/confirmation/new')
25
- assert_named_route "/users/confirmation/new", :new_user_confirmation_path
26
- end
27
-
28
- test 'map create user confirmation' do
29
- assert_recognizes({controller: 'devise/confirmations', action: 'create'}, {path: 'users/confirmation', method: :post})
30
- assert_named_route "/users/confirmation", :user_confirmation_path
31
- end
32
-
33
- test 'map show user confirmation' do
34
- assert_recognizes({controller: 'devise/confirmations', action: 'show'}, {path: 'users/confirmation', method: :get})
35
- end
36
-
37
- test 'map new user password' do
38
- assert_recognizes({controller: 'devise/passwords', action: 'new'}, 'users/password/new')
39
- assert_named_route "/users/password/new", :new_user_password_path
40
- end
41
-
42
- test 'map create user password' do
43
- assert_recognizes({controller: 'devise/passwords', action: 'create'}, {path: 'users/password', method: :post})
44
- assert_named_route "/users/password", :user_password_path
45
- end
46
-
47
- test 'map edit user password' do
48
- assert_recognizes({controller: 'devise/passwords', action: 'edit'}, 'users/password/edit')
49
- assert_named_route "/users/password/edit", :edit_user_password_path
50
- end
51
-
52
- test 'map update user password' do
53
- assert_recognizes({controller: 'devise/passwords', action: 'update'}, {path: 'users/password', method: :put})
54
- end
55
-
56
- test 'map new user unlock' do
57
- assert_recognizes({controller: 'devise/unlocks', action: 'new'}, 'users/unlock/new')
58
- assert_named_route "/users/unlock/new", :new_user_unlock_path
59
- end
60
-
61
- test 'map create user unlock' do
62
- assert_recognizes({controller: 'devise/unlocks', action: 'create'}, {path: 'users/unlock', method: :post})
63
- assert_named_route "/users/unlock", :user_unlock_path
64
- end
65
-
66
- test 'map show user unlock' do
67
- assert_recognizes({controller: 'devise/unlocks', action: 'show'}, {path: 'users/unlock', method: :get})
68
- end
69
-
70
- test 'map new user registration' do
71
- assert_recognizes({controller: 'devise/registrations', action: 'new'}, 'users/sign_up')
72
- assert_named_route "/users/sign_up", :new_user_registration_path
73
- end
74
-
75
- test 'map create user registration' do
76
- assert_recognizes({controller: 'devise/registrations', action: 'create'}, {path: 'users', method: :post})
77
- assert_named_route "/users", :user_registration_path
78
- end
79
-
80
- test 'map edit user registration' do
81
- assert_recognizes({controller: 'devise/registrations', action: 'edit'}, {path: 'users/edit', method: :get})
82
- assert_named_route "/users/edit", :edit_user_registration_path
83
- end
84
-
85
- test 'map update user registration' do
86
- assert_recognizes({controller: 'devise/registrations', action: 'update'}, {path: 'users', method: :put})
87
- end
88
-
89
- test 'map destroy user registration' do
90
- assert_recognizes({controller: 'devise/registrations', action: 'destroy'}, {path: 'users', method: :delete})
91
- end
92
-
93
- test 'map cancel user registration' do
94
- assert_recognizes({controller: 'devise/registrations', action: 'cancel'}, {path: 'users/cancel', method: :get})
95
- assert_named_route "/users/cancel", :cancel_user_registration_path
96
- end
97
-
98
- test 'map omniauth callbacks' do
99
- assert_recognizes({controller: 'users/omniauth_callbacks', action: 'facebook'}, {path: 'users/auth/facebook/callback', method: :get})
100
- assert_recognizes({controller: 'users/omniauth_callbacks', action: 'facebook'}, {path: 'users/auth/facebook/callback', method: :post})
101
- assert_named_route "/users/auth/facebook/callback", :user_facebook_omniauth_callback_path
102
-
103
- # named open_id
104
- assert_recognizes({controller: 'users/omniauth_callbacks', action: 'google'}, {path: 'users/auth/google/callback', method: :get})
105
- assert_recognizes({controller: 'users/omniauth_callbacks', action: 'google'}, {path: 'users/auth/google/callback', method: :post})
106
- assert_named_route "/users/auth/google/callback", :user_google_omniauth_callback_path
107
-
108
- assert_raise ExpectedRoutingError do
109
- assert_recognizes({controller: 'ysers/omniauth_callbacks', action: 'twitter'}, {path: 'users/auth/twitter/callback', method: :get})
110
- end
111
- end
112
-
113
- protected
114
-
115
- def assert_named_route(result, *args)
116
- assert_equal result, @routes.url_helpers.send(*args)
117
- end
118
- end
119
-
120
- class CustomizedRoutingTest < ActionController::TestCase
121
- test 'map admin with :path option' do
122
- assert_recognizes({controller: 'devise/registrations', action: 'new'}, {path: 'admin_area/sign_up', method: :get})
123
- end
124
-
125
- test 'map admin with :controllers option' do
126
- assert_recognizes({controller: 'admins/sessions', action: 'new'}, {path: 'admin_area/sign_in', method: :get})
127
- end
128
-
129
- test 'does not map admin password' do
130
- assert_raise ExpectedRoutingError do
131
- assert_recognizes({controller: 'devise/passwords', action: 'new'}, 'admin_area/password/new')
132
- end
133
- end
134
-
135
- test 'subdomain admin' do
136
- assert_recognizes({"host"=>"sub.example.com", controller: 'devise/sessions', action: 'new'}, {host: "sub.example.com", path: '/sub_admin/sign_in', method: :get})
137
- end
138
-
139
- test 'does only map reader password' do
140
- assert_raise ExpectedRoutingError do
141
- assert_recognizes({controller: 'devise/sessions', action: 'new'}, 'reader/sessions/new')
142
- end
143
- assert_recognizes({controller: 'devise/passwords', action: 'new'}, 'reader/password/new')
144
- end
145
-
146
- test 'map account with custom path name for session sign in' do
147
- assert_recognizes({controller: 'devise/sessions', action: 'new', locale: 'en'}, '/en/accounts/login')
148
- end
149
-
150
- test 'map account with custom path name for session sign out' do
151
- assert_recognizes({controller: 'devise/sessions', action: 'destroy', locale: 'en'}, {path: '/en/accounts/logout', method: :delete })
152
- end
153
-
154
- test 'map account with custom path name for password' do
155
- assert_recognizes({controller: 'devise/passwords', action: 'new', locale: 'en'}, '/en/accounts/secret/new')
156
- end
157
-
158
- test 'map account with custom path name for registration' do
159
- assert_recognizes({controller: 'devise/registrations', action: 'new', locale: 'en'}, '/en/accounts/management/register')
160
- end
161
-
162
- test 'map account with custom path name for edit registration' do
163
- assert_recognizes({controller: 'devise/registrations', action: 'edit', locale: 'en'}, '/en/accounts/management/edit/profile')
164
- end
165
-
166
- test 'map account with custom path name for cancel registration' do
167
- assert_recognizes({controller: 'devise/registrations', action: 'cancel', locale: 'en'}, '/en/accounts/management/giveup')
168
- end
169
-
170
- test 'map deletes with :sign_out_via option' do
171
- assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/deletes/sign_out', method: :delete})
172
- assert_raise ExpectedRoutingError do
173
- assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/deletes/sign_out', method: :get})
174
- end
175
- end
176
-
177
- test 'map posts with :sign_out_via option' do
178
- assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/posts/sign_out', method: :post})
179
- assert_raise ExpectedRoutingError do
180
- assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/posts/sign_out', method: :get})
181
- end
182
- end
183
-
184
- test 'map delete_or_posts with :sign_out_via option' do
185
- assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/delete_or_posts/sign_out', method: :post})
186
- assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/delete_or_posts/sign_out', method: :delete})
187
- assert_raise ExpectedRoutingError do
188
- assert_recognizes({controller: 'devise/sessions', action: 'destroy'}, {path: '/sign_out_via/delete_or_posts/sign_out', method: :get})
189
- end
190
- end
191
-
192
- test 'map with constraints defined in hash' do
193
- assert_recognizes({controller: 'devise/registrations', action: 'new'}, {path: 'http://192.168.1.100/headquarters/sign_up', method: :get})
194
- assert_raise ExpectedRoutingError do
195
- assert_recognizes({controller: 'devise/registrations', action: 'new'}, {path: 'http://10.0.0.100/headquarters/sign_up', method: :get})
196
- end
197
- end
198
-
199
- test 'map with constraints defined in block' do
200
- assert_recognizes({controller: 'devise/registrations', action: 'new'}, {path: 'http://192.168.1.100/homebase/sign_up', method: :get})
201
- assert_raise ExpectedRoutingError do
202
- assert_recognizes({controller: 'devise/registrations', action: 'new'}, {path: 'http://10.0.0.100//homebase/sign_up', method: :get})
203
- end
204
- end
205
-
206
- test 'map with format false for sessions' do
207
- expected_params = {controller: 'devise/sessions', action: 'new'}
208
- expected_params[:format] = false if Devise::Test.rails5?
209
-
210
- assert_recognizes(expected_params, {path: '/htmlonly_admin/sign_in', method: :get})
211
- assert_raise ExpectedRoutingError do
212
- assert_recognizes(expected_params, {path: '/htmlonly_admin/sign_in.xml', method: :get})
213
- end
214
- end
215
-
216
- test 'map with format false for passwords' do
217
- expected_params = {controller: 'devise/passwords', action: 'create'}
218
- expected_params[:format] = false if Devise::Test.rails5?
219
-
220
- assert_recognizes(expected_params, {path: '/htmlonly_admin/password', method: :post})
221
- assert_raise ExpectedRoutingError do
222
- assert_recognizes(expected_params, {path: '/htmlonly_admin/password.xml', method: :post})
223
- end
224
- end
225
-
226
- test 'map with format false for registrations' do
227
- expected_params = {controller: 'devise/registrations', action: 'new'}
228
- expected_params[:format] = false if Devise::Test.rails5?
229
-
230
- assert_recognizes(expected_params, {path: '/htmlonly_admin/sign_up', method: :get})
231
- assert_raise ExpectedRoutingError do
232
- assert_recognizes(expected_params, {path: '/htmlonly_admin/sign_up.xml', method: :get})
233
- end
234
- end
235
-
236
- test 'map with format false for confirmations' do
237
- expected_params = {controller: 'devise/confirmations', action: 'show'}
238
- expected_params[:format] = false if Devise::Test.rails5?
239
-
240
- assert_recognizes(expected_params, {path: '/htmlonly_users/confirmation', method: :get})
241
- assert_raise ExpectedRoutingError do
242
- assert_recognizes(expected_params, {path: '/htmlonly_users/confirmation.xml', method: :get})
243
- end
244
- end
245
-
246
- test 'map with format false for unlocks' do
247
- expected_params = {controller: 'devise/unlocks', action: 'show'}
248
- expected_params[:format] = false if Devise::Test.rails5?
249
-
250
- assert_recognizes(expected_params, {path: '/htmlonly_users/unlock', method: :get})
251
- assert_raise ExpectedRoutingError do
252
- assert_recognizes(expected_params, {path: '/htmlonly_users/unlock.xml', method: :get})
253
- end
254
- end
255
-
256
- test 'map with format false is not permanent' do
257
- assert_equal "/set.xml", @routes.url_helpers.set_path(:xml)
258
- end
259
-
260
- test 'checks if mapping has proper configuration for omniauth callback' do
261
- e = assert_raise ArgumentError do
262
- routes = ActionDispatch::Routing::RouteSet.new
263
- routes.draw do
264
- devise_for :not_omniauthable, class_name: 'Admin', controllers: {omniauth_callbacks: "users/omniauth_callbacks"}
265
- end
266
- end
267
- assert_match "Mapping omniauth_callbacks on a resource that is not omniauthable", e.message
268
- end
269
- end
270
-
271
- class ScopedRoutingTest < ActionController::TestCase
272
- test 'map publisher account' do
273
- assert_recognizes({controller: 'publisher/registrations', action: 'new'}, {path: '/publisher/accounts/sign_up', method: :get})
274
- assert_equal '/publisher/accounts/sign_up', @routes.url_helpers.new_publisher_account_registration_path
275
- end
276
-
277
- test 'map publisher account merges path names' do
278
- assert_recognizes({controller: 'publisher/sessions', action: 'new'}, {path: '/publisher/accounts/get_in', method: :get})
279
- assert_equal '/publisher/accounts/get_in', @routes.url_helpers.new_publisher_account_session_path
280
- end
281
- end