devise 2.1.4 → 2.2.0.rc

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 (84) hide show
  1. data/.travis.yml +26 -0
  2. data/CHANGELOG.rdoc +29 -10
  3. data/CONTRIBUTING.md +14 -0
  4. data/Gemfile +2 -8
  5. data/Gemfile.lock +68 -77
  6. data/README.md +15 -9
  7. data/app/controllers/devise/omniauth_callbacks_controller.rb +1 -1
  8. data/app/controllers/devise/passwords_controller.rb +9 -0
  9. data/app/controllers/devise/registrations_controller.rb +17 -5
  10. data/app/controllers/devise/sessions_controller.rb +3 -3
  11. data/app/controllers/devise_controller.rb +3 -11
  12. data/app/views/devise/confirmations/new.html.erb +1 -1
  13. data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
  14. data/app/views/devise/mailer/unlock_instructions.html.erb +1 -1
  15. data/app/views/devise/passwords/edit.html.erb +1 -1
  16. data/app/views/devise/passwords/new.html.erb +1 -1
  17. data/app/views/devise/registrations/edit.html.erb +5 -1
  18. data/app/views/devise/registrations/new.html.erb +1 -1
  19. data/app/views/devise/sessions/new.html.erb +1 -1
  20. data/app/views/devise/unlocks/new.html.erb +1 -1
  21. data/config/locales/en.yml +2 -0
  22. data/gemfiles/Gemfile.rails-3.1.x +1 -3
  23. data/gemfiles/Gemfile.rails-3.1.x.lock +9 -12
  24. data/lib/devise.rb +12 -7
  25. data/lib/devise/controllers/helpers.rb +16 -3
  26. data/lib/devise/mailers/helpers.rb +14 -8
  27. data/lib/devise/models/authenticatable.rb +14 -9
  28. data/lib/devise/models/confirmable.rb +36 -3
  29. data/lib/devise/models/database_authenticatable.rb +2 -1
  30. data/lib/devise/models/lockable.rb +6 -2
  31. data/lib/devise/models/recoverable.rb +2 -2
  32. data/lib/devise/models/token_authenticatable.rb +12 -0
  33. data/lib/devise/models/trackable.rb +1 -1
  34. data/lib/devise/models/validatable.rb +1 -1
  35. data/lib/devise/param_filter.rb +2 -1
  36. data/lib/devise/rails/routes.rb +11 -11
  37. data/lib/devise/strategies/database_authenticatable.rb +1 -1
  38. data/lib/devise/test_helpers.rb +3 -2
  39. data/lib/devise/time_inflector.rb +14 -0
  40. data/lib/devise/version.rb +1 -1
  41. data/lib/generators/active_record/devise_generator.rb +5 -1
  42. data/lib/generators/mongoid/devise_generator.rb +0 -3
  43. data/lib/generators/templates/README +5 -1
  44. data/lib/generators/templates/devise.rb +12 -4
  45. data/lib/generators/templates/markerb/confirmation_instructions.markerb +1 -1
  46. data/lib/generators/templates/markerb/unlock_instructions.markerb +1 -1
  47. data/lib/generators/templates/simple_form_for/confirmations/new.html.erb +2 -1
  48. data/lib/generators/templates/simple_form_for/passwords/edit.html.erb +1 -1
  49. data/lib/generators/templates/simple_form_for/passwords/new.html.erb +1 -1
  50. data/lib/generators/templates/simple_form_for/registrations/edit.html.erb +5 -0
  51. data/lib/generators/templates/simple_form_for/unlocks/new.html.erb +2 -1
  52. data/test/controllers/internal_helpers_test.rb +6 -0
  53. data/test/controllers/sessions_controller_test.rb +43 -1
  54. data/test/devise_test.rb +12 -1
  55. data/test/generators/active_record_generator_test.rb +7 -1
  56. data/test/integration/authenticatable_test.rb +4 -4
  57. data/test/integration/confirmable_test.rb +44 -0
  58. data/test/integration/database_authenticatable_test.rb +17 -15
  59. data/test/integration/http_authenticatable_test.rb +3 -3
  60. data/test/integration/lockable_test.rb +18 -0
  61. data/test/integration/omniauthable_test.rb +2 -2
  62. data/test/integration/recoverable_test.rb +43 -6
  63. data/test/integration/registerable_test.rb +34 -11
  64. data/test/mailers/confirmation_instructions_test.rb +7 -0
  65. data/test/models/authenticatable_test.rb +1 -7
  66. data/test/models/confirmable_test.rb +35 -1
  67. data/test/models/database_authenticatable_test.rb +49 -24
  68. data/test/models/lockable_test.rb +13 -3
  69. data/test/models/serializable_test.rb +2 -1
  70. data/test/models_test.rb +1 -22
  71. data/test/orm/mongoid.rb +2 -3
  72. data/test/rails_app/app/controllers/application_controller.rb +1 -0
  73. data/test/rails_app/app/mailers/users/mailer.rb +6 -1
  74. data/test/rails_app/app/mongoid/admin.rb +4 -2
  75. data/test/rails_app/app/mongoid/shim.rb +3 -3
  76. data/test/rails_app/app/mongoid/user.rb +2 -2
  77. data/test/rails_app/config/initializers/devise.rb +2 -2
  78. data/test/rails_app/lib/shared_user.rb +1 -1
  79. data/test/support/helpers.rb +2 -2
  80. data/test/support/integration.rb +4 -3
  81. data/test/test_helpers_test.rb +19 -2
  82. data/test/test_models.rb +27 -0
  83. metadata +31 -29
  84. data/test/indifferent_hash.rb +0 -33
@@ -1,12 +1,38 @@
1
+ language: ruby
1
2
  script: "bundle exec rake test"
2
3
  rvm:
3
4
  - 1.8.7
4
5
  - 1.9.2
5
6
  - 1.9.3
6
7
  - ree
8
+ env:
9
+ - DEVISE_ORM=mongoid
10
+ - DEVISE_ORM=active_record
11
+ matrix:
12
+ exclude:
13
+ - rvm: ree
14
+ env: DEVISE_ORM=mongoid
15
+ gemfile: Gemfile
16
+ - rvm: ree
17
+ env: DEVISE_ORM=mongoid
18
+ gemfile: gemfiles/Gemfile.rails-3.1.x
19
+ - rvm: 1.8.7
20
+ env: DEVISE_ORM=mongoid
21
+ gemfile: Gemfile
22
+ - rvm: 1.8.7
23
+ env: DEVISE_ORM=mongoid
24
+ gemfile: gemfiles/Gemfile.rails-3.1.x
25
+ - rvm: 1.9.2
26
+ env: DEVISE_ORM=mongoid
27
+ gemfile: Gemfile
28
+ - rvm: 1.9.2
29
+ env: DEVISE_ORM=mongoid
30
+ gemfile: gemfiles/Gemfile.rails-3.1.x
7
31
  gemfile:
8
32
  - gemfiles/Gemfile.rails-3.1.x
9
33
  - Gemfile
34
+ services:
35
+ - mongodb
10
36
  notifications:
11
37
  recipients:
12
38
  - jose.valim@plataformatec.com.br
@@ -1,16 +1,35 @@
1
- == 2.1.4
2
-
3
- * bug fix
4
- * Do not confirm account after reset password
5
-
6
- == 2.1.3
7
-
8
- * bug fix
9
- * Require string conversion for all values
1
+ == 2.2.0.rc
2
+
3
+ * important changes
4
+ * Default minimum password length is now 8 (by @carlosgaldino)
5
+ * Support alternate sign in error message when email record does not exist (this adds a new I18n key to the locale file) (@gabetax)
6
+ * DeviseController responds only to HTML requests by default (call `DeviseController.respond_to` or `ApplicationController.respond_to` to add new formats)
7
+ * Support Mongoid 3 onwards (by @durran)
8
+ * Fix unlockable which could leak account existence on paranoid mode (by @latortuga)
9
+
10
+ * enhancements
11
+ * Confirmable now has a confirm_within option to set a period while the confirmation token is still valid (by @promisedlandt)
12
+ * Flash messages in controller now respects `resource_name` (by @latortuga)
13
+ * Separate `sign_in` and `sign_up` on RegistrationsController (by @rubynortheast)
14
+ * Add autofocus to default views (by @Radagaisus)
15
+ * Unlock user on password reset (by @marcinb)
16
+ * Allow validation callbacks to apply to virtual attributes (by @latortuga)
17
+
18
+ * bug fix
19
+ * unconfirmed_email now uses the proper e-mail on salutation
20
+ * Fix default email_regexp config to not allow spaces (by @kukula)
21
+ * Fix a regression introduced on warden 1.2.1 (by @ejfinneran)
22
+ * Properly camelize omniauth strategies (by @saizai)
23
+ * Do not set flash messages for non navigational requests on session sign out (by @mathieul)
24
+ * Set the proper fields as required on the lockable module (by @nickhoffman)
25
+ * Respects Devise mailer default's reply_to (by @mrchrisadams)
26
+ * Properly assign resource on `sign_in` related action (by @adammcnamara)
27
+ * `update_with_password` doesn't change encrypted password when it is invalid (by @nashby)
28
+ * Properly handle namespaced models on Active Record generator (by @nashby)
10
29
 
11
30
  == 2.1.2
12
31
 
13
- * Enhancements
32
+ * enhancements
14
33
  * Handle backwards incompatibility between Rails 3.2.6 and Thor 0.15.x
15
34
 
16
35
  * bug fix
@@ -0,0 +1,14 @@
1
+ ### Please read before contributing
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).
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.
6
+
7
+ 3) Do a small search on the issues tracker before submitting your issue to see if it was already reported / fixed.
8
+
9
+ 4) When reporting an issue, include Rails, Devise and Warden versions. If you are getting exceptions, please include the full backtrace.
10
+
11
+ That's it! The more information you give, the easier it becomes for us to track it down and fix it.
12
+ Ideally, you should provide an application that reproduces the error or a test case to Devise's suite.
13
+
14
+ Thanks!
data/Gemfile CHANGED
@@ -11,11 +11,7 @@ group :test do
11
11
  gem "omniauth-facebook"
12
12
  gem "omniauth-openid", "~> 1.0.1"
13
13
  gem "webrat", "0.7.2", :require => false
14
- gem "mocha", :require => false
15
-
16
- platforms :mri_18 do
17
- gem "ruby-debug", ">= 0.10.3"
18
- end
14
+ gem "mocha", "0.10.0", :require => false
19
15
  end
20
16
 
21
17
  platforms :jruby do
@@ -28,8 +24,6 @@ platforms :ruby do
28
24
  gem "sqlite3"
29
25
 
30
26
  group :mongoid do
31
- gem "mongo", "~> 1.3.0"
32
- gem "mongoid", "~> 2.0"
33
- gem "bson_ext", "~> 1.3.0"
27
+ gem "mongoid", "~> 3.0"
34
28
  end
35
29
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devise (2.1.4)
4
+ devise (2.2.0.rc)
5
5
  bcrypt-ruby (~> 3.0)
6
6
  orm_adapter (~> 0.1)
7
7
  railties (~> 3.1)
@@ -10,83 +10,82 @@ PATH
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- actionmailer (3.2.6)
14
- actionpack (= 3.2.6)
13
+ actionmailer (3.2.9)
14
+ actionpack (= 3.2.9)
15
15
  mail (~> 2.4.4)
16
- actionpack (3.2.6)
17
- activemodel (= 3.2.6)
18
- activesupport (= 3.2.6)
16
+ actionpack (3.2.9)
17
+ activemodel (= 3.2.9)
18
+ activesupport (= 3.2.9)
19
19
  builder (~> 3.0.0)
20
20
  erubis (~> 2.7.0)
21
- journey (~> 1.0.1)
21
+ journey (~> 1.0.4)
22
22
  rack (~> 1.4.0)
23
23
  rack-cache (~> 1.2)
24
24
  rack-test (~> 0.6.1)
25
- sprockets (~> 2.1.3)
26
- activemodel (3.2.6)
27
- activesupport (= 3.2.6)
25
+ sprockets (~> 2.2.1)
26
+ activemodel (3.2.9)
27
+ activesupport (= 3.2.9)
28
28
  builder (~> 3.0.0)
29
- activerecord (3.2.6)
30
- activemodel (= 3.2.6)
31
- activesupport (= 3.2.6)
29
+ activerecord (3.2.9)
30
+ activemodel (= 3.2.9)
31
+ activesupport (= 3.2.9)
32
32
  arel (~> 3.0.2)
33
33
  tzinfo (~> 0.3.29)
34
- activeresource (3.2.6)
35
- activemodel (= 3.2.6)
36
- activesupport (= 3.2.6)
37
- activesupport (3.2.6)
34
+ activeresource (3.2.9)
35
+ activemodel (= 3.2.9)
36
+ activesupport (= 3.2.9)
37
+ activesupport (3.2.9)
38
38
  i18n (~> 0.6)
39
39
  multi_json (~> 1.0)
40
- addressable (2.2.6)
41
40
  arel (3.0.2)
42
- bcrypt-ruby (3.1.1)
43
- bson (1.5.1)
44
- bson_ext (1.3.1)
45
- builder (3.0.0)
46
- columnize (0.3.5)
41
+ bcrypt-ruby (3.0.1)
42
+ builder (3.0.4)
47
43
  erubis (2.7.0)
48
- faraday (0.7.5)
49
- addressable (~> 2.2.6)
50
- multipart-post (~> 1.1.3)
51
- rack (>= 1.1.0, < 2)
44
+ faraday (0.8.4)
45
+ multipart-post (~> 1.1)
52
46
  hashie (1.2.0)
53
47
  hike (1.2.1)
54
- i18n (0.6.0)
48
+ httpauth (0.2.0)
49
+ i18n (0.6.1)
55
50
  journey (1.0.4)
56
- json (1.7.3)
57
- linecache (0.46)
58
- rbx-require-relative (> 0.0.4)
51
+ json (1.7.5)
52
+ jwt (0.1.5)
53
+ multi_json (>= 1.0)
59
54
  mail (2.4.4)
60
55
  i18n (>= 0.4.0)
61
56
  mime-types (~> 1.16)
62
57
  treetop (~> 1.4.8)
63
58
  metaclass (0.0.1)
64
- mime-types (1.18)
59
+ mime-types (1.19)
65
60
  mocha (0.10.0)
66
61
  metaclass (~> 0.0.1)
67
- mongo (1.3.1)
68
- bson (>= 1.3.1)
69
- mongoid (2.3.4)
62
+ mongoid (3.0.14)
70
63
  activemodel (~> 3.1)
71
- mongo (~> 1.3)
64
+ moped (~> 1.1)
65
+ origin (~> 1.0)
72
66
  tzinfo (~> 0.3.22)
73
- multi_json (1.0.4)
74
- multipart-post (1.1.4)
75
- nokogiri (1.5.0)
76
- oauth2 (0.5.1)
77
- faraday (~> 0.7.4)
78
- multi_json (~> 1.0.3)
79
- omniauth (1.0.1)
67
+ moped (1.3.1)
68
+ multi_json (1.4.0)
69
+ multipart-post (1.1.5)
70
+ nokogiri (1.5.5)
71
+ oauth2 (0.8.0)
72
+ faraday (~> 0.8)
73
+ httpauth (~> 0.1)
74
+ jwt (~> 0.1.4)
75
+ multi_json (~> 1.0)
76
+ rack (~> 1.2)
77
+ omniauth (1.0.3)
80
78
  hashie (~> 1.2)
81
79
  rack
82
- omniauth-facebook (1.0.0)
83
- omniauth-oauth2 (~> 1.0.0)
84
- omniauth-oauth2 (1.0.0)
85
- oauth2 (~> 0.5.0)
80
+ omniauth-facebook (1.4.0)
81
+ omniauth-oauth2 (~> 1.0.2)
82
+ omniauth-oauth2 (1.0.3)
83
+ oauth2 (~> 0.8.0)
86
84
  omniauth (~> 1.0)
87
85
  omniauth-openid (1.0.1)
88
86
  omniauth (~> 1.0)
89
87
  rack-openid (~> 1.3.1)
88
+ origin (1.0.11)
90
89
  orm_adapter (0.4.0)
91
90
  polyglot (0.3.3)
92
91
  rack (1.4.1)
@@ -97,45 +96,40 @@ GEM
97
96
  ruby-openid (>= 2.1.8)
98
97
  rack-ssl (1.3.2)
99
98
  rack
100
- rack-test (0.6.1)
99
+ rack-test (0.6.2)
101
100
  rack (>= 1.0)
102
- rails (3.2.6)
103
- actionmailer (= 3.2.6)
104
- actionpack (= 3.2.6)
105
- activerecord (= 3.2.6)
106
- activeresource (= 3.2.6)
107
- activesupport (= 3.2.6)
101
+ rails (3.2.9)
102
+ actionmailer (= 3.2.9)
103
+ actionpack (= 3.2.9)
104
+ activerecord (= 3.2.9)
105
+ activeresource (= 3.2.9)
106
+ activesupport (= 3.2.9)
108
107
  bundler (~> 1.0)
109
- railties (= 3.2.6)
110
- railties (3.2.6)
111
- actionpack (= 3.2.6)
112
- activesupport (= 3.2.6)
108
+ railties (= 3.2.9)
109
+ railties (3.2.9)
110
+ actionpack (= 3.2.9)
111
+ activesupport (= 3.2.9)
113
112
  rack-ssl (~> 1.3.2)
114
113
  rake (>= 0.8.7)
115
114
  rdoc (~> 3.4)
116
115
  thor (>= 0.14.6, < 2.0)
117
- rake (0.9.2.2)
118
- rbx-require-relative (0.0.5)
116
+ rake (10.0.2)
119
117
  rdoc (3.12)
120
118
  json (~> 1.4)
121
- ruby-debug (0.10.4)
122
- columnize (>= 0.1)
123
- ruby-debug-base (~> 0.10.4.0)
124
- ruby-debug-base (0.10.4)
125
- linecache (>= 0.3)
126
- ruby-openid (2.1.8)
127
- sprockets (2.1.3)
119
+ ruby-openid (2.2.2)
120
+ sprockets (2.2.2)
128
121
  hike (~> 1.2)
122
+ multi_json (~> 1.0)
129
123
  rack (~> 1.0)
130
124
  tilt (~> 1.1, != 1.3.0)
131
- sqlite3 (1.3.5)
132
- thor (0.15.2)
125
+ sqlite3 (1.3.6)
126
+ thor (0.16.0)
133
127
  tilt (1.3.3)
134
- treetop (1.4.10)
128
+ treetop (1.4.12)
135
129
  polyglot
136
130
  polyglot (>= 0.3.1)
137
- tzinfo (0.3.33)
138
- warden (1.2.3)
131
+ tzinfo (0.3.35)
132
+ warden (1.2.1)
139
133
  rack (>= 1.0)
140
134
  webrat (0.7.2)
141
135
  nokogiri (>= 1.2.0)
@@ -148,18 +142,15 @@ PLATFORMS
148
142
  DEPENDENCIES
149
143
  activerecord-jdbc-adapter
150
144
  activerecord-jdbcsqlite3-adapter
151
- bson_ext (~> 1.3.0)
152
145
  devise!
153
146
  jruby-openssl
154
- mocha
155
- mongo (~> 1.3.0)
156
- mongoid (~> 2.0)
147
+ mocha (= 0.10.0)
148
+ mongoid (~> 3.0)
157
149
  omniauth (~> 1.0.0)
158
150
  omniauth-facebook
159
151
  omniauth-oauth2 (~> 1.0.0)
160
152
  omniauth-openid (~> 1.0.1)
161
153
  rails (~> 3.2.6)
162
154
  rdoc
163
- ruby-debug (>= 0.10.3)
164
155
  sqlite3
165
156
  webrat (= 0.7.2)
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- *IMPORTANT:* Devise 2.1 is out. If you are upgrading, please read: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.1
2
-
3
1
  ## Devise
4
2
 
5
- INFO: This README is [also available in a friendly navigable format](http://devise.plataformatec.com.br/).
3
+ [![Build Status](https://secure.travis-ci.org/plataformatec/devise.png?branch=master)](http://travis-ci.org/plataformatec/devise)
4
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/plataformatec/devise)
5
+ [![Gem Version](https://fury-badge.herokuapp.com/rb/devise.png)](http://badge.fury.io/rb/devise)
6
6
 
7
- [![Build Status](https://secure.travis-ci.org/plataformatec/devise.png)](http://travis-ci.org/plataformatec/devise) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/plataformatec/devise)
7
+ This README is [also available in a friendly navigable format](http://devise.plataformatec.com.br/).
8
8
 
9
9
  Devise is a flexible authentication solution for Rails based on Warden. It:
10
10
 
@@ -108,7 +108,7 @@ The generator will install an initializer which describes ALL Devise's configura
108
108
  rails generate devise MODEL
109
109
  ```
110
110
 
111
- 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 Devise controller.
111
+ 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.
112
112
 
113
113
  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.
114
114
 
@@ -240,14 +240,14 @@ devise_for :admins, :controllers => { :sessions => "admins/sessions" }
240
240
 
241
241
  3) And since we changed the controller, it won't use the "devise/sessions" views, so remember to copy "devise/sessions" to "admin/sessions".
242
242
 
243
- 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.
243
+ 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.
244
244
 
245
245
  ### Configuring routes
246
246
 
247
247
  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:
248
248
 
249
249
  ```ruby
250
- devise_for :users, :path => "usuarios", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' }
250
+ 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' }
251
251
  ```
252
252
 
253
253
  Be sure to check `devise_for` documentation for details.
@@ -304,7 +304,7 @@ https://github.com/plataformatec/devise/wiki/I18n
304
304
 
305
305
  ### Test helpers
306
306
 
307
- Devise includes some tests helpers for functional specs. In other 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:
307
+ 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:
308
308
 
309
309
  ```ruby
310
310
  class ActionController::TestCase
@@ -341,7 +341,13 @@ There are two things that is important to keep in mind:
341
341
 
342
342
  ### Omniauth
343
343
 
344
- Devise comes with Omniauth support out of the box to authenticate from other providers. You can read more about Omniauth support in the wiki:
344
+ 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`:
345
+
346
+ ```ruby
347
+ config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
348
+ ```
349
+
350
+ You can read more about Omniauth support in the wiki:
345
351
 
346
352
  * https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview
347
353
 
@@ -6,7 +6,7 @@ class Devise::OmniauthCallbacksController < DeviseController
6
6
  end
7
7
 
8
8
  def failure
9
- set_flash_message :alert, :failure, :kind => failed_strategy.name.to_s.humanize, :reason => failure_message
9
+ set_flash_message :alert, :failure, :kind => OmniAuth::Utils.camelize(failed_strategy.name), :reason => failure_message
10
10
  redirect_to after_omniauth_failure_path_for(resource_name)
11
11
  end
12
12
 
@@ -30,6 +30,7 @@ class Devise::PasswordsController < DeviseController
30
30
  self.resource = resource_class.reset_password_by_token(resource_params)
31
31
 
32
32
  if resource.errors.empty?
33
+ resource.unlock_access! if unlockable?(resource)
33
34
  flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
34
35
  set_flash_message(:notice, flash_message) if is_navigational_format?
35
36
  sign_in(resource_name, resource)
@@ -53,4 +54,12 @@ class Devise::PasswordsController < DeviseController
53
54
  redirect_to new_session_path(resource_name)
54
55
  end
55
56
  end
57
+
58
+ # Check if proper Lockable module methods are present & unlock strategy
59
+ # allows to unlock resource on password reset
60
+ def unlockable?(resource)
61
+ resource.respond_to?(:unlock_access!) &&
62
+ resource.respond_to?(:unlock_strategy_enabled?) &&
63
+ resource.unlock_strategy_enabled?(:email)
64
+ end
56
65
  end
@@ -15,7 +15,7 @@ class Devise::RegistrationsController < DeviseController
15
15
  if resource.save
16
16
  if resource.active_for_authentication?
17
17
  set_flash_message :notice, :signed_up if is_navigational_format?
18
- sign_in(resource_name, resource)
18
+ sign_up(resource_name, resource)
19
19
  respond_with resource, :location => after_sign_up_path_for(resource)
20
20
  else
21
21
  set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
@@ -38,13 +38,13 @@ class Devise::RegistrationsController < DeviseController
38
38
  # the current user in place.
39
39
  def update
40
40
  self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
41
+ prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)
41
42
 
42
43
  if resource.update_with_password(resource_params)
43
44
  if is_navigational_format?
44
- if resource.respond_to?(:pending_reconfirmation?) && resource.pending_reconfirmation?
45
- flash_key = :update_needs_confirmation
46
- end
47
- set_flash_message :notice, flash_key || :updated
45
+ flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
46
+ :update_needs_confirmation : :updated
47
+ set_flash_message :notice, flash_key
48
48
  end
49
49
  sign_in resource_name, resource, :bypass => true
50
50
  respond_with resource, :location => after_update_path_for(resource)
@@ -74,6 +74,12 @@ class Devise::RegistrationsController < DeviseController
74
74
 
75
75
  protected
76
76
 
77
+ def update_needs_confirmation?(resource, previous)
78
+ resource.respond_to?(:pending_reconfirmation?) &&
79
+ resource.pending_reconfirmation? &&
80
+ previous != resource.unconfirmed_email
81
+ end
82
+
77
83
  # Build a devise resource passing in the session. Useful to move
78
84
  # temporary session data to the newly created user.
79
85
  def build_resource(hash=nil)
@@ -81,6 +87,12 @@ class Devise::RegistrationsController < DeviseController
81
87
  self.resource = resource_class.new_with_session(hash, session)
82
88
  end
83
89
 
90
+ # Signs in a user on sign up. You can overwrite this method in your own
91
+ # RegistrationsController.
92
+ def sign_up(resource_name, resource)
93
+ sign_in(resource_name, resource)
94
+ end
95
+
84
96
  # The path used after sign up. You need to overwrite this method
85
97
  # in your own RegistrationsController.
86
98
  def after_sign_up_path_for(resource)