devise 3.2.2 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of devise might be problematic. Click here for more details.

Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +9 -1
  4. data/CHANGELOG.md +20 -9
  5. data/CONTRIBUTING.md +2 -2
  6. data/Gemfile +2 -4
  7. data/Gemfile.lock +2 -2
  8. data/MIT-LICENSE +1 -1
  9. data/README.md +69 -30
  10. data/config/locales/en.yml +1 -1
  11. data/devise.gemspec +1 -1
  12. data/gemfiles/{Gemfile.rails-3.2.x → Gemfile.rails-3.2-stable} +3 -5
  13. data/gemfiles/Gemfile.rails-4.0-stable +29 -0
  14. data/gemfiles/Gemfile.rails-head +29 -0
  15. data/lib/devise.rb +3 -3
  16. data/lib/devise/controllers/helpers.rb +1 -1
  17. data/lib/devise/controllers/scoped_views.rb +1 -1
  18. data/lib/devise/controllers/sign_in_out.rb +1 -1
  19. data/lib/devise/hooks/activatable.rb +3 -3
  20. data/lib/devise/hooks/proxy.rb +1 -1
  21. data/lib/devise/hooks/rememberable.rb +1 -1
  22. data/lib/devise/models/authenticatable.rb +2 -2
  23. data/lib/devise/models/confirmable.rb +2 -2
  24. data/lib/devise/models/lockable.rb +7 -4
  25. data/lib/devise/models/rememberable.rb +1 -1
  26. data/lib/devise/models/timeoutable.rb +2 -2
  27. data/lib/devise/modules.rb +1 -1
  28. data/lib/devise/orm/active_record.rb +1 -1
  29. data/lib/devise/orm/mongoid.rb +1 -1
  30. data/lib/devise/rails.rb +7 -1
  31. data/lib/devise/rails/routes.rb +16 -4
  32. data/lib/devise/strategies/authenticatable.rb +4 -4
  33. data/lib/devise/strategies/base.rb +1 -1
  34. data/lib/devise/strategies/database_authenticatable.rb +1 -1
  35. data/lib/devise/time_inflector.rb +1 -1
  36. data/lib/devise/version.rb +1 -1
  37. data/lib/generators/active_record/devise_generator.rb +2 -2
  38. data/lib/generators/devise/install_generator.rb +4 -0
  39. data/lib/generators/templates/README +2 -2
  40. data/lib/generators/templates/devise.rb +8 -4
  41. data/test/controllers/internal_helpers_test.rb +5 -2
  42. data/test/controllers/sessions_controller_test.rb +14 -10
  43. data/test/generators/mongoid_generator_test.rb +2 -2
  44. data/test/integration/recoverable_test.rb +7 -7
  45. data/test/integration/registerable_test.rb +9 -9
  46. data/test/integration/rememberable_test.rb +2 -2
  47. data/test/integration/trackable_test.rb +1 -1
  48. data/test/mapping_test.rb +3 -3
  49. data/test/models/confirmable_test.rb +1 -1
  50. data/test/models/database_authenticatable_test.rb +1 -1
  51. data/test/models/lockable_test.rb +24 -6
  52. data/test/models/recoverable_test.rb +3 -3
  53. data/test/omniauth/config_test.rb +1 -1
  54. data/test/orm/mongoid.rb +1 -1
  55. data/test/rails_app/app/active_record/shim.rb +1 -1
  56. data/test/rails_app/app/controllers/admins/sessions_controller.rb +1 -1
  57. data/test/rails_app/app/controllers/publisher/registrations_controller.rb +1 -1
  58. data/test/rails_app/app/controllers/publisher/sessions_controller.rb +1 -1
  59. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +1 -1
  60. data/test/rails_app/app/views/admins/sessions/new.html.erb +1 -1
  61. data/test/rails_app/app/views/home/admin_dashboard.html.erb +1 -1
  62. data/test/rails_app/app/views/home/index.html.erb +1 -1
  63. data/test/rails_app/app/views/home/join.html.erb +1 -1
  64. data/test/rails_app/app/views/home/user_dashboard.html.erb +1 -1
  65. data/test/rails_app/config/initializers/devise.rb +2 -2
  66. data/test/rails_app/config/routes.rb +2 -1
  67. data/test/routes_test.rb +12 -0
  68. data/test/support/action_controller/record_identifier.rb +10 -0
  69. data/test/support/mongoid.yml +6 -0
  70. data/test/test_helpers_test.rb +2 -2
  71. metadata +30 -37
  72. data/gemfiles/Gemfile.rails-3.2.x.lock +0 -159
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: def6822e22bdfaf3e48e528c4ecf286adb289533
4
+ data.tar.gz: f9c08a292e3425f6d04c61d8f76b8c5de088b6f4
5
+ SHA512:
6
+ metadata.gz: 9a39095ace12227203990507ff84b466e85c75e90b5a7c6cae9a71c7ccf560b0d3e851e393c0acacca3d0a258ac7d8dd82fd98e53cf81ab10664c4bfabd9a548
7
+ data.tar.gz: bc9e9a7f106e439152b5dd72fcd95701fcc64a12c776c8a9d6fb3b295bb89ed70aacf943089a3f3f20570fe3158f475e0a894edb8ee5fdc01beb84a6303778a6
data/.gitignore CHANGED
@@ -8,3 +8,4 @@ rdoc/*
8
8
  pkg
9
9
  log
10
10
  test/tmp/*
11
+ gemfiles/*.lock
@@ -1,14 +1,22 @@
1
1
  language: ruby
2
2
  script: "bundle exec rake test"
3
+ before_install:
4
+ - gem install bundler -v '>= 1.5.1'
3
5
  rvm:
4
6
  - 1.9.3
5
7
  - 2.0.0
8
+ - 2.1.0
6
9
  env:
7
10
  - DEVISE_ORM=mongoid
8
11
  - DEVISE_ORM=active_record
9
12
  gemfile:
10
- - gemfiles/Gemfile.rails-3.2.x
13
+ - gemfiles/Gemfile.rails-head
14
+ - gemfiles/Gemfile.rails-4.0-stable
15
+ - gemfiles/Gemfile.rails-3.2-stable
11
16
  - Gemfile
17
+ matrix:
18
+ allow_failures:
19
+ - gemfile: gemfiles/Gemfile.rails-head
12
20
  services:
13
21
  - mongodb
14
22
  notifications:
@@ -1,3 +1,14 @@
1
+ ### Unreleased
2
+
3
+ ### 3.2.3
4
+
5
+ * enhancements
6
+ * Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`.
7
+ You can change this and use your own secret by changing the `devise.rb` initializer.
8
+
9
+ * bug fix
10
+ * Migrations will be properly generated when using rails 4.1.0.
11
+
1
12
  ### 3.2.2
2
13
 
3
14
  * bug fix
@@ -23,7 +34,7 @@ Security announcement: http://blog.plataformatec.com.br/2013/11/e-mail-enumerati
23
34
  * Previously deprecated token authenticatable and insecure lookups have been removed
24
35
  * Add a class method so you can encrypt passwords from fixtures (by @tenderlove)
25
36
  * Send custom message when user enters invalid password and it has only one attempt
26
- to enter correct password before his account will be locked (by @Lightpower)
37
+ to enter correct password before their account will be locked (by @Lightpower)
27
38
  * Prevent mutation of values assigned to case and whitespace santitized members (by @iamvery)
28
39
  * Separate redirects and flash messages in `navigational_formats` and `flashing_formats` (by @ssendev)
29
40
 
@@ -91,9 +102,6 @@ Security announcement: http://blog.plataformatec.com.br/2013/08/csrf-token-fixat
91
102
  * bug fix
92
103
  * Errors on unlock are now properly reflected on the first `unlock_keys`
93
104
 
94
- * backwards incompatible changes
95
- * Changes on session storage will expire all existing sessions on upgrade. For those storing the session in the DB, they can be upgraded according to this gist: https://gist.github.com/moll/6417606
96
-
97
105
  ### 2.2.4
98
106
 
99
107
  * enhancements
@@ -110,6 +118,9 @@ Security announcement: http://blog.plataformatec.com.br/2013/08/csrf-token-fixat
110
118
  * Fix inheriting mailer templates from `Devise::Mailer`
111
119
  * Fix a bug when procs are used as default mailer in Devise (by @tomasv)
112
120
 
121
+ * backwards incompatible changes
122
+ * Changes on session storage will expire all existing sessions on upgrade. For those storing the session in the DB, they can be upgraded according to this gist: https://gist.github.com/moll/6417606
123
+
113
124
  ### 2.2.3
114
125
 
115
126
  Security announcement: http://blog.plataformatec.com.br/2013/01/security-announcement-devise-v2-2-3-v2-1-3-v2-0-5-and-v1-5-3-released/
@@ -390,7 +401,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
390
401
  ### 1.4.0
391
402
 
392
403
  * enhancements
393
- * Added authenticated and unauthenticated to the router to route the used based on his status (by @sj26)
404
+ * Added authenticated and unauthenticated to the router to route the used based on their status (by @sj26)
394
405
  * Improve e-mail regexp (by @rodrigoflores)
395
406
  * Add strip_whitespace_keys and default to e-mail (by @swrobel)
396
407
  * Do not run format and uniqueness validations on e-mail if it hasn't changed (by @Thibaut)
@@ -399,7 +410,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
399
410
 
400
411
  * bug fix
401
412
  * password_required? should not affect length validation
402
- * User cannot access sign up and similar pages if he is already signed in through a cookie or token
413
+ * User cannot access sign up and similar pages if they are already signed in through a cookie or token
403
414
  * Do not convert booleans to strings on finders (by @xavier)
404
415
  * Run validations even if current_password fails (by @crx)
405
416
  * Devise now honors routes constraints (by @macmartine)
@@ -507,10 +518,10 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
507
518
  * Ensure the friendly token does not include "_" or "-" since some e-mails may not autolink it properly (by @rymai)
508
519
  * Extracted encryptors into :encryptable for better bcrypt support
509
520
  * :rememberable is now able to use salt as token if no remember_token is provided
510
- * Store the salt in session and expire the session if the user changes his password
521
+ * Store the salt in session and expire the session if the user changes their password
511
522
  * Allow :stateless_token to be set to true avoiding users to be stored in session through token authentication
512
523
  * cookie_options uses session_options values by default
513
- * Sign up now check if the user is active or not and redirect him accordingly setting the inactive_signed_up message
524
+ * Sign up now checks if the user is active or not and redirect them accordingly, setting the inactive_signed_up message
514
525
  * Use ActiveModel#to_key instead of #id
515
526
  * sign_out_all_scopes now destroys the whole session
516
527
  * Added case_insensitive_keys that automatically downcases the given keys, by default downcases only e-mail (by @adahl)
@@ -953,7 +964,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
953
964
 
954
965
  * deprecations
955
966
  * Renamed confirm_in to confirm_within
956
- * Do not send confirmation messages when user changes his e-mail
967
+ * Do not send confirmation messages when user changes their e-mail
957
968
  * Renamed authenticable to authenticatable and added deprecation warnings
958
969
 
959
970
  ### 0.2.3
@@ -1,8 +1,8 @@
1
1
  ### Please read before contributing
2
2
 
3
- 1) Do not post questions in the issues tracker. If you have any questions about Devise, search the [Wiki](https://github.com/plataformatec/devise/wiki) or use the [Mailing List](https://groups.google.com/group/plataformatec-devise) or [Stack Overflow](http://stackoverflow.com/questions/tagged/devise).
3
+ 1) Do not post questions in the issues tracker. If you have any questions about Devise, search the [Wiki](https://github.com/plataformatec/devise/wiki) or use the [Mailing List](https://groups.google.com/group/plataformatec-devise) or [Stack Overflow](http://stackoverflow.com/questions/tagged/devise).
4
4
 
5
- 2) If you find a security bug, **DO NOT** submit an issue here. Please send an e-mail to [developers@plataformatec.com.br](mailto:developers@plataformatec.com.br) instead.
5
+ 2) If you find a security bug, **DO NOT** submit an issue here. Please send an e-mail to [opensource@plataformatec.com.br](mailto:opensource@plataformatec.com.br) instead.
6
6
 
7
7
  3) Do a small search on the issues tracker before submitting your issue to see if it was already reported / fixed.
8
8
 
data/Gemfile CHANGED
@@ -24,8 +24,6 @@ platforms :ruby do
24
24
  gem "sqlite3"
25
25
  end
26
26
 
27
- platforms :mri_19, :mri_20 do
28
- group :mongoid do
29
- gem "mongoid", github: "mongoid/mongoid", branch: "master"
30
- end
27
+ group :mongoid do
28
+ gem "mongoid", github: "mongoid/mongoid", branch: "master"
31
29
  end
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- devise (3.2.2)
15
+ devise (3.2.3)
16
16
  bcrypt-ruby (~> 3.0)
17
17
  orm_adapter (~> 0.1)
18
18
  railties (>= 3.2.6, < 5)
@@ -90,7 +90,7 @@ GEM
90
90
  omniauth (~> 1.0)
91
91
  rack-openid (~> 1.3.1)
92
92
  origin (1.1.0)
93
- orm_adapter (0.4.0)
93
+ orm_adapter (0.5.0)
94
94
  polyglot (0.3.3)
95
95
  rack (1.5.2)
96
96
  rack-openid (1.3.1)
@@ -1,4 +1,4 @@
1
- Copyright 2009-2013 Plataformatec. http://plataformatec.com.br
1
+ Copyright 2009-2014 Plataformatec. http://plataformatec.com.br
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -17,7 +17,7 @@ Devise is a flexible authentication solution for Rails based on Warden. It:
17
17
  It's composed of 10 modules:
18
18
 
19
19
  * [Database Authenticatable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/DatabaseAuthenticatable): encrypts and stores a password in the database to validate the authenticity of a user while signing in. The authentication can be done both through POST requests or HTTP Basic Authentication.
20
- * [Omniauthable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Omniauthable): adds Omniauth (https://github.com/intridea/omniauth) support;
20
+ * [Omniauthable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Omniauthable): adds Omniauth (https://github.com/intridea/omniauth) support.
21
21
  * [Confirmable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Confirmable): sends emails with confirmation instructions and verifies whether an account is already confirmed during sign in.
22
22
  * [Recoverable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Recoverable): resets the user password and sends reset instructions.
23
23
  * [Registerable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Registerable): handles signing up users through a registration process, also allowing them to edit and destroy their account.
@@ -43,7 +43,7 @@ If you discover a problem with Devise, we would like to know about it. However,
43
43
 
44
44
  https://github.com/plataformatec/devise/wiki/Bug-reports
45
45
 
46
- If you found a security bug, do *NOT* use the GitHub issue tracker. Send an email to the maintainers listed at the bottom of the README.
46
+ If you found a security bug, do *NOT* use the GitHub issue tracker. Send an email to opensource@plataformatec.com.br.
47
47
 
48
48
  ### Mailing list
49
49
 
@@ -110,9 +110,15 @@ The generator will install an initializer which describes ALL Devise's configura
110
110
  rails generate devise MODEL
111
111
  ```
112
112
 
113
- Replace MODEL by the class name used for the applications users, it's frequently `User` but could also be `Admin`. This will create a model (if one does not exist) and configure it with default Devise modules. Next, you'll usually run `rake db:migrate` as the generator will have created a migration file (if your ORM supports them). This generator also configures your config/routes.rb file to point to the Devise controller.
113
+ Replace MODEL by the class name used for the applications users, it's frequently `User` but could also be `Admin`. This will create a model (if one does not exist) and configure it with default Devise modules. Next, you'll usually run `rake db:migrate` as the generator will have created a migration file (if your ORM supports them). This generator also configures your `config/routes.rb` file to point to the Devise controller.
114
114
 
115
- Note that you should re-start your app here if you've already started it. Otherwise you'll run into strange errors like users being unable to login and the route helpers being undefined.
115
+ Next, you need to set up the default url options for the Devise mailer in each environment. Here is a possible configuration for `config/environments/development.rb`:
116
+
117
+ ```ruby
118
+ config.action_mailer.default_url_options = { host: 'localhost:3000' }
119
+ ```
120
+
121
+ You should restart your application after changing Devise's configuration options. Otherwise you'll run into strange errors like users being unable to login and route helpers being undefined.
116
122
 
117
123
  ### Controller filters and helpers
118
124
 
@@ -140,21 +146,15 @@ You can access the session for this scope:
140
146
  user_session
141
147
  ```
142
148
 
143
- After signing in a user, confirming the account or updating the password, Devise will look for a scoped root path to redirect. Example: For a :user resource, it will use `user_root_path` if it exists, otherwise default `root_path` will be used. This means that you need to set the root inside your routes:
149
+ After signing in a user, confirming the account or updating the password, Devise will look for a scoped root path to redirect. For instance, for a `:user` resource, the `user_root_path` will be used if it exists, otherwise the default `root_path` will be used. This means that you need to set the root inside your routes:
144
150
 
145
151
  ```ruby
146
152
  root to: "home#index"
147
153
  ```
148
154
 
149
- You can also overwrite `after_sign_in_path_for` and `after_sign_out_path_for` to customize your redirect hooks.
150
-
151
- Finally, you need to set up default url options for the mailer in each environment. Here is the configuration for "config/environments/development.rb":
152
-
153
- ```ruby
154
- config.action_mailer.default_url_options = { :host => 'localhost:3000' }
155
- ```
155
+ You can also override `after_sign_in_path_for` and `after_sign_out_path_for` to customize your redirect hooks.
156
156
 
157
- Notice that if your devise model is not called "user" but "member", then the helpers you should use are:
157
+ Notice that if your Devise model is called `Member` instead of `User`, for example, then the helpers available are:
158
158
 
159
159
  ```ruby
160
160
  before_filter :authenticate_member!
@@ -168,13 +168,13 @@ member_session
168
168
 
169
169
  ### Configuring Models
170
170
 
171
- The devise method in your models also accepts some options to configure its modules. For example, you can choose the cost of the encryption algorithm with:
171
+ The Devise method in your models also accepts some options to configure its modules. For example, you can choose the cost of the encryption algorithm with:
172
172
 
173
173
  ```ruby
174
- devise :database_authenticatable, :registerable, :confirmable, :recoverable, :stretches => 20
174
+ devise :database_authenticatable, :registerable, :confirmable, :recoverable, stretches: 20
175
175
  ```
176
176
 
177
- Besides :stretches, you can define :pepper, :encryptor, :confirm_within, :remember_for, :timeout_in, :unlock_in and other values. For details, see the initializer file that was created when you invoked the "devise:install" generator described above.
177
+ Besides `:stretches`, you can define `:pepper`, `:encryptor`, `:confirm_within`, `:remember_for`, `:timeout_in`, `:unlock_in` among other options. For more details, see the initializer file that was created when you invoked the "devise:install" generator described above.
178
178
 
179
179
  ### Strong Parameters
180
180
 
@@ -200,7 +200,9 @@ class ApplicationController < ActionController::Base
200
200
  end
201
201
  ```
202
202
 
203
- To completely change Devise defaults or invoke custom behaviour, you can also pass a block:
203
+ The above works for any additional fields where the parameters are simple scalar types. If you have nested attributes (say you're using `accepts_nested_parameters_for`), then you will need to tell devise about those nestings and types. Devise allows you to completely change Devise defaults or invoke custom behaviour by passing a block:
204
+
205
+ To permit simple scalar values for username and email, use this
204
206
 
205
207
  ```ruby
206
208
  def configure_permitted_parameters
@@ -208,6 +210,17 @@ def configure_permitted_parameters
208
210
  end
209
211
  ```
210
212
 
213
+ If you have some checkboxes that express the roles a user may take on registration, the browser will send those selected checkboxes as an array. An array is not one of Strong Parameters permitted scalars, so we need to configure Devise thusly:
214
+
215
+ ```ruby
216
+ def configure_permitted_parameters
217
+ devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(roles: [], :email, :password, :password_confirmation) }
218
+ end
219
+ ```
220
+ For the list of permitted scalars, and how to declare permitted keys in nested hashes and arrays, see
221
+
222
+ https://github.com/rails/strong_parameters#nested-parameters
223
+
211
224
  If you have multiple Devise models, you may want to set up different parameter sanitizer per model. In this case, we recommend inheriting from `Devise::ParameterSanitizer` and add your own logic:
212
225
 
213
226
  ```ruby
@@ -246,9 +259,9 @@ Since Devise is an engine, all its views are packaged inside the gem. These view
246
259
  rails generate devise:views
247
260
  ```
248
261
 
249
- If you have more than one Devise model in your application (such as "User" and "Admin"), you will notice that Devise uses the same views for all models. Fortunately, Devise offers an easy way to customize views. All you need to do is set "config.scoped_views = true" inside "config/initializers/devise.rb".
262
+ If you have more than one Devise model in your application (such as `User` and `Admin`), you will notice that Devise uses the same views for all models. Fortunately, Devise offers an easy way to customize views. All you need to do is set `config.scoped_views = true` inside the `config/initializers/devise.rb` file.
250
263
 
251
- After doing so, you will be able to have views based on the role like "users/sessions/new" and "admins/sessions/new". If no view is found within the scope, Devise will use the default view at "devise/sessions/new". You can also use the generator to generate scoped views:
264
+ After doing so, you will be able to have views based on the role like `users/sessions/new` and `admins/sessions/new`. If no view is found within the scope, Devise will use the default view at `devise/sessions/new`. You can also use the generator to generate scoped views:
252
265
 
253
266
  ```console
254
267
  rails generate devise:views users
@@ -270,19 +283,45 @@ If the customization at the views level is not enough, you can customize each co
270
283
  2. Tell the router to use this controller:
271
284
 
272
285
  ```ruby
273
- devise_for :admins, :controllers => { :sessions => "admins/sessions" }
286
+ devise_for :admins, controllers: { sessions: "admins/sessions" }
287
+ ```
288
+
289
+ 3. Copy the views from `devise/sessions` to `admins/sessions`. Since the controller was changed, it won't use the default views located in `devise/sessions`.
290
+
291
+ 4. Finally, change or extend the desired controller actions.
292
+
293
+ You can completely override a controller action:
294
+
295
+ ```ruby
296
+ class Admins::SessionsController < Devise::SessionsController
297
+ def create
298
+ # custom sign-in code
299
+ end
300
+ end
301
+ ```
302
+
303
+ Or you can simply add new behaviour to it:
304
+
305
+ ```ruby
306
+ class Admins::SessionsController < Devise::SessionsController
307
+ def create
308
+ super do |resource|
309
+ BackgroundWorker.trigger(resource)
310
+ end
311
+ end
312
+ end
274
313
  ```
275
314
 
276
- 3. And since we changed the controller, it won't use the `"devise/sessions"` views, so remember to copy `"devise/sessions"` to `"admin/sessions"`.
315
+ This is useful for triggering background jobs or logging events during certain actions.
277
316
 
278
- Remember that Devise uses flash messages to let users know if sign in was successful or failed. Devise expects your application to call `"flash[:notice]"` and `"flash[:alert]"` as appropriate. Do not print the entire flash hash, print specific keys or at least remove the `:timedout` key from the hash as Devise adds this key in some circumstances, this key is not meant for display.
317
+ Remember that Devise uses flash messages to let users know if sign in was successful or failed. Devise expects your application to call `flash[:notice]` and `flash[:alert]` as appropriate. Do not print the entire flash hash, print only specific keys. In some circumstances, Devise adds a `:timedout` key to the flash hash, which is not meant for display. Remove this key from the hash if you intend to print the entire hash.
279
318
 
280
319
  ### Configuring routes
281
320
 
282
321
  Devise also ships with default routes. If you need to customize them, you should probably be able to do it through the devise_for method. It accepts several options like :class_name, :path_prefix and so on, including the possibility to change path names for I18n:
283
322
 
284
323
  ```ruby
285
- devise_for :users, :path => "auth", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' }
324
+ devise_for :users, path: "auth", path_names: { sign_in: 'login', sign_out: 'logout', password: 'secret', confirmation: 'verification', unlock: 'unblock', registration: 'register', sign_up: 'cmon_let_me_in' }
286
325
  ```
287
326
 
288
327
  Be sure to check `devise_for` documentation for details.
@@ -291,11 +330,11 @@ If you have the need for more deep customization, for instance to also allow "/s
291
330
 
292
331
  ```ruby
293
332
  devise_scope :user do
294
- get "sign_in", :to => "devise/sessions#new"
333
+ get "sign_in", to: "devise/sessions#new"
295
334
  end
296
335
  ```
297
336
 
298
- This way you tell devise to use the scope :user when "/sign_in" is accessed. Notice `devise_scope` is also aliased as `as` in your router.
337
+ This way you tell Devise to use the scope `:user` when "/sign_in" is accessed. Notice `devise_scope` is also aliased as `as` in your router.
299
338
 
300
339
  ### I18n
301
340
 
@@ -339,7 +378,7 @@ https://github.com/plataformatec/devise/wiki/I18n
339
378
 
340
379
  ### Test helpers
341
380
 
342
- Devise includes some tests helpers for functional specs. In order to use them, you need to include Devise in your functional tests by adding the following to the bottom of your `test/test_helper.rb` file:
381
+ Devise includes some test helpers for functional specs. In order to use them, you need to include Devise in your functional tests by adding the following to the bottom of your `test/test_helper.rb` file:
343
382
 
344
383
  ```ruby
345
384
  class ActionController::TestCase
@@ -351,7 +390,7 @@ If you're using RSpec, you can put the following inside a file named `spec/suppo
351
390
 
352
391
  ```ruby
353
392
  RSpec.configure do |config|
354
- config.include Devise::TestHelpers, :type => :controller
393
+ config.include Devise::TestHelpers, type: :controller
355
394
  end
356
395
  ```
357
396
 
@@ -381,7 +420,7 @@ There are two things that is important to keep in mind:
381
420
  Devise comes with Omniauth support out of the box to authenticate with other providers. To use it, just specify your omniauth configuration in `config/initializers/devise.rb`:
382
421
 
383
422
  ```ruby
384
- config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
423
+ config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
385
424
  ```
386
425
 
387
426
  You can read more about Omniauth support in the wiki:
@@ -427,7 +466,7 @@ Devise supports ActiveRecord (default) and Mongoid. To choose other ORM, you jus
427
466
 
428
467
  ### Heroku
429
468
 
430
- Using devise on Heroku with Ruby on Rails 3.1 requires setting:
469
+ Using Devise on Heroku with Ruby on Rails 3.1 requires setting:
431
470
 
432
471
  ```ruby
433
472
  config.assets.initialize_on_precompile = false
@@ -449,6 +488,6 @@ https://github.com/plataformatec/devise/graphs/contributors
449
488
 
450
489
  ## License
451
490
 
452
- MIT License. Copyright 2009-2013 Plataformatec. http://plataformatec.com.br
491
+ MIT License. Copyright 2009-2014 Plataformatec. http://plataformatec.com.br
453
492
 
454
493
  You are not granted rights or licenses to the trademarks of the Plataformatec, including without limitation the Devise name or logo.
@@ -28,7 +28,7 @@ en:
28
28
  success: "Successfully authenticated from %{kind} account."
29
29
  passwords:
30
30
  no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
- send_instructions: "You will receive an email with instructions about how to reset your password in a few minutes."
31
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
32
  send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
33
  updated: "Your password was changed successfully. You are now signed in."
34
34
  updated_not_active: "Your password was changed successfully."
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.licenses = ["MIT"]
10
10
  s.summary = "Flexible authentication solution for Rails with Warden"
11
11
  s.email = "contact@plataformatec.com.br"
12
- s.homepage = "http://github.com/plataformatec/devise"
12
+ s.homepage = "https://github.com/plataformatec/devise"
13
13
  s.description = "Flexible authentication solution for Rails with Warden"
14
14
  s.authors = ['José Valim', 'Carlos Antônio']
15
15
 
@@ -2,7 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec :path => '..'
4
4
 
5
- gem "rails", "~> 3.2.6"
5
+ gem "rails", github: 'rails/rails', branch: '3-2-stable'
6
6
  gem "omniauth", "~> 1.0.0"
7
7
  gem "omniauth-oauth2", "~> 1.0.0"
8
8
  gem "rdoc"
@@ -24,8 +24,6 @@ platforms :ruby do
24
24
  gem "sqlite3"
25
25
  end
26
26
 
27
- platforms :mri_19, :mri_20 do
28
- group :mongoid do
29
- gem "mongoid", "~> 3.0"
30
- end
27
+ group :mongoid do
28
+ gem "mongoid", "~> 3.0"
31
29
  end
@@ -0,0 +1,29 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => '..'
4
+
5
+ gem "rails", github: 'rails/rails', branch: '4-0-stable'
6
+ gem "omniauth", "~> 1.0.0"
7
+ gem "omniauth-oauth2", "~> 1.0.0"
8
+ gem "rdoc"
9
+
10
+ group :test do
11
+ gem "omniauth-facebook"
12
+ gem "omniauth-openid", "~> 1.0.1"
13
+ gem "webrat", "0.7.3", :require => false
14
+ gem "mocha", "~> 0.13.1", :require => false
15
+ end
16
+
17
+ platforms :jruby do
18
+ gem "activerecord-jdbc-adapter"
19
+ gem "activerecord-jdbcsqlite3-adapter"
20
+ gem "jruby-openssl"
21
+ end
22
+
23
+ platforms :ruby do
24
+ gem "sqlite3"
25
+ end
26
+
27
+ group :mongoid do
28
+ gem "mongoid", github: "mongoid/mongoid", branch: "master"
29
+ end