devise 4.3.0 → 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.
Files changed (259) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +205 -2
  3. data/MIT-LICENSE +2 -1
  4. data/README.md +214 -57
  5. data/app/controllers/devise/confirmations_controller.rb +3 -0
  6. data/app/controllers/devise/omniauth_callbacks_controller.rb +3 -1
  7. data/app/controllers/devise/passwords_controller.rb +5 -2
  8. data/app/controllers/devise/registrations_controller.rb +32 -12
  9. data/app/controllers/devise/sessions_controller.rb +4 -2
  10. data/app/controllers/devise/unlocks_controller.rb +3 -0
  11. data/app/controllers/devise_controller.rb +6 -3
  12. data/app/helpers/devise_helper.rb +23 -18
  13. data/app/mailers/devise/mailer.rb +7 -5
  14. data/app/views/devise/confirmations/new.html.erb +2 -2
  15. data/app/views/devise/passwords/edit.html.erb +3 -3
  16. data/app/views/devise/passwords/new.html.erb +2 -2
  17. data/app/views/devise/registrations/edit.html.erb +6 -6
  18. data/app/views/devise/registrations/new.html.erb +4 -4
  19. data/app/views/devise/sessions/new.html.erb +4 -4
  20. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  21. data/app/views/devise/shared/_links.html.erb +8 -8
  22. data/app/views/devise/unlocks/new.html.erb +2 -2
  23. data/config/locales/en.yml +3 -2
  24. data/lib/devise/controllers/helpers.rb +10 -8
  25. data/lib/devise/controllers/rememberable.rb +2 -0
  26. data/lib/devise/controllers/responder.rb +35 -0
  27. data/lib/devise/controllers/scoped_views.rb +2 -0
  28. data/lib/devise/controllers/sign_in_out.rb +14 -4
  29. data/lib/devise/controllers/store_location.rb +24 -6
  30. data/lib/devise/controllers/url_helpers.rb +3 -1
  31. data/lib/devise/delegator.rb +2 -0
  32. data/lib/devise/encryptor.rb +2 -0
  33. data/lib/devise/failure_app.rb +33 -7
  34. data/lib/devise/hooks/activatable.rb +2 -0
  35. data/lib/devise/hooks/csrf_cleaner.rb +8 -1
  36. data/lib/devise/hooks/forgetable.rb +2 -0
  37. data/lib/devise/hooks/lockable.rb +4 -5
  38. data/lib/devise/hooks/proxy.rb +2 -0
  39. data/lib/devise/hooks/rememberable.rb +2 -0
  40. data/lib/devise/hooks/timeoutable.rb +4 -2
  41. data/lib/devise/hooks/trackable.rb +2 -0
  42. data/lib/devise/mailers/helpers.rb +2 -0
  43. data/lib/devise/mapping.rb +3 -1
  44. data/lib/devise/models/authenticatable.rb +55 -50
  45. data/lib/devise/models/confirmable.rb +36 -40
  46. data/lib/devise/models/database_authenticatable.rb +57 -36
  47. data/lib/devise/models/lockable.rb +18 -4
  48. data/lib/devise/models/omniauthable.rb +4 -2
  49. data/lib/devise/models/recoverable.rb +10 -19
  50. data/lib/devise/models/registerable.rb +4 -0
  51. data/lib/devise/models/rememberable.rb +5 -3
  52. data/lib/devise/models/timeoutable.rb +3 -1
  53. data/lib/devise/models/trackable.rb +15 -1
  54. data/lib/devise/models/validatable.rb +7 -10
  55. data/lib/devise/models.rb +3 -0
  56. data/lib/devise/modules.rb +2 -0
  57. data/lib/devise/omniauth/config.rb +2 -0
  58. data/lib/devise/omniauth/url_helpers.rb +2 -0
  59. data/lib/devise/omniauth.rb +4 -5
  60. data/lib/devise/orm/active_record.rb +2 -0
  61. data/lib/devise/orm/mongoid.rb +2 -0
  62. data/lib/devise/orm.rb +71 -0
  63. data/lib/devise/parameter_filter.rb +4 -0
  64. data/lib/devise/parameter_sanitizer.rb +15 -1
  65. data/lib/devise/rails/deprecated_constant_accessor.rb +39 -0
  66. data/lib/devise/rails/routes.rb +8 -6
  67. data/lib/devise/rails/warden_compat.rb +2 -0
  68. data/lib/devise/rails.rb +3 -5
  69. data/lib/devise/secret_key_finder.rb +27 -0
  70. data/lib/devise/strategies/authenticatable.rb +3 -1
  71. data/lib/devise/strategies/base.rb +2 -0
  72. data/lib/devise/strategies/database_authenticatable.rb +8 -1
  73. data/lib/devise/strategies/rememberable.rb +2 -0
  74. data/lib/devise/test/controller_helpers.rb +6 -1
  75. data/lib/devise/test/integration_helpers.rb +3 -1
  76. data/lib/devise/test_helpers.rb +2 -0
  77. data/lib/devise/time_inflector.rb +2 -0
  78. data/lib/devise/token_generator.rb +2 -0
  79. data/lib/devise/version.rb +3 -1
  80. data/lib/devise.rb +38 -12
  81. data/lib/generators/active_record/devise_generator.rb +40 -12
  82. data/lib/generators/active_record/templates/migration.rb +3 -1
  83. data/lib/generators/active_record/templates/migration_existing.rb +2 -0
  84. data/lib/generators/devise/controllers_generator.rb +3 -1
  85. data/lib/generators/devise/devise_generator.rb +5 -3
  86. data/lib/generators/devise/install_generator.rb +3 -5
  87. data/lib/generators/devise/orm_helpers.rb +9 -3
  88. data/lib/generators/devise/views_generator.rb +8 -9
  89. data/lib/generators/mongoid/devise_generator.rb +7 -5
  90. data/lib/generators/templates/README +9 -1
  91. data/lib/generators/templates/controllers/confirmations_controller.rb +2 -0
  92. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +3 -1
  93. data/lib/generators/templates/controllers/passwords_controller.rb +2 -0
  94. data/lib/generators/templates/controllers/registrations_controller.rb +2 -0
  95. data/lib/generators/templates/controllers/sessions_controller.rb +2 -0
  96. data/lib/generators/templates/controllers/unlocks_controller.rb +2 -0
  97. data/lib/generators/templates/devise.rb +43 -7
  98. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +5 -1
  99. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +10 -2
  100. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +4 -1
  101. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +12 -4
  102. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +11 -3
  103. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +7 -2
  104. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +4 -1
  105. metadata +24 -307
  106. data/.gitignore +0 -10
  107. data/.travis.yml +0 -58
  108. data/.yardopts +0 -9
  109. data/CODE_OF_CONDUCT.md +0 -22
  110. data/CONTRIBUTING.md +0 -79
  111. data/Gemfile +0 -40
  112. data/Gemfile.lock +0 -194
  113. data/Rakefile +0 -36
  114. data/bin/test +0 -13
  115. data/devise.gemspec +0 -26
  116. data/devise.png +0 -0
  117. data/gemfiles/Gemfile.rails-4.1-stable +0 -30
  118. data/gemfiles/Gemfile.rails-4.1-stable.lock +0 -171
  119. data/gemfiles/Gemfile.rails-4.2-stable +0 -30
  120. data/gemfiles/Gemfile.rails-4.2-stable.lock +0 -192
  121. data/gemfiles/Gemfile.rails-5.0-stable +0 -34
  122. data/gemfiles/Gemfile.rails-5.0-stable.lock +0 -193
  123. data/guides/bug_report_templates/integration_test.rb +0 -104
  124. data/test/controllers/custom_registrations_controller_test.rb +0 -40
  125. data/test/controllers/custom_strategy_test.rb +0 -64
  126. data/test/controllers/helper_methods_test.rb +0 -22
  127. data/test/controllers/helpers_test.rb +0 -316
  128. data/test/controllers/inherited_controller_i18n_messages_test.rb +0 -51
  129. data/test/controllers/internal_helpers_test.rb +0 -127
  130. data/test/controllers/load_hooks_controller_test.rb +0 -19
  131. data/test/controllers/passwords_controller_test.rb +0 -32
  132. data/test/controllers/sessions_controller_test.rb +0 -106
  133. data/test/controllers/url_helpers_test.rb +0 -65
  134. data/test/delegator_test.rb +0 -19
  135. data/test/devise_test.rb +0 -107
  136. data/test/failure_app_test.rb +0 -338
  137. data/test/generators/active_record_generator_test.rb +0 -83
  138. data/test/generators/controllers_generator_test.rb +0 -48
  139. data/test/generators/devise_generator_test.rb +0 -39
  140. data/test/generators/install_generator_test.rb +0 -24
  141. data/test/generators/mongoid_generator_test.rb +0 -23
  142. data/test/generators/views_generator_test.rb +0 -103
  143. data/test/helpers/devise_helper_test.rb +0 -49
  144. data/test/integration/authenticatable_test.rb +0 -698
  145. data/test/integration/confirmable_test.rb +0 -324
  146. data/test/integration/database_authenticatable_test.rb +0 -95
  147. data/test/integration/http_authenticatable_test.rb +0 -106
  148. data/test/integration/lockable_test.rb +0 -240
  149. data/test/integration/mounted_engine_test.rb +0 -36
  150. data/test/integration/omniauthable_test.rb +0 -135
  151. data/test/integration/recoverable_test.rb +0 -347
  152. data/test/integration/registerable_test.rb +0 -363
  153. data/test/integration/rememberable_test.rb +0 -217
  154. data/test/integration/timeoutable_test.rb +0 -184
  155. data/test/integration/trackable_test.rb +0 -92
  156. data/test/mailers/confirmation_instructions_test.rb +0 -115
  157. data/test/mailers/email_changed_test.rb +0 -130
  158. data/test/mailers/mailer_test.rb +0 -18
  159. data/test/mailers/reset_password_instructions_test.rb +0 -96
  160. data/test/mailers/unlock_instructions_test.rb +0 -91
  161. data/test/mapping_test.rb +0 -134
  162. data/test/models/authenticatable_test.rb +0 -23
  163. data/test/models/confirmable_test.rb +0 -536
  164. data/test/models/database_authenticatable_test.rb +0 -281
  165. data/test/models/lockable_test.rb +0 -350
  166. data/test/models/omniauthable_test.rb +0 -7
  167. data/test/models/recoverable_test.rb +0 -261
  168. data/test/models/registerable_test.rb +0 -7
  169. data/test/models/rememberable_test.rb +0 -182
  170. data/test/models/serializable_test.rb +0 -54
  171. data/test/models/timeoutable_test.rb +0 -51
  172. data/test/models/trackable_test.rb +0 -41
  173. data/test/models/validatable_test.rb +0 -119
  174. data/test/models_test.rb +0 -153
  175. data/test/omniauth/config_test.rb +0 -59
  176. data/test/omniauth/url_helpers_test.rb +0 -51
  177. data/test/orm/active_record.rb +0 -17
  178. data/test/orm/mongoid.rb +0 -13
  179. data/test/parameter_sanitizer_test.rb +0 -75
  180. data/test/rails_app/Rakefile +0 -6
  181. data/test/rails_app/app/active_record/admin.rb +0 -6
  182. data/test/rails_app/app/active_record/shim.rb +0 -2
  183. data/test/rails_app/app/active_record/user.rb +0 -7
  184. data/test/rails_app/app/active_record/user_on_engine.rb +0 -7
  185. data/test/rails_app/app/active_record/user_on_main_app.rb +0 -7
  186. data/test/rails_app/app/active_record/user_without_email.rb +0 -8
  187. data/test/rails_app/app/controllers/admins/sessions_controller.rb +0 -6
  188. data/test/rails_app/app/controllers/admins_controller.rb +0 -6
  189. data/test/rails_app/app/controllers/application_controller.rb +0 -11
  190. data/test/rails_app/app/controllers/application_with_fake_engine.rb +0 -30
  191. data/test/rails_app/app/controllers/custom/registrations_controller.rb +0 -31
  192. data/test/rails_app/app/controllers/home_controller.rb +0 -29
  193. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +0 -2
  194. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +0 -2
  195. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +0 -14
  196. data/test/rails_app/app/controllers/users_controller.rb +0 -31
  197. data/test/rails_app/app/helpers/application_helper.rb +0 -3
  198. data/test/rails_app/app/mailers/users/from_proc_mailer.rb +0 -3
  199. data/test/rails_app/app/mailers/users/mailer.rb +0 -3
  200. data/test/rails_app/app/mailers/users/reply_to_mailer.rb +0 -4
  201. data/test/rails_app/app/mongoid/admin.rb +0 -29
  202. data/test/rails_app/app/mongoid/shim.rb +0 -23
  203. data/test/rails_app/app/mongoid/user.rb +0 -39
  204. data/test/rails_app/app/mongoid/user_on_engine.rb +0 -39
  205. data/test/rails_app/app/mongoid/user_on_main_app.rb +0 -39
  206. data/test/rails_app/app/mongoid/user_without_email.rb +0 -33
  207. data/test/rails_app/app/views/admins/index.html.erb +0 -1
  208. data/test/rails_app/app/views/admins/sessions/new.html.erb +0 -2
  209. data/test/rails_app/app/views/home/admin_dashboard.html.erb +0 -1
  210. data/test/rails_app/app/views/home/index.html.erb +0 -1
  211. data/test/rails_app/app/views/home/join.html.erb +0 -1
  212. data/test/rails_app/app/views/home/private.html.erb +0 -1
  213. data/test/rails_app/app/views/home/user_dashboard.html.erb +0 -1
  214. data/test/rails_app/app/views/layouts/application.html.erb +0 -24
  215. data/test/rails_app/app/views/users/edit_form.html.erb +0 -1
  216. data/test/rails_app/app/views/users/index.html.erb +0 -1
  217. data/test/rails_app/app/views/users/mailer/confirmation_instructions.erb +0 -1
  218. data/test/rails_app/app/views/users/sessions/new.html.erb +0 -1
  219. data/test/rails_app/bin/bundle +0 -3
  220. data/test/rails_app/bin/rails +0 -4
  221. data/test/rails_app/bin/rake +0 -4
  222. data/test/rails_app/config/application.rb +0 -44
  223. data/test/rails_app/config/boot.rb +0 -20
  224. data/test/rails_app/config/database.yml +0 -18
  225. data/test/rails_app/config/environment.rb +0 -5
  226. data/test/rails_app/config/environments/development.rb +0 -30
  227. data/test/rails_app/config/environments/production.rb +0 -86
  228. data/test/rails_app/config/environments/test.rb +0 -45
  229. data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -7
  230. data/test/rails_app/config/initializers/devise.rb +0 -180
  231. data/test/rails_app/config/initializers/inflections.rb +0 -2
  232. data/test/rails_app/config/initializers/secret_token.rb +0 -3
  233. data/test/rails_app/config/initializers/session_store.rb +0 -1
  234. data/test/rails_app/config/routes.rb +0 -126
  235. data/test/rails_app/config.ru +0 -4
  236. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -75
  237. data/test/rails_app/db/schema.rb +0 -55
  238. data/test/rails_app/lib/shared_admin.rb +0 -21
  239. data/test/rails_app/lib/shared_user.rb +0 -30
  240. data/test/rails_app/lib/shared_user_without_email.rb +0 -26
  241. data/test/rails_app/lib/shared_user_without_omniauth.rb +0 -13
  242. data/test/rails_app/public/404.html +0 -26
  243. data/test/rails_app/public/422.html +0 -26
  244. data/test/rails_app/public/500.html +0 -26
  245. data/test/rails_app/public/favicon.ico +0 -0
  246. data/test/rails_test.rb +0 -9
  247. data/test/routes_test.rb +0 -279
  248. data/test/support/action_controller/record_identifier.rb +0 -10
  249. data/test/support/assertions.rb +0 -28
  250. data/test/support/helpers.rb +0 -77
  251. data/test/support/http_method_compatibility.rb +0 -51
  252. data/test/support/integration.rb +0 -92
  253. data/test/support/locale/en.yml +0 -8
  254. data/test/support/mongoid.yml +0 -6
  255. data/test/support/webrat/integrations/rails.rb +0 -33
  256. data/test/test/controller_helpers_test.rb +0 -186
  257. data/test/test/integration_helpers_test.rb +0 -32
  258. data/test/test_helper.rb +0 -34
  259. data/test/test_models.rb +0 -33
@@ -1,180 +0,0 @@
1
- require "omniauth-facebook"
2
- require "omniauth-openid"
3
-
4
- # Use this hook to configure devise mailer, warden hooks and so forth. The first
5
- # four configuration values can also be set straight in your models.
6
- Devise.setup do |config|
7
- config.secret_key = "d9eb5171c59a4c817f68b0de27b8c1e340c2341b52cdbc60d3083d4e8958532" \
8
- "18dcc5f589cafde048faec956b61f864b9b5513ff9ce29bf9e5d58b0f234f8e3b"
9
-
10
- # ==> Mailer Configuration
11
- # Configure the e-mail address which will be shown in Devise::Mailer,
12
- # note that it will be overwritten if you use your own mailer class with default "from" parameter.
13
- config.mailer_sender = "please-change-me@config-initializers-devise.com"
14
-
15
-
16
- config.parent_controller = "ApplicationWithFakeEngine"
17
- # Configure the class responsible to send e-mails.
18
- # config.mailer = "Devise::Mailer"
19
-
20
- # ==> ORM configuration
21
- # Load and configure the ORM. Supports :active_record (default) and
22
- # :mongoid (bson_ext recommended) by default. Other ORMs may be
23
- # available as additional gems.
24
- require "devise/orm/#{DEVISE_ORM}"
25
-
26
- # ==> Configuration for any authentication mechanism
27
- # Configure which keys are used when authenticating a user. By default is
28
- # just :email. You can configure it to use [:username, :subdomain], so for
29
- # authenticating a user, both parameters are required. Remember that those
30
- # parameters are used only when authenticating and not when retrieving from
31
- # session. If you need permissions, you should implement that in a before filter.
32
- # You can also supply hash where the value is a boolean expliciting if authentication
33
- # should be aborted or not if the value is not present. By default is empty.
34
- # config.authentication_keys = [:email]
35
-
36
- # Configure parameters from the request object used for authentication. Each entry
37
- # given should be a request method and it will automatically be passed to
38
- # find_for_authentication method and considered in your model lookup. For instance,
39
- # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
40
- # The same considerations mentioned for authentication_keys also apply to request_keys.
41
- # config.request_keys = []
42
-
43
- # Configure which authentication keys should be case-insensitive.
44
- # These keys will be downcased upon creating or modifying a user and when used
45
- # to authenticate or find a user. Default is :email.
46
- config.case_insensitive_keys = [:email]
47
-
48
- # Configure which authentication keys should have whitespace stripped.
49
- # These keys will have whitespace before and after removed upon creating or
50
- # modifying a user and when used to authenticate or find a user. Default is :email.
51
- config.strip_whitespace_keys = [:email]
52
-
53
- # Tell if authentication through request.params is enabled. True by default.
54
- # config.params_authenticatable = true
55
-
56
- # Tell if authentication through HTTP Basic Auth is enabled. False by default.
57
- config.http_authenticatable = true
58
-
59
- # If http headers should be returned for AJAX requests. True by default.
60
- # config.http_authenticatable_on_xhr = true
61
-
62
- # The realm used in Http Basic Authentication. "Application" by default.
63
- # config.http_authentication_realm = "Application"
64
-
65
- # ==> Configuration for :database_authenticatable
66
- # For bcrypt, this is the cost for hashing the password and defaults to 10. If
67
- # using other encryptors, it sets how many times you want the password re-encrypted.
68
- config.stretches = Rails.env.test? ? 1 : 10
69
-
70
- # ==> Configuration for :confirmable
71
- # The time you want to give your user to confirm their account. During this time
72
- # they will be able to access your application without confirming. Default is nil.
73
- # When allow_unconfirmed_access_for is zero, the user won't be able to sign in without confirming.
74
- # You can use this to let your user access some features of your application
75
- # without confirming the account, but blocking it after a certain period
76
- # (ie 2 days).
77
- # config.allow_unconfirmed_access_for = 2.days
78
-
79
- # Defines which key will be used when confirming an account
80
- # config.confirmation_keys = [:email]
81
-
82
- # ==> Configuration for :rememberable
83
- # The time the user will be remembered without asking for credentials again.
84
- # config.remember_for = 2.weeks
85
-
86
- # If true, extends the user's remember period when remembered via cookie.
87
- # config.extend_remember_period = false
88
-
89
- # ==> Configuration for :validatable
90
- # Range for password length. Default is 8..72.
91
- # config.password_length = 8..72
92
-
93
- # Regex to use to validate the email address
94
- # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
95
-
96
- # ==> Configuration for :timeoutable
97
- # The time you want to timeout the user session without activity. After this
98
- # time the user will be asked for credentials again. Default is 30 minutes.
99
- # config.timeout_in = 30.minutes
100
-
101
- # ==> Configuration for :lockable
102
- # Defines which strategy will be used to lock an account.
103
- # :failed_attempts = Locks an account after a number of failed attempts to sign in.
104
- # :none = No lock strategy. You should handle locking by yourself.
105
- # config.lock_strategy = :failed_attempts
106
-
107
- # Defines which key will be used when locking and unlocking an account
108
- # config.unlock_keys = [:email]
109
-
110
- # Defines which strategy will be used to unlock an account.
111
- # :email = Sends an unlock link to the user email
112
- # :time = Re-enables login after a certain amount of time (see :unlock_in below)
113
- # :both = Enables both strategies
114
- # :none = No unlock strategy. You should handle unlocking by yourself.
115
- # config.unlock_strategy = :both
116
-
117
- # Number of authentication tries before locking an account if lock_strategy
118
- # is failed attempts.
119
- # config.maximum_attempts = 20
120
-
121
- # Time interval to unlock the account if :time is enabled as unlock_strategy.
122
- # config.unlock_in = 1.hour
123
-
124
- # ==> Configuration for :recoverable
125
- #
126
- # Defines which key will be used when recovering the password for an account
127
- # config.reset_password_keys = [:email]
128
-
129
- # Time interval you can reset your password with a reset password key.
130
- # Don't put a too small interval or your users won't have the time to
131
- # change their passwords.
132
- config.reset_password_within = 2.hours
133
-
134
- # When set to false, does not sign a user in automatically after their password is
135
- # reset. Defaults to true, so a user is signed in automatically after a reset.
136
- # config.sign_in_after_reset_password = true
137
-
138
- # Set up a pepper to generate the encrypted password.
139
- config.pepper = "d142367154e5beacca404b1a6a4f8bc52c6fdcfa3ccc3cf8eb49f3458a688ee6ac3b9fae488432a3bfca863b8a90008368a9f3a3dfbe5a962e64b6ab8f3a3a1a"
140
-
141
- # ==> Scopes configuration
142
- # Turn scoped views on. Before rendering "sessions/new", it will first check for
143
- # "users/sessions/new". It's turned off by default because it's slower if you
144
- # are using only default views.
145
- # config.scoped_views = false
146
-
147
- # Configure the default scope given to Warden. By default it's the first
148
- # devise role declared in your routes (usually :user).
149
- # config.default_scope = :user
150
-
151
- # Configure sign_out behavior.
152
- # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
153
- # The default is true, which means any logout action will sign out all active scopes.
154
- # config.sign_out_all_scopes = true
155
-
156
- # ==> Navigation configuration
157
- # Lists the formats that should be treated as navigational. Formats like
158
- # :html, should redirect to the sign in page when the user does not have
159
- # access, but formats like :xml or :json, should return 401.
160
- # If you have any extra navigational formats, like :iphone or :mobile, you
161
- # should add them to the navigational formats lists. Default is [:html]
162
- # config.navigational_formats = [:html, :iphone]
163
-
164
- # The default HTTP method used to sign out a resource. Default is :get.
165
- # config.sign_out_via = :get
166
-
167
- # ==> OmniAuth
168
- config.omniauth :facebook, 'APP_ID', 'APP_SECRET', scope: 'email,offline_access'
169
- config.omniauth :openid
170
- config.omniauth :openid, name: 'google', identifier: 'https://www.google.com/accounts/o8/id'
171
-
172
- # ==> Warden configuration
173
- # If you want to use other strategies, that are not supported by Devise, or
174
- # change the failure app, you can configure them inside the config.warden block.
175
- #
176
- # config.warden do |manager|
177
- # manager.failure_app = AnotherApp
178
- # manager.default_strategies(scope: :user).unshift :some_external_strategy
179
- # end
180
- end
@@ -1,2 +0,0 @@
1
- ActiveSupport::Inflector.inflections do |inflect|
2
- end
@@ -1,3 +0,0 @@
1
- config = Rails.application.config
2
-
3
- config.secret_key_base = 'd588e99efff13a86461fd6ab82327823ad2f8feb5dc217ce652cdd9f0dfc5eb4b5a62a92d24d2574d7d51dfb1ea8dd453ea54e00cf672159a13104a135422a10'
@@ -1 +0,0 @@
1
- RailsApp::Application.config.session_store :cookie_store, key: '_rails_app_session'
@@ -1,126 +0,0 @@
1
- Rails.application.routes.draw do
2
- # Resources for testing
3
- resources :users, only: [:index] do
4
- member do
5
- get :expire
6
- get :accept
7
- get :edit_form
8
- put :update_form
9
- end
10
-
11
- authenticate do
12
- post :exhibit, on: :member
13
- end
14
- end
15
-
16
- resources :admins, only: [:index]
17
-
18
- # Users scope
19
- devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
20
-
21
- devise_for :user_on_main_apps,
22
- class_name: 'UserOnMainApp',
23
- router_name: :main_app,
24
- module: :devise
25
-
26
- devise_for :user_on_engines,
27
- class_name: 'UserOnEngine',
28
- router_name: :fake_engine,
29
- module: :devise
30
-
31
- devise_for :user_without_email,
32
- class_name: 'UserWithoutEmail',
33
- router_name: :main_app,
34
- module: :devise
35
-
36
- as :user do
37
- get "/as/sign_in", to: "devise/sessions#new"
38
- end
39
-
40
- get "/sign_in", to: "devise/sessions#new"
41
-
42
- # Routes for custom controller testing
43
- devise_for :user, only: [:registrations], controllers: { registrations: "custom/registrations" }, as: :custom, path: :custom
44
-
45
- # Admin scope
46
- devise_for :admin, path: "admin_area", controllers: { sessions: :"admins/sessions" }, skip: :passwords
47
-
48
- get "/admin_area/home", to: "admins#index", as: :admin_root
49
- get "/anywhere", to: "foo#bar", as: :new_admin_password
50
-
51
- authenticate(:admin) do
52
- get "/private", to: "home#private", as: :private
53
- end
54
-
55
- authenticate(:admin, lambda { |admin| admin.active? }) do
56
- get "/private/active", to: "home#private", as: :private_active
57
- end
58
-
59
- authenticated :admin do
60
- get "/dashboard", to: "home#admin_dashboard"
61
- end
62
-
63
- authenticated :admin, lambda { |admin| admin.active? } do
64
- get "/dashboard/active", to: "home#admin_dashboard"
65
- end
66
-
67
- authenticated do
68
- get "/dashboard", to: "home#user_dashboard"
69
- end
70
-
71
- unauthenticated do
72
- get "/join", to: "home#join"
73
- end
74
-
75
- # Routes for constraints testing
76
- devise_for :headquarters_admin, class_name: "Admin", path: "headquarters", constraints: {host: /192\.168\.1\.\d\d\d/}
77
-
78
- constraints(host: /192\.168\.1\.\d\d\d/) do
79
- devise_for :homebase_admin, class_name: "Admin", path: "homebase"
80
- end
81
-
82
- scope(subdomain: 'sub') do
83
- devise_for :subdomain_users, class_name: "User", only: [:sessions]
84
- end
85
-
86
- devise_for :skip_admin, class_name: "Admin", skip: :all
87
-
88
- # Routes for format=false testing
89
- devise_for :htmlonly_admin, class_name: "Admin", skip: [:confirmations, :unlocks], path: "htmlonly_admin", format: false, skip_helpers: [:confirmations, :unlocks]
90
- devise_for :htmlonly_users, class_name: "User", only: [:confirmations, :unlocks], path: "htmlonly_users", format: false, skip_helpers: true
91
-
92
- # Other routes for routing_test.rb
93
- devise_for :reader, class_name: "User", only: :passwords
94
-
95
- scope host: "sub.example.com" do
96
- devise_for :sub_admin, class_name: "Admin"
97
- end
98
-
99
- namespace :publisher, path_names: { sign_in: "i_dont_care", sign_out: "get_out" } do
100
- devise_for :accounts, class_name: "Admin", path_names: { sign_in: "get_in" }
101
- end
102
-
103
- scope ":locale", module: :invalid do
104
- devise_for :accounts, singular: "manager", class_name: "Admin",
105
- path_names: {
106
- sign_in: "login", sign_out: "logout",
107
- password: "secret", confirmation: "verification",
108
- unlock: "unblock", sign_up: "register",
109
- registration: "management",
110
- cancel: "giveup", edit: "edit/profile"
111
- }, failure_app: lambda { |env| [404, {"Content-Type" => "text/plain"}, ["Oops, not found"]] }, module: :devise
112
- end
113
-
114
- namespace :sign_out_via, module: "devise" do
115
- devise_for :deletes, sign_out_via: :delete, class_name: "Admin"
116
- devise_for :posts, sign_out_via: :post, class_name: "Admin"
117
- devise_for :gets, sign_out_via: :get, class_name: "Admin"
118
- devise_for :delete_or_posts, sign_out_via: [:delete, :post], class_name: "Admin"
119
- end
120
-
121
- get "/set", to: "home#set"
122
- get "/unauthenticated", to: "home#unauthenticated"
123
- get "/custom_strategy/new"
124
-
125
- root to: "home#index", via: [:get, :post]
126
- end
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run RailsApp::Application
@@ -1,75 +0,0 @@
1
- superclass = ActiveRecord::Migration
2
- # TODO: Inherit from the 5.0 Migration class directly when we drop support for Rails 4.
3
- superclass = ActiveRecord::Migration[5.0] if superclass.respond_to?(:[])
4
-
5
- class CreateTables < superclass
6
- def self.up
7
- create_table :users do |t|
8
- t.string :username
9
- t.string :facebook_token
10
-
11
- ## Database authenticatable
12
- t.string :email, null: false, default: ""
13
- t.string :encrypted_password, null: false, default: ""
14
-
15
- ## Recoverable
16
- t.string :reset_password_token
17
- t.datetime :reset_password_sent_at
18
-
19
- ## Rememberable
20
- t.datetime :remember_created_at
21
-
22
- ## Trackable
23
- t.integer :sign_in_count, default: 0
24
- t.datetime :current_sign_in_at
25
- t.datetime :last_sign_in_at
26
- t.string :current_sign_in_ip
27
- t.string :last_sign_in_ip
28
-
29
- ## Confirmable
30
- t.string :confirmation_token
31
- t.datetime :confirmed_at
32
- t.datetime :confirmation_sent_at
33
- # t.string :unconfirmed_email # Only if using reconfirmable
34
-
35
- ## Lockable
36
- t.integer :failed_attempts, default: 0 # Only if lock strategy is :failed_attempts
37
- t.string :unlock_token # Only if unlock strategy is :email or :both
38
- t.datetime :locked_at
39
-
40
- t.timestamps null: false
41
- end
42
-
43
- create_table :admins do |t|
44
- ## Database authenticatable
45
- t.string :email, null: true
46
- t.string :encrypted_password, null: true
47
-
48
- ## Recoverable
49
- t.string :reset_password_token
50
- t.datetime :reset_password_sent_at
51
-
52
- ## Rememberable
53
- t.datetime :remember_created_at
54
-
55
- ## Confirmable
56
- t.string :confirmation_token
57
- t.datetime :confirmed_at
58
- t.datetime :confirmation_sent_at
59
- t.string :unconfirmed_email # Only if using reconfirmable
60
-
61
- ## Lockable
62
- t.datetime :locked_at
63
-
64
- ## Attribute for testing route blocks
65
- t.boolean :active, default: false
66
-
67
- t.timestamps null: false
68
- end
69
- end
70
-
71
- def self.down
72
- drop_table :users
73
- drop_table :admins
74
- end
75
- end
@@ -1,55 +0,0 @@
1
- # encoding: UTF-8
2
- # This file is auto-generated from the current state of the database. Instead
3
- # of editing this file, please use the migrations feature of Active Record to
4
- # incrementally modify your database, and then regenerate this schema definition.
5
- #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
11
- #
12
- # It's strongly recommended that you check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(version: 20100401102949) do
15
-
16
- create_table "admins", force: true do |t|
17
- t.string "email"
18
- t.string "encrypted_password"
19
- t.string "reset_password_token"
20
- t.datetime "reset_password_sent_at"
21
- t.datetime "remember_created_at"
22
- t.string "confirmation_token"
23
- t.datetime "confirmed_at"
24
- t.datetime "confirmation_sent_at"
25
- t.string "unconfirmed_email"
26
- t.datetime "locked_at"
27
- t.boolean "active", default: false
28
- t.datetime "created_at"
29
- t.datetime "updated_at"
30
- end
31
-
32
- create_table "users", force: true do |t|
33
- t.string "username"
34
- t.string "facebook_token"
35
- t.string "email", default: "", null: false
36
- t.string "encrypted_password", default: "", null: false
37
- t.string "reset_password_token"
38
- t.datetime "reset_password_sent_at"
39
- t.datetime "remember_created_at"
40
- t.integer "sign_in_count", default: 0
41
- t.datetime "current_sign_in_at"
42
- t.datetime "last_sign_in_at"
43
- t.string "current_sign_in_ip"
44
- t.string "last_sign_in_ip"
45
- t.string "confirmation_token"
46
- t.datetime "confirmed_at"
47
- t.datetime "confirmation_sent_at"
48
- t.integer "failed_attempts", default: 0
49
- t.string "unlock_token"
50
- t.datetime "locked_at"
51
- t.datetime "created_at"
52
- t.datetime "updated_at"
53
- end
54
-
55
- end
@@ -1,21 +0,0 @@
1
- module SharedAdmin
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
- devise :database_authenticatable, :registerable,
6
- :timeoutable, :recoverable, :lockable, :confirmable,
7
- unlock_strategy: :time, lock_strategy: :none,
8
- allow_unconfirmed_access_for: 2.weeks, reconfirmable: true
9
-
10
- validates_length_of :reset_password_token, minimum: 3, allow_blank: true
11
- if Devise::Test.rails51?
12
- validates_uniqueness_of :email, allow_blank: true, if: :will_save_change_to_email?
13
- else
14
- validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
15
- end
16
- end
17
-
18
- def raw_confirmation_token
19
- @raw_confirmation_token
20
- end
21
- end
@@ -1,30 +0,0 @@
1
- module SharedUser
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
- devise :database_authenticatable, :confirmable, :lockable, :recoverable,
6
- :registerable, :rememberable, :timeoutable,
7
- :trackable, :validatable, :omniauthable, password_length: 7..72,
8
- reconfirmable: false
9
-
10
- attr_accessor :other_key
11
-
12
- # They need to be included after Devise is called.
13
- extend ExtendMethods
14
- end
15
-
16
- def raw_confirmation_token
17
- @raw_confirmation_token
18
- end
19
-
20
- module ExtendMethods
21
- def new_with_session(params, session)
22
- super.tap do |user|
23
- if data = session["devise.facebook_data"]
24
- user.email = data["email"]
25
- user.confirmed_at = Time.now
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,26 +0,0 @@
1
- module SharedUserWithoutEmail
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
- # NOTE: This is missing :validatable and :confirmable, as they both require
6
- # an email field at the moment. It is also missing :omniauthable because that
7
- # adds unnecessary complexity to the setup
8
- devise :database_authenticatable, :lockable, :recoverable,
9
- :registerable, :rememberable, :timeoutable,
10
- :trackable
11
- end
12
-
13
- # This test stub is a bit rubbish because it's tied very closely to the
14
- # implementation where we care about this one case. However, completely
15
- # removing the email field breaks "recoverable" tests completely, so we are
16
- # just taking the approach here that "email" is something that is a not an
17
- # ActiveRecord field.
18
- def email_changed?
19
- raise NoMethodError
20
- end
21
-
22
- def respond_to?(method_name, include_all=false)
23
- return false if method_name.to_sym == :email_changed?
24
- super(method_name, include_all)
25
- end
26
- end
@@ -1,13 +0,0 @@
1
- module SharedUserWithoutOmniauth
2
- extend ActiveSupport::Concern
3
-
4
- included do
5
- devise :database_authenticatable, :confirmable, :lockable, :recoverable,
6
- :registerable, :rememberable, :timeoutable,
7
- :trackable, :validatable, reconfirmable: false
8
- end
9
-
10
- def raw_confirmation_token
11
- @raw_confirmation_token
12
- end
13
- 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
data/test/rails_test.rb DELETED
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- class RailsTest < ActiveSupport::TestCase
4
- test 'correct initializer position' do
5
- initializer = Devise::Engine.initializers.detect { |i| i.name == 'devise.omniauth' }
6
- assert_equal :load_config_initializers, initializer.after
7
- assert_equal :build_middleware_stack, initializer.before
8
- end
9
- end