devise 3.5.10 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +279 -1126
  3. data/MIT-LICENSE +2 -1
  4. data/README.md +291 -97
  5. data/app/controllers/devise/confirmations_controller.rb +3 -1
  6. data/app/controllers/devise/omniauth_callbacks_controller.rb +8 -6
  7. data/app/controllers/devise/passwords_controller.rb +7 -4
  8. data/app/controllers/devise/registrations_controller.rb +39 -18
  9. data/app/controllers/devise/sessions_controller.rb +9 -7
  10. data/app/controllers/devise/unlocks_controller.rb +4 -2
  11. data/app/controllers/devise_controller.rb +25 -12
  12. data/app/helpers/devise_helper.rb +23 -18
  13. data/app/mailers/devise/mailer.rb +10 -4
  14. data/app/views/devise/confirmations/new.html.erb +2 -2
  15. data/app/views/devise/mailer/email_changed.html.erb +7 -0
  16. data/app/views/devise/passwords/edit.html.erb +3 -3
  17. data/app/views/devise/passwords/new.html.erb +2 -2
  18. data/app/views/devise/registrations/edit.html.erb +9 -5
  19. data/app/views/devise/registrations/new.html.erb +4 -4
  20. data/app/views/devise/sessions/new.html.erb +4 -4
  21. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  22. data/app/views/devise/shared/_links.html.erb +8 -8
  23. data/app/views/devise/unlocks/new.html.erb +2 -2
  24. data/config/locales/en.yml +5 -2
  25. data/lib/devise.rb +57 -40
  26. data/lib/devise/controllers/helpers.rb +30 -27
  27. data/lib/devise/controllers/rememberable.rb +3 -1
  28. data/lib/devise/controllers/scoped_views.rb +2 -0
  29. data/lib/devise/controllers/sign_in_out.rb +39 -14
  30. data/lib/devise/controllers/store_location.rb +25 -7
  31. data/lib/devise/controllers/url_helpers.rb +3 -1
  32. data/lib/devise/delegator.rb +2 -0
  33. data/lib/devise/encryptor.rb +6 -4
  34. data/lib/devise/failure_app.rb +75 -38
  35. data/lib/devise/hooks/activatable.rb +2 -0
  36. data/lib/devise/hooks/csrf_cleaner.rb +2 -0
  37. data/lib/devise/hooks/forgetable.rb +2 -0
  38. data/lib/devise/hooks/lockable.rb +4 -2
  39. data/lib/devise/hooks/proxy.rb +3 -1
  40. data/lib/devise/hooks/rememberable.rb +2 -0
  41. data/lib/devise/hooks/timeoutable.rb +4 -2
  42. data/lib/devise/hooks/trackable.rb +2 -0
  43. data/lib/devise/mailers/helpers.rb +7 -4
  44. data/lib/devise/mapping.rb +3 -1
  45. data/lib/devise/models.rb +3 -1
  46. data/lib/devise/models/authenticatable.rb +63 -33
  47. data/lib/devise/models/confirmable.rb +90 -29
  48. data/lib/devise/models/database_authenticatable.rb +93 -22
  49. data/lib/devise/models/lockable.rb +19 -5
  50. data/lib/devise/models/omniauthable.rb +2 -0
  51. data/lib/devise/models/recoverable.rb +33 -21
  52. data/lib/devise/models/registerable.rb +4 -0
  53. data/lib/devise/models/rememberable.rb +6 -11
  54. data/lib/devise/models/timeoutable.rb +2 -0
  55. data/lib/devise/models/trackable.rb +15 -1
  56. data/lib/devise/models/validatable.rb +10 -3
  57. data/lib/devise/modules.rb +2 -0
  58. data/lib/devise/omniauth.rb +4 -5
  59. data/lib/devise/omniauth/config.rb +2 -0
  60. data/lib/devise/omniauth/url_helpers.rb +14 -5
  61. data/lib/devise/orm/active_record.rb +5 -1
  62. data/lib/devise/orm/mongoid.rb +6 -2
  63. data/lib/devise/parameter_filter.rb +4 -0
  64. data/lib/devise/parameter_sanitizer.rb +139 -65
  65. data/lib/devise/rails.rb +7 -16
  66. data/lib/devise/rails/deprecated_constant_accessor.rb +39 -0
  67. data/lib/devise/rails/routes.rb +48 -37
  68. data/lib/devise/rails/warden_compat.rb +3 -10
  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 +11 -4
  73. data/lib/devise/strategies/rememberable.rb +2 -0
  74. data/lib/devise/test/controller_helpers.rb +167 -0
  75. data/lib/devise/test/integration_helpers.rb +63 -0
  76. data/lib/devise/test_helpers.rb +7 -124
  77. data/lib/devise/time_inflector.rb +2 -0
  78. data/lib/devise/token_generator.rb +3 -41
  79. data/lib/devise/version.rb +3 -1
  80. data/lib/generators/active_record/devise_generator.rb +46 -12
  81. data/lib/generators/active_record/templates/migration.rb +4 -2
  82. data/lib/generators/active_record/templates/migration_existing.rb +4 -2
  83. data/lib/generators/devise/controllers_generator.rb +3 -1
  84. data/lib/generators/devise/devise_generator.rb +5 -3
  85. data/lib/generators/devise/install_generator.rb +18 -5
  86. data/lib/generators/devise/orm_helpers.rb +10 -21
  87. data/lib/generators/devise/views_generator.rb +8 -9
  88. data/lib/generators/mongoid/devise_generator.rb +7 -5
  89. data/lib/generators/templates/README +9 -8
  90. data/lib/generators/templates/controllers/confirmations_controller.rb +2 -0
  91. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +3 -1
  92. data/lib/generators/templates/controllers/passwords_controller.rb +2 -0
  93. data/lib/generators/templates/controllers/registrations_controller.rb +6 -4
  94. data/lib/generators/templates/controllers/sessions_controller.rb +4 -2
  95. data/lib/generators/templates/controllers/unlocks_controller.rb +2 -0
  96. data/lib/generators/templates/devise.rb +63 -21
  97. data/lib/generators/templates/markerb/email_changed.markerb +7 -0
  98. data/lib/generators/templates/markerb/password_change.markerb +2 -2
  99. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +5 -1
  100. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +10 -2
  101. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +4 -1
  102. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +11 -3
  103. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +11 -3
  104. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +7 -2
  105. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +4 -1
  106. metadata +19 -317
  107. data/.gitignore +0 -10
  108. data/.travis.yml +0 -44
  109. data/.yardopts +0 -9
  110. data/CODE_OF_CONDUCT.md +0 -22
  111. data/CONTRIBUTING.md +0 -16
  112. data/Gemfile +0 -30
  113. data/Gemfile.lock +0 -187
  114. data/Rakefile +0 -36
  115. data/devise.gemspec +0 -27
  116. data/devise.png +0 -0
  117. data/gemfiles/Gemfile.rails-3.2-stable +0 -29
  118. data/gemfiles/Gemfile.rails-3.2-stable.lock +0 -172
  119. data/gemfiles/Gemfile.rails-4.0-stable +0 -30
  120. data/gemfiles/Gemfile.rails-4.0-stable.lock +0 -166
  121. data/gemfiles/Gemfile.rails-4.1-stable +0 -30
  122. data/gemfiles/Gemfile.rails-4.1-stable.lock +0 -171
  123. data/gemfiles/Gemfile.rails-4.2-stable +0 -30
  124. data/gemfiles/Gemfile.rails-4.2-stable.lock +0 -193
  125. data/script/cached-bundle +0 -49
  126. data/script/s3-put +0 -71
  127. data/test/controllers/custom_registrations_controller_test.rb +0 -40
  128. data/test/controllers/custom_strategy_test.rb +0 -62
  129. data/test/controllers/helper_methods_test.rb +0 -21
  130. data/test/controllers/helpers_test.rb +0 -316
  131. data/test/controllers/inherited_controller_i18n_messages_test.rb +0 -51
  132. data/test/controllers/internal_helpers_test.rb +0 -129
  133. data/test/controllers/load_hooks_controller_test.rb +0 -19
  134. data/test/controllers/passwords_controller_test.rb +0 -31
  135. data/test/controllers/sessions_controller_test.rb +0 -103
  136. data/test/controllers/url_helpers_test.rb +0 -65
  137. data/test/delegator_test.rb +0 -19
  138. data/test/devise_test.rb +0 -107
  139. data/test/failure_app_test.rb +0 -315
  140. data/test/generators/active_record_generator_test.rb +0 -109
  141. data/test/generators/controllers_generator_test.rb +0 -48
  142. data/test/generators/devise_generator_test.rb +0 -39
  143. data/test/generators/install_generator_test.rb +0 -13
  144. data/test/generators/mongoid_generator_test.rb +0 -23
  145. data/test/generators/views_generator_test.rb +0 -103
  146. data/test/helpers/devise_helper_test.rb +0 -49
  147. data/test/integration/authenticatable_test.rb +0 -729
  148. data/test/integration/confirmable_test.rb +0 -324
  149. data/test/integration/database_authenticatable_test.rb +0 -95
  150. data/test/integration/http_authenticatable_test.rb +0 -105
  151. data/test/integration/lockable_test.rb +0 -239
  152. data/test/integration/omniauthable_test.rb +0 -135
  153. data/test/integration/recoverable_test.rb +0 -347
  154. data/test/integration/registerable_test.rb +0 -359
  155. data/test/integration/rememberable_test.rb +0 -214
  156. data/test/integration/timeoutable_test.rb +0 -184
  157. data/test/integration/trackable_test.rb +0 -92
  158. data/test/mailers/confirmation_instructions_test.rb +0 -115
  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 -511
  164. data/test/models/database_authenticatable_test.rb +0 -269
  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 -251
  168. data/test/models/registerable_test.rb +0 -7
  169. data/test/models/rememberable_test.rb +0 -169
  170. data/test/models/serializable_test.rb +0 -49
  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 -127
  174. data/test/models_test.rb +0 -153
  175. data/test/omniauth/config_test.rb +0 -57
  176. data/test/omniauth/url_helpers_test.rb +0 -54
  177. data/test/orm/active_record.rb +0 -10
  178. data/test/orm/mongoid.rb +0 -13
  179. data/test/parameter_sanitizer_test.rb +0 -81
  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 -6
  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 -12
  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 -25
  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.ru +0 -4
  223. data/test/rails_app/config/application.rb +0 -40
  224. data/test/rails_app/config/boot.rb +0 -14
  225. data/test/rails_app/config/database.yml +0 -18
  226. data/test/rails_app/config/environment.rb +0 -5
  227. data/test/rails_app/config/environments/development.rb +0 -30
  228. data/test/rails_app/config/environments/production.rb +0 -84
  229. data/test/rails_app/config/environments/test.rb +0 -41
  230. data/test/rails_app/config/initializers/backtrace_silencers.rb +0 -7
  231. data/test/rails_app/config/initializers/devise.rb +0 -180
  232. data/test/rails_app/config/initializers/inflections.rb +0 -2
  233. data/test/rails_app/config/initializers/secret_token.rb +0 -8
  234. data/test/rails_app/config/initializers/session_store.rb +0 -1
  235. data/test/rails_app/config/routes.rb +0 -125
  236. data/test/rails_app/db/migrate/20100401102949_create_tables.rb +0 -71
  237. data/test/rails_app/db/schema.rb +0 -55
  238. data/test/rails_app/lib/shared_admin.rb +0 -17
  239. data/test/rails_app/lib/shared_user.rb +0 -29
  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 -264
  248. data/test/support/action_controller/record_identifier.rb +0 -10
  249. data/test/support/assertions.rb +0 -39
  250. data/test/support/helpers.rb +0 -77
  251. data/test/support/integration.rb +0 -92
  252. data/test/support/locale/en.yml +0 -8
  253. data/test/support/mongoid.yml +0 -6
  254. data/test/support/webrat/integrations/rails.rb +0 -24
  255. data/test/test_helper.rb +0 -34
  256. data/test/test_helpers_test.rb +0 -178
  257. data/test/test_models.rb +0 -33
  258. data/test/time_helpers.rb +0 -137
@@ -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!
@@ -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
- # Setup 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,8 +0,0 @@
1
- config = Rails.application.config
2
-
3
- if Devise.rails4?
4
- config.secret_key_base = 'd588e99efff13a86461fd6ab82327823ad2f8feb5dc217ce652cdd9f0dfc5eb4b5a62a92d24d2574d7d51dfb1ea8dd453ea54e00cf672159a13104a135422a10'
5
- else
6
- config.secret_token = 'ea942c41850d502f2c8283e26bdc57829f471bb18224ddff0a192c4f32cdf6cb5aa0d82b3a7a7adbeb640c4b06f3aa1cd5f098162d8240f669b39d6b49680571'
7
- config.session_store :cookie_store, key: "_my_app"
8
- end
@@ -1 +0,0 @@
1
- RailsApp::Application.config.session_store :cookie_store, key: '_rails_app_session'
@@ -1,125 +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 :delete_or_posts, sign_out_via: [:delete, :post], class_name: "Admin"
118
- end
119
-
120
- get "/set", to: "home#set"
121
- get "/unauthenticated", to: "home#unauthenticated"
122
- get "/custom_strategy/new"
123
-
124
- root to: "home#index", via: [:get, :post]
125
- end
@@ -1,71 +0,0 @@
1
- class CreateTables < ActiveRecord::Migration
2
- def self.up
3
- create_table :users do |t|
4
- t.string :username
5
- t.string :facebook_token
6
-
7
- ## Database authenticatable
8
- t.string :email, null: false, default: ""
9
- t.string :encrypted_password, null: false, default: ""
10
-
11
- ## Recoverable
12
- t.string :reset_password_token
13
- t.datetime :reset_password_sent_at
14
-
15
- ## Rememberable
16
- t.datetime :remember_created_at
17
-
18
- ## Trackable
19
- t.integer :sign_in_count, default: 0
20
- t.datetime :current_sign_in_at
21
- t.datetime :last_sign_in_at
22
- t.string :current_sign_in_ip
23
- t.string :last_sign_in_ip
24
-
25
- ## Confirmable
26
- t.string :confirmation_token
27
- t.datetime :confirmed_at
28
- t.datetime :confirmation_sent_at
29
- # t.string :unconfirmed_email # Only if using reconfirmable
30
-
31
- ## Lockable
32
- t.integer :failed_attempts, default: 0 # Only if lock strategy is :failed_attempts
33
- t.string :unlock_token # Only if unlock strategy is :email or :both
34
- t.datetime :locked_at
35
-
36
- t.timestamps null: false
37
- end
38
-
39
- create_table :admins do |t|
40
- ## Database authenticatable
41
- t.string :email, null: true
42
- t.string :encrypted_password, null: true
43
-
44
- ## Recoverable
45
- t.string :reset_password_token
46
- t.datetime :reset_password_sent_at
47
-
48
- ## Rememberable
49
- t.datetime :remember_created_at
50
-
51
- ## Confirmable
52
- t.string :confirmation_token
53
- t.datetime :confirmed_at
54
- t.datetime :confirmation_sent_at
55
- t.string :unconfirmed_email # Only if using reconfirmable
56
-
57
- ## Lockable
58
- t.datetime :locked_at
59
-
60
- ## Attribute for testing route blocks
61
- t.boolean :active, default: false
62
-
63
- t.timestamps null: false
64
- end
65
- end
66
-
67
- def self.down
68
- drop_table :users
69
- drop_table :admins
70
- end
71
- 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