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,14 +0,0 @@
1
- class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
2
- def facebook
3
- data = request.respond_to?(:get_header) ? request.get_header("omniauth.auth") : request.env["omniauth.auth"]
4
- session["devise.facebook_data"] = data["extra"]["user_hash"]
5
- render json: data
6
- end
7
-
8
- def sign_in_facebook
9
- user = User.to_adapter.find_first(email: 'user@test.com')
10
- user.remember_me = true
11
- sign_in user
12
- render (Devise::Test.rails5? ? :body : :text) => ""
13
- end
14
- end
@@ -1,31 +0,0 @@
1
- class UsersController < ApplicationController
2
- prepend_before_action :current_user, only: :exhibit
3
- before_action :authenticate_user!, except: [:accept, :exhibit]
4
- respond_to :html, :xml
5
-
6
- def index
7
- user_session[:cart] = "Cart"
8
- respond_with(current_user)
9
- end
10
-
11
- def edit_form
12
- user_session['last_request_at'] = params.fetch(:last_request_at, 31.minutes.ago.utc)
13
- end
14
-
15
- def update_form
16
- render (Devise::Test.rails5? ? :body : :text) => 'Update'
17
- end
18
-
19
- def accept
20
- @current_user = current_user
21
- end
22
-
23
- def exhibit
24
- render (Devise::Test.rails5? ? :body : :text) => current_user ? "User is authenticated" : "User is not authenticated"
25
- end
26
-
27
- def expire
28
- user_session['last_request_at'] = 31.minutes.ago.utc
29
- render (Devise::Test.rails5? ? :body : :text) => 'User will be expired on next request'
30
- end
31
- end
@@ -1,3 +0,0 @@
1
- # Methods added to this helper will be available to all templates in the application.
2
- module ApplicationHelper
3
- end
@@ -1,3 +0,0 @@
1
- class Users::FromProcMailer < Devise::Mailer
2
- default from: proc { 'custom@example.com' }
3
- end
@@ -1,3 +0,0 @@
1
- class Users::Mailer < Devise::Mailer
2
- default from: 'custom@example.com'
3
- end
@@ -1,4 +0,0 @@
1
- class Users::ReplyToMailer < Devise::Mailer
2
- default from: 'custom@example.com'
3
- default reply_to: 'custom_reply_to@example.com'
4
- end
@@ -1,29 +0,0 @@
1
- require 'shared_admin'
2
-
3
- class Admin
4
- include Mongoid::Document
5
- include Shim
6
- include SharedAdmin
7
-
8
- ## Database authenticatable
9
- field :email, type: String
10
- field :encrypted_password, type: String
11
-
12
- ## Recoverable
13
- field :reset_password_token, type: String
14
- field :reset_password_sent_at, type: Time
15
-
16
- ## Rememberable
17
- field :remember_created_at, type: Time
18
-
19
- ## Confirmable
20
- field :confirmation_token, type: String
21
- field :confirmed_at, type: Time
22
- field :confirmation_sent_at, type: Time
23
- field :unconfirmed_email, type: String # Only if using reconfirmable
24
-
25
- ## Lockable
26
- field :locked_at, type: Time
27
-
28
- field :active, type: Boolean, default: false
29
- end
@@ -1,23 +0,0 @@
1
- module Shim
2
- extend ::ActiveSupport::Concern
3
-
4
- included do
5
- include ::Mongoid::Timestamps
6
- field :created_at, type: DateTime
7
- end
8
-
9
- module ClassMethods
10
- def order(attribute)
11
- asc(attribute)
12
- end
13
-
14
- def find_by_email(email)
15
- find_by(email: email)
16
- end
17
- end
18
-
19
- # overwrite equality (because some devise tests use this for asserting model equality)
20
- def ==(other)
21
- other.is_a?(self.class) && _id == other._id
22
- end
23
- end
@@ -1,39 +0,0 @@
1
- require 'shared_user'
2
-
3
- class User
4
- include Mongoid::Document
5
- include Shim
6
- include SharedUser
7
-
8
- field :username, type: String
9
- field :facebook_token, type: String
10
-
11
- ## Database authenticatable
12
- field :email, type: String, default: ""
13
- field :encrypted_password, type: String, default: ""
14
-
15
- ## Recoverable
16
- field :reset_password_token, type: String
17
- field :reset_password_sent_at, type: Time
18
-
19
- ## Rememberable
20
- field :remember_created_at, type: Time
21
-
22
- ## Trackable
23
- field :sign_in_count, type: Integer, default: 0
24
- field :current_sign_in_at, type: Time
25
- field :last_sign_in_at, type: Time
26
- field :current_sign_in_ip, type: String
27
- field :last_sign_in_ip, type: String
28
-
29
- ## Confirmable
30
- field :confirmation_token, type: String
31
- field :confirmed_at, type: Time
32
- field :confirmation_sent_at, type: Time
33
- # field :unconfirmed_email, type: String # Only if using reconfirmable
34
-
35
- ## Lockable
36
- field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
37
- field :unlock_token, type: String # Only if unlock strategy is :email or :both
38
- field :locked_at, type: Time
39
- end
@@ -1,39 +0,0 @@
1
- require 'shared_user_without_omniauth'
2
-
3
- class UserOnEngine
4
- include Mongoid::Document
5
- include Shim
6
- include SharedUserWithoutOmniauth
7
-
8
- field :username, type: String
9
- field :facebook_token, type: String
10
-
11
- ## Database authenticatable
12
- field :email, type: String, default: ""
13
- field :encrypted_password, type: String, default: ""
14
-
15
- ## Recoverable
16
- field :reset_password_token, type: String
17
- field :reset_password_sent_at, type: Time
18
-
19
- ## Rememberable
20
- field :remember_created_at, type: Time
21
-
22
- ## Trackable
23
- field :sign_in_count, type: Integer, default: 0
24
- field :current_sign_in_at, type: Time
25
- field :last_sign_in_at, type: Time
26
- field :current_sign_in_ip, type: String
27
- field :last_sign_in_ip, type: String
28
-
29
- ## Confirmable
30
- field :confirmation_token, type: String
31
- field :confirmed_at, type: Time
32
- field :confirmation_sent_at, type: Time
33
- # field :unconfirmed_email, type: String # Only if using reconfirmable
34
-
35
- ## Lockable
36
- field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
37
- field :unlock_token, type: String # Only if unlock strategy is :email or :both
38
- field :locked_at, type: Time
39
- end
@@ -1,39 +0,0 @@
1
- require 'shared_user_without_omniauth'
2
-
3
- class UserOnMainApp
4
- include Mongoid::Document
5
- include Shim
6
- include SharedUserWithoutOmniauth
7
-
8
- field :username, type: String
9
- field :facebook_token, type: String
10
-
11
- ## Database authenticatable
12
- field :email, type: String, default: ""
13
- field :encrypted_password, type: String, default: ""
14
-
15
- ## Recoverable
16
- field :reset_password_token, type: String
17
- field :reset_password_sent_at, type: Time
18
-
19
- ## Rememberable
20
- field :remember_created_at, type: Time
21
-
22
- ## Trackable
23
- field :sign_in_count, type: Integer, default: 0
24
- field :current_sign_in_at, type: Time
25
- field :last_sign_in_at, type: Time
26
- field :current_sign_in_ip, type: String
27
- field :last_sign_in_ip, type: String
28
-
29
- ## Confirmable
30
- field :confirmation_token, type: String
31
- field :confirmed_at, type: Time
32
- field :confirmation_sent_at, type: Time
33
- # field :unconfirmed_email, type: String # Only if using reconfirmable
34
-
35
- ## Lockable
36
- field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
37
- field :unlock_token, type: String # Only if unlock strategy is :email or :both
38
- field :locked_at, type: Time
39
- end
@@ -1,33 +0,0 @@
1
- require "shared_user_without_email"
2
-
3
- class UserWithoutEmail
4
- include Mongoid::Document
5
- include Shim
6
- include SharedUserWithoutEmail
7
-
8
- field :username, type: String
9
- field :facebook_token, type: String
10
-
11
- ## Database authenticatable
12
- field :email, type: String, default: ""
13
- field :encrypted_password, type: String, default: ""
14
-
15
- ## Recoverable
16
- field :reset_password_token, type: String
17
- field :reset_password_sent_at, type: Time
18
-
19
- ## Rememberable
20
- field :remember_created_at, type: Time
21
-
22
- ## Trackable
23
- field :sign_in_count, type: Integer, default: 0
24
- field :current_sign_in_at, type: Time
25
- field :last_sign_in_at, type: Time
26
- field :current_sign_in_ip, type: String
27
- field :last_sign_in_ip, type: String
28
-
29
- ## Lockable
30
- field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
31
- field :unlock_token, type: String # Only if unlock strategy is :email or :both
32
- field :locked_at, type: Time
33
- end
@@ -1 +0,0 @@
1
- Welcome Admin!
@@ -1,2 +0,0 @@
1
- Welcome to "sessions/new" view!
2
- <%= render file: "devise/sessions/new" %>
@@ -1 +0,0 @@
1
- Admin dashboard
@@ -1 +0,0 @@
1
- Home!
@@ -1 +0,0 @@
1
- Join
@@ -1 +0,0 @@
1
- Private!
@@ -1 +0,0 @@
1
- User dashboard
@@ -1,24 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
- <html>
4
- <head>
5
- <title>Devise Test App</title>
6
- </head>
7
- <body>
8
- <div id="container">
9
- <%- flash.each do |name, msg| -%>
10
- <%= content_tag :div, msg, id: "flash_#{name}" %>
11
- <%- end -%>
12
-
13
- <% if user_signed_in? -%>
14
- <p>Hello User <%= current_user.email %>! You are signed in!</p>
15
- <% end -%>
16
-
17
- <% if admin_signed_in? -%>
18
- <p>Hello Admin <%= current_admin.email %>! You are signed in!</p>
19
- <% end -%>
20
-
21
- <%= yield %>
22
- </div>
23
- </body>
24
- </html>
@@ -1 +0,0 @@
1
- <%= button_to 'Update', update_form_user_path(current_user), method: 'put' %>
@@ -1 +0,0 @@
1
- Welcome User #<%= current_user.id %>!
@@ -1 +0,0 @@
1
- <%= @resource.email %>
@@ -1 +0,0 @@
1
- Special user view
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,44 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require "action_controller/railtie"
4
- require "action_mailer/railtie"
5
- require "rails/test_unit/railtie"
6
-
7
- Bundler.require :default, DEVISE_ORM
8
-
9
- begin
10
- require "#{DEVISE_ORM}/railtie"
11
- rescue LoadError
12
- end
13
-
14
- require "devise"
15
-
16
- module RailsApp
17
- class Application < Rails::Application
18
- # Add additional load paths for your own custom dirs
19
- config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers mailers views).include?($1) }
20
- config.autoload_paths += ["#{config.root}/app/#{DEVISE_ORM}"]
21
-
22
- # Configure generators values. Many other options are available, be sure to check the documentation.
23
- # config.generators do |g|
24
- # g.orm :active_record
25
- # g.template_engine :erb
26
- # g.test_framework :test_unit, fixture: true
27
- # end
28
-
29
- # Configure sensitive parameters which will be filtered from the log file.
30
- config.filter_parameters << :password
31
- # config.assets.enabled = false
32
-
33
- config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
34
-
35
- if DEVISE_ORM == :active_record && (Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 2)
36
- config.active_record.raise_in_transactional_callbacks = true
37
- end
38
-
39
- # This was used to break devise in some situations
40
- config.to_prepare do
41
- Devise::SessionsController.layout "application"
42
- end
43
- end
44
- end
@@ -1,20 +0,0 @@
1
- unless defined?(DEVISE_ORM)
2
- DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym
3
- end
4
-
5
- module Devise
6
- module Test
7
- # Detection for minor differences between Rails 4 and 5, and 5.1 in tests.
8
- def self.rails51?
9
- Rails.version.start_with? '5.1'
10
- end
11
-
12
- def self.rails5?
13
- Rails.version.start_with? '5'
14
- end
15
- end
16
- end
17
-
18
- # Set up gems listed in the Gemfile.
19
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
20
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
@@ -1,18 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
- development:
4
- adapter: sqlite3
5
- database: db/development.sqlite3
6
- pool: 5
7
- timeout: 5000
8
-
9
- # Warning: The database defined as "test" will be erased and
10
- # re-generated from your development database when you run "rake".
11
- # Do not set this db to the same as development or production.
12
- test:
13
- adapter: sqlite3
14
- database: ":memory:"
15
-
16
- production:
17
- adapter: sqlite3
18
- database: ":memory:"
@@ -1,5 +0,0 @@
1
- # Load the rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application.
5
- RailsApp::Application.initialize!
@@ -1,30 +0,0 @@
1
- RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Do not eager load code on boot.
10
- config.eager_load = false
11
-
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send.
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger.
20
- config.active_support.deprecation = :log
21
-
22
- # Only use best-standards-support built into browsers.
23
- config.action_dispatch.best_standards_support = :builtin
24
-
25
- # Raise an error on page load if there are pending migrations
26
- config.active_record.migration_error = :page_load
27
-
28
- # Debug mode disables concatenation and preprocessing of assets.
29
- config.assets.debug = true
30
- end
@@ -1,86 +0,0 @@
1
- RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # Code is not reloaded between requests.
5
- config.cache_classes = true
6
-
7
- # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both thread web servers
9
- # and those relying on copy on write to perform better.
10
- # Rake tasks automatically ignore this option for performance.
11
- config.eager_load = true
12
-
13
- # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
15
- config.action_controller.perform_caching = true
16
-
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
- # config.action_dispatch.rack_cache = true
21
-
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- if Rails.version >= "5.0.0"
24
- config.public_file_server.enabled = false
25
- elsif Rails.version >= "4.2.0"
26
- config.serve_static_files = false
27
- else
28
- config.serve_static_assets = false
29
- end
30
-
31
- # Compress JavaScripts and CSS.
32
- config.assets.js_compressor = :uglifier
33
- # config.assets.css_compressor = :sass
34
-
35
- # Whether to fallback to assets pipeline if a precompiled asset is missed.
36
- config.assets.compile = false
37
-
38
- # Generate digests for assets URLs.
39
- config.assets.digest = true
40
-
41
- # Version of your assets, change this if you want to expire all your assets.
42
- config.assets.version = '1.0'
43
-
44
- # Specifies the header that your server uses for sending files.
45
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
46
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
47
-
48
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
49
- # config.force_ssl = true
50
-
51
- # Set to :debug to see everything in the log.
52
- config.log_level = :info
53
-
54
- # Prepend all log lines with the following tags.
55
- # config.log_tags = [:subdomain, :uuid]
56
-
57
- # Use a different logger for distributed setups.
58
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
59
-
60
- # Use a different cache store in production.
61
- # config.cache_store = :mem_cache_store
62
-
63
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
64
- # config.action_controller.asset_host = "http://assets.example.com"
65
-
66
- # Precompile additional assets.
67
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
68
- # config.assets.precompile += %w( search.js )
69
-
70
- # Ignore bad email addresses and do not raise email delivery errors.
71
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
72
- # config.action_mailer.raise_delivery_errors = false
73
-
74
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
75
- # the I18n.default_locale when a translation can not be found).
76
- config.i18n.fallbacks = true
77
-
78
- # Send deprecation notices to registered listeners.
79
- config.active_support.deprecation = :notify
80
-
81
- # Disable automatic flushing of the log to improve performance.
82
- # config.autoflush_log = false
83
-
84
- # Use default logging formatter so that PID and timestamp are not suppressed.
85
- config.log_formatter = ::Logger::Formatter.new
86
- end
@@ -1,45 +0,0 @@
1
- RailsApp::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
14
-
15
- # Disable serving static files from the `/public` folder by default since
16
- # Apache or NGINX already handles this.
17
- if Rails.version >= "5.0.0"
18
- config.public_file_server.enabled = true
19
- config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
20
- elsif Rails.version >= "4.2.0"
21
- config.serve_static_files = true
22
- config.static_cache_control = "public, max-age=3600"
23
- else
24
- config.serve_static_assets = true
25
- config.static_cache_control = "public, max-age=3600"
26
- end
27
-
28
- # Show full error reports and disable caching.
29
- config.consider_all_requests_local = true
30
- config.action_controller.perform_caching = false
31
-
32
- # Raise exceptions instead of rendering exception templates.
33
- config.action_dispatch.show_exceptions = false
34
-
35
- # Disable request forgery protection in test environment.
36
- config.action_controller.allow_forgery_protection = false
37
-
38
- # Tell Action Mailer not to deliver emails to the real world.
39
- # The :test delivery method accumulates sent emails in the
40
- # ActionMailer::Base.deliveries array.
41
- config.action_mailer.delivery_method = :test
42
-
43
- # Print deprecation notices to the stderr.
44
- config.active_support.deprecation = :stderr
45
- end
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- Rails.backtrace_cleaner.remove_silencers!