devise 3.5.1 → 4.7.1

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 (256) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +259 -1076
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +256 -68
  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 +10 -7
  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 +23 -10
  12. data/app/helpers/devise_helper.rb +12 -19
  13. data/app/mailers/devise/mailer.rb +10 -0
  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/mailer/password_change.html.erb +3 -0
  17. data/app/views/devise/passwords/edit.html.erb +5 -5
  18. data/app/views/devise/passwords/new.html.erb +2 -2
  19. data/app/views/devise/registrations/edit.html.erb +9 -5
  20. data/app/views/devise/registrations/new.html.erb +4 -4
  21. data/app/views/devise/sessions/new.html.erb +4 -4
  22. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  23. data/app/views/devise/shared/_links.html.erb +8 -8
  24. data/app/views/devise/unlocks/new.html.erb +2 -2
  25. data/config/locales/en.yml +6 -1
  26. data/lib/devise/controllers/helpers.rb +35 -26
  27. data/lib/devise/controllers/rememberable.rb +11 -2
  28. data/lib/devise/controllers/scoped_views.rb +2 -0
  29. data/lib/devise/controllers/sign_in_out.rb +35 -18
  30. data/lib/devise/controllers/store_location.rb +25 -7
  31. data/lib/devise/controllers/url_helpers.rb +2 -0
  32. data/lib/devise/delegator.rb +2 -0
  33. data/lib/devise/encryptor.rb +6 -4
  34. data/lib/devise/failure_app.rb +84 -27
  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 +6 -1
  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 +7 -7
  42. data/lib/devise/hooks/trackable.rb +2 -0
  43. data/lib/devise/mailers/helpers.rb +7 -4
  44. data/lib/devise/mapping.rb +2 -0
  45. data/lib/devise/models/authenticatable.rb +51 -26
  46. data/lib/devise/models/confirmable.rb +106 -33
  47. data/lib/devise/models/database_authenticatable.rb +97 -21
  48. data/lib/devise/models/lockable.rb +15 -5
  49. data/lib/devise/models/omniauthable.rb +2 -0
  50. data/lib/devise/models/recoverable.rb +32 -24
  51. data/lib/devise/models/registerable.rb +4 -0
  52. data/lib/devise/models/rememberable.rb +42 -26
  53. data/lib/devise/models/timeoutable.rb +2 -6
  54. data/lib/devise/models/trackable.rb +15 -1
  55. data/lib/devise/models/validatable.rb +10 -3
  56. data/lib/devise/models.rb +3 -1
  57. data/lib/devise/modules.rb +2 -0
  58. data/lib/devise/omniauth/config.rb +2 -0
  59. data/lib/devise/omniauth/url_helpers.rb +14 -5
  60. data/lib/devise/omniauth.rb +2 -0
  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/routes.rb +67 -47
  66. data/lib/devise/rails/warden_compat.rb +3 -10
  67. data/lib/devise/rails.rb +7 -16
  68. data/lib/devise/secret_key_finder.rb +27 -0
  69. data/lib/devise/strategies/authenticatable.rb +5 -3
  70. data/lib/devise/strategies/base.rb +2 -0
  71. data/lib/devise/strategies/database_authenticatable.rb +11 -4
  72. data/lib/devise/strategies/rememberable.rb +5 -6
  73. data/lib/devise/test/controller_helpers.rb +165 -0
  74. data/lib/devise/test/integration_helpers.rb +63 -0
  75. data/lib/devise/test_helpers.rb +7 -124
  76. data/lib/devise/time_inflector.rb +2 -0
  77. data/lib/devise/token_generator.rb +3 -41
  78. data/lib/devise/version.rb +3 -1
  79. data/lib/devise.rb +73 -46
  80. data/lib/generators/active_record/devise_generator.rb +29 -10
  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 +4 -2
  85. data/lib/generators/devise/install_generator.rb +17 -0
  86. data/lib/generators/devise/orm_helpers.rb +10 -21
  87. data/lib/generators/devise/views_generator.rb +21 -11
  88. data/lib/generators/mongoid/devise_generator.rb +7 -5
  89. data/lib/generators/templates/README +1 -8
  90. data/lib/generators/templates/controllers/README +1 -1
  91. data/lib/generators/templates/controllers/confirmations_controller.rb +2 -0
  92. data/lib/generators/templates/controllers/omniauth_callbacks_controller.rb +2 -0
  93. data/lib/generators/templates/controllers/passwords_controller.rb +2 -0
  94. data/lib/generators/templates/controllers/registrations_controller.rb +6 -4
  95. data/lib/generators/templates/controllers/sessions_controller.rb +4 -2
  96. data/lib/generators/templates/controllers/unlocks_controller.rb +2 -0
  97. data/lib/generators/templates/devise.rb +52 -22
  98. data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
  99. data/lib/generators/templates/markerb/email_changed.markerb +7 -0
  100. data/lib/generators/templates/markerb/password_change.markerb +3 -0
  101. data/lib/generators/templates/markerb/reset_password_instructions.markerb +1 -1
  102. data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
  103. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +5 -1
  104. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +10 -2
  105. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +4 -1
  106. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +11 -3
  107. data/lib/generators/templates/simple_form_for/registrations/new.html.erb +11 -3
  108. data/lib/generators/templates/simple_form_for/sessions/new.html.erb +7 -2
  109. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +4 -1
  110. metadata +15 -301
  111. data/.gitignore +0 -10
  112. data/.travis.yml +0 -45
  113. data/.yardopts +0 -9
  114. data/CONTRIBUTING.md +0 -14
  115. data/Gemfile +0 -29
  116. data/Gemfile.lock +0 -191
  117. data/Rakefile +0 -36
  118. data/devise.gemspec +0 -29
  119. data/devise.png +0 -0
  120. data/gemfiles/Gemfile.rails-3.2-stable +0 -29
  121. data/gemfiles/Gemfile.rails-3.2-stable.lock +0 -169
  122. data/gemfiles/Gemfile.rails-4.0-stable +0 -29
  123. data/gemfiles/Gemfile.rails-4.0-stable.lock +0 -163
  124. data/gemfiles/Gemfile.rails-4.1-stable +0 -29
  125. data/gemfiles/Gemfile.rails-4.1-stable.lock +0 -169
  126. data/gemfiles/Gemfile.rails-4.2-stable +0 -29
  127. data/gemfiles/Gemfile.rails-4.2-stable.lock +0 -191
  128. data/script/cached-bundle +0 -49
  129. data/script/s3-put +0 -71
  130. data/test/controllers/custom_registrations_controller_test.rb +0 -40
  131. data/test/controllers/custom_strategy_test.rb +0 -62
  132. data/test/controllers/helpers_test.rb +0 -316
  133. data/test/controllers/inherited_controller_i18n_messages_test.rb +0 -51
  134. data/test/controllers/internal_helpers_test.rb +0 -129
  135. data/test/controllers/load_hooks_controller_test.rb +0 -19
  136. data/test/controllers/passwords_controller_test.rb +0 -31
  137. data/test/controllers/sessions_controller_test.rb +0 -103
  138. data/test/controllers/url_helpers_test.rb +0 -65
  139. data/test/delegator_test.rb +0 -19
  140. data/test/devise_test.rb +0 -107
  141. data/test/failure_app_test.rb +0 -298
  142. data/test/generators/active_record_generator_test.rb +0 -109
  143. data/test/generators/controllers_generator_test.rb +0 -48
  144. data/test/generators/devise_generator_test.rb +0 -39
  145. data/test/generators/install_generator_test.rb +0 -13
  146. data/test/generators/mongoid_generator_test.rb +0 -23
  147. data/test/generators/views_generator_test.rb +0 -96
  148. data/test/helpers/devise_helper_test.rb +0 -49
  149. data/test/integration/authenticatable_test.rb +0 -729
  150. data/test/integration/confirmable_test.rb +0 -324
  151. data/test/integration/database_authenticatable_test.rb +0 -95
  152. data/test/integration/http_authenticatable_test.rb +0 -105
  153. data/test/integration/lockable_test.rb +0 -239
  154. data/test/integration/omniauthable_test.rb +0 -133
  155. data/test/integration/recoverable_test.rb +0 -347
  156. data/test/integration/registerable_test.rb +0 -359
  157. data/test/integration/rememberable_test.rb +0 -176
  158. data/test/integration/timeoutable_test.rb +0 -189
  159. data/test/integration/trackable_test.rb +0 -92
  160. data/test/mailers/confirmation_instructions_test.rb +0 -115
  161. data/test/mailers/reset_password_instructions_test.rb +0 -96
  162. data/test/mailers/unlock_instructions_test.rb +0 -91
  163. data/test/mapping_test.rb +0 -134
  164. data/test/models/authenticatable_test.rb +0 -23
  165. data/test/models/confirmable_test.rb +0 -468
  166. data/test/models/database_authenticatable_test.rb +0 -249
  167. data/test/models/lockable_test.rb +0 -328
  168. data/test/models/omniauthable_test.rb +0 -7
  169. data/test/models/recoverable_test.rb +0 -228
  170. data/test/models/registerable_test.rb +0 -7
  171. data/test/models/rememberable_test.rb +0 -204
  172. data/test/models/serializable_test.rb +0 -49
  173. data/test/models/timeoutable_test.rb +0 -51
  174. data/test/models/trackable_test.rb +0 -41
  175. data/test/models/validatable_test.rb +0 -127
  176. data/test/models_test.rb +0 -144
  177. data/test/omniauth/config_test.rb +0 -57
  178. data/test/omniauth/url_helpers_test.rb +0 -54
  179. data/test/orm/active_record.rb +0 -10
  180. data/test/orm/mongoid.rb +0 -13
  181. data/test/parameter_sanitizer_test.rb +0 -81
  182. data/test/rails_app/Rakefile +0 -6
  183. data/test/rails_app/app/active_record/admin.rb +0 -6
  184. data/test/rails_app/app/active_record/shim.rb +0 -2
  185. data/test/rails_app/app/active_record/user.rb +0 -6
  186. data/test/rails_app/app/active_record/user_on_engine.rb +0 -7
  187. data/test/rails_app/app/active_record/user_on_main_app.rb +0 -7
  188. data/test/rails_app/app/controllers/admins/sessions_controller.rb +0 -6
  189. data/test/rails_app/app/controllers/admins_controller.rb +0 -11
  190. data/test/rails_app/app/controllers/application_controller.rb +0 -12
  191. data/test/rails_app/app/controllers/application_with_fake_engine.rb +0 -30
  192. data/test/rails_app/app/controllers/custom/registrations_controller.rb +0 -31
  193. data/test/rails_app/app/controllers/home_controller.rb +0 -25
  194. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +0 -2
  195. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +0 -2
  196. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +0 -14
  197. data/test/rails_app/app/controllers/users_controller.rb +0 -31
  198. data/test/rails_app/app/helpers/application_helper.rb +0 -3
  199. data/test/rails_app/app/mailers/users/from_proc_mailer.rb +0 -3
  200. data/test/rails_app/app/mailers/users/mailer.rb +0 -3
  201. data/test/rails_app/app/mailers/users/reply_to_mailer.rb +0 -4
  202. data/test/rails_app/app/mongoid/admin.rb +0 -29
  203. data/test/rails_app/app/mongoid/shim.rb +0 -23
  204. data/test/rails_app/app/mongoid/user.rb +0 -39
  205. data/test/rails_app/app/mongoid/user_on_engine.rb +0 -39
  206. data/test/rails_app/app/mongoid/user_on_main_app.rb +0 -39
  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 -40
  223. data/test/rails_app/config/boot.rb +0 -14
  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 -84
  228. data/test/rails_app/config/environments/test.rb +0 -41
  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 -8
  233. data/test/rails_app/config/initializers/session_store.rb +0 -1
  234. data/test/rails_app/config/routes.rb +0 -122
  235. data/test/rails_app/config.ru +0 -4
  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_omniauth.rb +0 -13
  241. data/test/rails_app/public/404.html +0 -26
  242. data/test/rails_app/public/422.html +0 -26
  243. data/test/rails_app/public/500.html +0 -26
  244. data/test/rails_app/public/favicon.ico +0 -0
  245. data/test/rails_test.rb +0 -9
  246. data/test/routes_test.rb +0 -264
  247. data/test/support/action_controller/record_identifier.rb +0 -10
  248. data/test/support/assertions.rb +0 -39
  249. data/test/support/helpers.rb +0 -73
  250. data/test/support/integration.rb +0 -92
  251. data/test/support/locale/en.yml +0 -8
  252. data/test/support/mongoid.yml +0 -6
  253. data/test/support/webrat/integrations/rails.rb +0 -24
  254. data/test/test_helper.rb +0 -34
  255. data/test/test_helpers_test.rb +0 -178
  256. 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
- # 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,122 +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] do
17
- get :expire, on: :member
18
- end
19
-
20
- # Users scope
21
- devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
22
-
23
- devise_for :user_on_main_apps,
24
- class_name: 'UserOnMainApp',
25
- router_name: :main_app,
26
- module: :devise
27
-
28
- devise_for :user_on_engines,
29
- class_name: 'UserOnEngine',
30
- router_name: :fake_engine,
31
- module: :devise
32
-
33
- as :user do
34
- get "/as/sign_in", to: "devise/sessions#new"
35
- end
36
-
37
- get "/sign_in", to: "devise/sessions#new"
38
-
39
- # Routes for custom controller testing
40
- devise_for :user, only: [:registrations], controllers: { registrations: "custom/registrations" }, as: :custom, path: :custom
41
-
42
- # Admin scope
43
- devise_for :admin, path: "admin_area", controllers: { sessions: :"admins/sessions" }, skip: :passwords
44
-
45
- get "/admin_area/home", to: "admins#index", as: :admin_root
46
- get "/anywhere", to: "foo#bar", as: :new_admin_password
47
-
48
- authenticate(:admin) do
49
- get "/private", to: "home#private", as: :private
50
- end
51
-
52
- authenticate(:admin, lambda { |admin| admin.active? }) do
53
- get "/private/active", to: "home#private", as: :private_active
54
- end
55
-
56
- authenticated :admin do
57
- get "/dashboard", to: "home#admin_dashboard"
58
- end
59
-
60
- authenticated :admin, lambda { |admin| admin.active? } do
61
- get "/dashboard/active", to: "home#admin_dashboard"
62
- end
63
-
64
- authenticated do
65
- get "/dashboard", to: "home#user_dashboard"
66
- end
67
-
68
- unauthenticated do
69
- get "/join", to: "home#join"
70
- end
71
-
72
- # Routes for constraints testing
73
- devise_for :headquarters_admin, class_name: "Admin", path: "headquarters", constraints: {host: /192\.168\.1\.\d\d\d/}
74
-
75
- constraints(host: /192\.168\.1\.\d\d\d/) do
76
- devise_for :homebase_admin, class_name: "Admin", path: "homebase"
77
- end
78
-
79
- scope(subdomain: 'sub') do
80
- devise_for :subdomain_users, class_name: "User", only: [:sessions]
81
- end
82
-
83
- devise_for :skip_admin, class_name: "Admin", skip: :all
84
-
85
- # Routes for format=false testing
86
- devise_for :htmlonly_admin, class_name: "Admin", skip: [:confirmations, :unlocks], path: "htmlonly_admin", format: false, skip_helpers: [:confirmations, :unlocks]
87
- devise_for :htmlonly_users, class_name: "User", only: [:confirmations, :unlocks], path: "htmlonly_users", format: false, skip_helpers: true
88
-
89
- # Other routes for routing_test.rb
90
- devise_for :reader, class_name: "User", only: :passwords
91
-
92
- scope host: "sub.example.com" do
93
- devise_for :sub_admin, class_name: "Admin"
94
- end
95
-
96
- namespace :publisher, path_names: { sign_in: "i_dont_care", sign_out: "get_out" } do
97
- devise_for :accounts, class_name: "Admin", path_names: { sign_in: "get_in" }
98
- end
99
-
100
- scope ":locale", module: :invalid do
101
- devise_for :accounts, singular: "manager", class_name: "Admin",
102
- path_names: {
103
- sign_in: "login", sign_out: "logout",
104
- password: "secret", confirmation: "verification",
105
- unlock: "unblock", sign_up: "register",
106
- registration: "management",
107
- cancel: "giveup", edit: "edit/profile"
108
- }, failure_app: lambda { |env| [404, {"Content-Type" => "text/plain"}, ["Oops, not found"]] }, module: :devise
109
- end
110
-
111
- namespace :sign_out_via, module: "devise" do
112
- devise_for :deletes, sign_out_via: :delete, class_name: "Admin"
113
- devise_for :posts, sign_out_via: :post, class_name: "Admin"
114
- devise_for :delete_or_posts, sign_out_via: [:delete, :post], class_name: "Admin"
115
- end
116
-
117
- get "/set", to: "home#set"
118
- get "/unauthenticated", to: "home#unauthenticated"
119
- get "/custom_strategy/new"
120
-
121
- root to: "home#index", via: [:get, :post]
122
- 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,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
@@ -1,17 +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
- validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
12
- end
13
-
14
- def raw_confirmation_token
15
- @raw_confirmation_token
16
- end
17
- end
@@ -1,29 +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
-
9
- attr_accessor :other_key
10
-
11
- # They need to be included after Devise is called.
12
- extend ExtendMethods
13
- end
14
-
15
- def raw_confirmation_token
16
- @raw_confirmation_token
17
- end
18
-
19
- module ExtendMethods
20
- def new_with_session(params, session)
21
- super.tap do |user|
22
- if data = session["devise.facebook_data"]
23
- user.email = data["email"]
24
- user.confirmed_at = Time.now
25
- end
26
- end
27
- end
28
- end
29
- 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
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