devise 3.0.0 → 3.1.0
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.
Potentially problematic release.
This version of devise might be problematic. Click here for more details.
- data/{CHANGELOG.rdoc → CHANGELOG.md} +67 -25
- data/Gemfile.lock +13 -12
- data/README.md +19 -17
- data/app/controllers/devise/confirmations_controller.rb +11 -3
- data/app/controllers/devise/registrations_controller.rb +9 -3
- data/app/controllers/devise/sessions_controller.rb +1 -1
- data/app/mailers/devise/mailer.rb +6 -3
- data/app/views/devise/mailer/confirmation_instructions.html.erb +1 -1
- data/app/views/devise/mailer/reset_password_instructions.html.erb +1 -1
- data/app/views/devise/mailer/unlock_instructions.html.erb +1 -1
- data/app/views/devise/shared/_links.erb +2 -2
- data/config/locales/en.yml +4 -3
- data/devise.gemspec +1 -0
- data/gemfiles/Gemfile.rails-3.2.x.lock +47 -44
- data/lib/devise/controllers/helpers.rb +1 -0
- data/lib/devise/controllers/rememberable.rb +1 -0
- data/lib/devise/hooks/csrf_cleaner.rb +5 -0
- data/lib/devise/hooks/lockable.rb +1 -1
- data/lib/devise/hooks/rememberable.rb +2 -1
- data/lib/devise/mailers/helpers.rb +0 -6
- data/lib/devise/models/authenticatable.rb +9 -16
- data/lib/devise/models/confirmable.rb +34 -43
- data/lib/devise/models/lockable.rb +15 -17
- data/lib/devise/models/recoverable.rb +21 -27
- data/lib/devise/models/rememberable.rb +6 -2
- data/lib/devise/models/timeoutable.rb +1 -1
- data/lib/devise/models/token_authenticatable.rb +4 -1
- data/lib/devise/models.rb +8 -12
- data/lib/devise/parameter_sanitizer.rb +49 -19
- data/lib/devise/rails/routes.rb +12 -9
- data/lib/devise/rails/warden_compat.rb +10 -2
- data/lib/devise/rails.rb +7 -11
- data/lib/devise/strategies/authenticatable.rb +0 -12
- data/lib/devise/token_generator.rb +70 -0
- data/lib/devise/version.rb +1 -1
- data/lib/devise.rb +23 -12
- data/lib/generators/active_record/devise_generator.rb +2 -5
- data/lib/generators/active_record/templates/migration.rb +0 -1
- data/lib/generators/active_record/templates/migration_existing.rb +0 -1
- data/lib/generators/devise/orm_helpers.rb +25 -6
- data/lib/generators/mongoid/devise_generator.rb +2 -2
- data/lib/generators/templates/devise.rb +21 -9
- data/test/controllers/helpers_test.rb +1 -1
- data/test/controllers/passwords_controller_test.rb +4 -5
- data/test/failure_app_test.rb +1 -1
- data/test/generators/active_record_generator_test.rb +31 -1
- data/test/integration/authenticatable_test.rb +15 -1
- data/test/integration/confirmable_test.rb +29 -42
- data/test/integration/http_authenticatable_test.rb +1 -1
- data/test/integration/lockable_test.rb +11 -14
- data/test/integration/recoverable_test.rb +23 -24
- data/test/integration/rememberable_test.rb +15 -13
- data/test/mailers/confirmation_instructions_test.rb +6 -2
- data/test/mailers/reset_password_instructions_test.rb +6 -2
- data/test/mailers/unlock_instructions_test.rb +6 -2
- data/test/models/confirmable_test.rb +38 -27
- data/test/models/lockable_test.rb +15 -5
- data/test/models/recoverable_test.rb +20 -48
- data/test/models/rememberable_test.rb +8 -0
- data/test/models/timeoutable_test.rb +5 -0
- data/test/models_test.rb +0 -19
- data/test/parameter_sanitizer_test.rb +23 -9
- data/test/rails_app/config/initializers/devise.rb +3 -0
- data/test/rails_app/lib/shared_admin.rb +3 -0
- data/test/rails_app/lib/shared_user.rb +4 -0
- data/test/support/helpers.rb +0 -21
- metadata +42 -26
- data/app/views/devise/_links.erb +0 -3
@@ -1,13 +1,55 @@
|
|
1
|
+
== 3.1.0
|
2
|
+
|
3
|
+
Security announcement: http://blog.plataformatec.com.br/2013/08/devise-3-1-now-with-more-secure-defaults/
|
4
|
+
|
5
|
+
* backwards incompatible changes
|
6
|
+
* Do not store confirmation, unlock and reset password tokens directly in the database. This means tokens previously stored in the database are no longer valid. You can reenable this temporarily by setting `config.allow_insecure_tokens_lookup = true` in your configuration file. It is recommended to keep this configuration set to true just temporarily in your production servers only to aid migration
|
7
|
+
* The Devise mailer and its views were changed to explicitly receive a token argument as `@token`. You will need to update your mailers and re-copy the views to your application with `rails g devise:views`
|
8
|
+
* Sanitization of parameters should be done by calling `devise_parameter_sanitizer.sanitize(:action)` instead of `devise_parameter_sanitizer.for(:action)`
|
9
|
+
|
10
|
+
* deprecations
|
11
|
+
* Token authentication is deprecated
|
12
|
+
|
13
|
+
* enhancements
|
14
|
+
* Better security defaults
|
15
|
+
* Allow easier customization of parameter sanitizer (by @alexpeattie)
|
16
|
+
|
17
|
+
* bug fix
|
18
|
+
* Do not confirm e-mail after password reset (by @moll)
|
19
|
+
* Do not sign in after confirmation
|
20
|
+
* Do not store confirmation, unlock and reset password tokens directly in the database
|
21
|
+
* Do not compare directly against confirmation, unlock and reset password tokens
|
22
|
+
* Skip storage for cookies on unverified requests
|
23
|
+
|
24
|
+
== 3.0.2
|
25
|
+
|
26
|
+
* bug fix
|
27
|
+
* Skip storage for cookies on unverified requests
|
28
|
+
|
29
|
+
== 3.0.1
|
30
|
+
|
31
|
+
Security announcement: http://blog.plataformatec.com.br/2013/08/csrf-token-fixation-attacks-in-devise/
|
32
|
+
|
33
|
+
* enhancements
|
34
|
+
* Add after_confirmation callback
|
35
|
+
|
36
|
+
* bug fix
|
37
|
+
* When using rails 3.2, the generator adds 'attr_accessible' to the model (by @jcoyne)
|
38
|
+
* Clean up CSRF token after authentication (by @homakov). Notice this change will clean up the CSRF Token after authentication (sign in, sign up, etc). So if you are using AJAX for such features, you will need to fetch a new CSRF token from the server.
|
39
|
+
|
1
40
|
== 3.0.0
|
2
41
|
|
3
42
|
* enhancements
|
4
43
|
* Rails 4 and Strong Parameters compatibility (by @carlosantoniodasilva, @josevalim, @latortuga, @lucasmazza, @nashby, @rafaelfranca, @spastorino)
|
5
44
|
* Drop support for Rails < 3.2 and Ruby < 1.9.3
|
6
|
-
* Enable to skip sending reconfirmation email when reconfirmable is on and skip_confirmation_notification
|
45
|
+
* Enable to skip sending reconfirmation email when reconfirmable is on and `skip_confirmation_notification!` is invoked (by @tkhr)
|
7
46
|
|
8
47
|
* bug fix
|
9
48
|
* Errors on unlock are now properly reflected on the first `unlock_keys`
|
10
49
|
|
50
|
+
* backwards incompatible changes
|
51
|
+
* Changes on session storage will expire all existing sessions on upgrade
|
52
|
+
|
11
53
|
== 2.2.4
|
12
54
|
|
13
55
|
* enhancements
|
@@ -624,7 +666,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
624
666
|
* Added Registerable
|
625
667
|
* Added Http Basic Authentication support
|
626
668
|
* Allow scoped_views to be customized per controller/mailer class
|
627
|
-
*
|
669
|
+
* Allow authenticatable to used in change_table statements
|
628
670
|
|
629
671
|
== 0.9.2
|
630
672
|
|
@@ -764,19 +806,19 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
764
806
|
* Added DataMapper support
|
765
807
|
* Remove store_location from authenticatable strategy and add it to failure app
|
766
808
|
* Allow a strategy to be placed after authenticatable
|
767
|
-
*
|
809
|
+
* Do not rely attribute? methods, since they are not added on Datamapper
|
768
810
|
|
769
811
|
== 0.5.6
|
770
812
|
|
771
813
|
* enhancements
|
772
|
-
*
|
773
|
-
*
|
814
|
+
* Do not send nil to build (DataMapper compatibility)
|
815
|
+
* Allow to have scoped views
|
774
816
|
|
775
817
|
== 0.5.5
|
776
818
|
|
777
819
|
* enhancements
|
778
820
|
* Allow overwriting find for authentication method
|
779
|
-
*
|
821
|
+
* Remove Ruby 1.8.7 dependency
|
780
822
|
|
781
823
|
== 0.5.4
|
782
824
|
|
@@ -784,7 +826,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
784
826
|
* Deprecate :singular in devise_for and use :scope instead
|
785
827
|
|
786
828
|
* enhancements
|
787
|
-
*
|
829
|
+
* Create after_sign_in_path_for and after_sign_out_path_for hooks to be
|
788
830
|
overwriten in ApplicationController
|
789
831
|
* Create sign_in_and_redirect and sign_out_and_redirect helpers
|
790
832
|
* Warden::Manager.default_scope is automatically configured to the first given scope
|
@@ -796,7 +838,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
796
838
|
* Ensure all controllers are unloadable
|
797
839
|
|
798
840
|
* enhancements
|
799
|
-
*
|
841
|
+
* Moved friendly_token to Devise
|
800
842
|
* Added Devise.all, so you can freeze your app strategies
|
801
843
|
* Added Devise.apply_schema, so you can turn it to false in Datamapper or MongoMapper
|
802
844
|
in cases you don't want it be handlded automatically
|
@@ -804,9 +846,9 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
804
846
|
== 0.5.2
|
805
847
|
|
806
848
|
* enhancements
|
807
|
-
*
|
808
|
-
*
|
809
|
-
*
|
849
|
+
* Improved sign_in and sign_out helpers to accepts resources
|
850
|
+
* Added stored_location_for as a helper
|
851
|
+
* Added test helpers
|
810
852
|
|
811
853
|
== 0.5.1
|
812
854
|
|
@@ -827,7 +869,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
827
869
|
== 0.4.3
|
828
870
|
|
829
871
|
* bug fix
|
830
|
-
*
|
872
|
+
* Authentication just fails if user cannot be serialized from session, without raising errors;
|
831
873
|
* Default configuration values should not overwrite user values;
|
832
874
|
|
833
875
|
== 0.4.2
|
@@ -845,7 +887,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
845
887
|
== 0.4.1
|
846
888
|
|
847
889
|
* bug fix
|
848
|
-
*
|
890
|
+
* Ensure options can be set even if models were not loaded
|
849
891
|
|
850
892
|
== 0.4.0
|
851
893
|
|
@@ -856,25 +898,25 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
856
898
|
* :authenticable calls are deprecated, use :authenticatable instead
|
857
899
|
|
858
900
|
* enhancements
|
859
|
-
*
|
901
|
+
* Allow devise to be more agnostic and do not require ActiveRecord to be loaded
|
860
902
|
* Allow Warden::Manager to be configured through Devise
|
861
903
|
* Created a generator which creates an initializer
|
862
904
|
|
863
905
|
== 0.3.0
|
864
906
|
|
865
907
|
* bug fix
|
866
|
-
*
|
908
|
+
* Allow yml messages to be configured by not using engine locales
|
867
909
|
|
868
910
|
* deprecations
|
869
911
|
* Renamed confirm_in to confirm_within
|
870
|
-
*
|
871
|
-
*
|
912
|
+
* Do not send confirmation messages when user changes his e-mail
|
913
|
+
* Renamed authenticable to authenticatable and added deprecation warnings
|
872
914
|
|
873
915
|
== 0.2.3
|
874
916
|
|
875
917
|
* enhancements
|
876
918
|
* Ensure fail! works inside strategies
|
877
|
-
*
|
919
|
+
* Make unauthenticated message (when you haven't signed in) different from invalid message
|
878
920
|
|
879
921
|
* bug fix
|
880
922
|
* Do not redirect on invalid authenticate
|
@@ -883,7 +925,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
883
925
|
== 0.2.2
|
884
926
|
|
885
927
|
* bug fix
|
886
|
-
*
|
928
|
+
* Fix a bug when using customized resources
|
887
929
|
|
888
930
|
== 0.2.1
|
889
931
|
|
@@ -891,17 +933,17 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
891
933
|
* Clean devise_views generator to use devise existing views
|
892
934
|
|
893
935
|
* enhancements
|
894
|
-
*
|
936
|
+
* Create instance variables (like @user) for each devise controller
|
895
937
|
* Use Devise::Controller::Helpers only internally
|
896
938
|
|
897
939
|
* bug fix
|
898
|
-
*
|
940
|
+
* Fix a bug with Mongrel and Ruby 1.8.6
|
899
941
|
|
900
942
|
== 0.2.0
|
901
943
|
|
902
944
|
* enhancements
|
903
|
-
*
|
904
|
-
*
|
945
|
+
* Allow option :null => true in authenticable migration
|
946
|
+
* Remove attr_accessible calls from devise modules
|
905
947
|
* Customizable time frame for rememberable with :remember_for config
|
906
948
|
* Customizable time frame for confirmable with :confirm_in config
|
907
949
|
* Generators for creating a resource and copy views
|
@@ -910,12 +952,12 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|
910
952
|
* Do not load hooks or strategies if they are not used
|
911
953
|
|
912
954
|
* bug fixes
|
913
|
-
*
|
955
|
+
* Fixed requiring devise strategies
|
914
956
|
|
915
957
|
== 0.1.1
|
916
958
|
|
917
959
|
* bug fixes
|
918
|
-
*
|
960
|
+
* Fixed requiring devise mapping
|
919
961
|
|
920
962
|
== 0.1.0
|
921
963
|
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/mongoid/mongoid.git
|
3
|
-
revision:
|
3
|
+
revision: 346a79a7d01aa194de80e649916239a18d38ce13
|
4
4
|
branch: master
|
5
5
|
specs:
|
6
6
|
mongoid (4.0.0)
|
7
|
-
activemodel (~> 4.0.0
|
8
|
-
moped (~> 1.
|
7
|
+
activemodel (~> 4.0.0)
|
8
|
+
moped (~> 1.5)
|
9
9
|
origin (~> 1.0)
|
10
10
|
tzinfo (~> 0.3.22)
|
11
11
|
|
12
12
|
PATH
|
13
13
|
remote: .
|
14
14
|
specs:
|
15
|
-
devise (3.
|
15
|
+
devise (3.1.0)
|
16
16
|
bcrypt-ruby (~> 3.0)
|
17
17
|
orm_adapter (~> 0.1)
|
18
18
|
railties (>= 3.2.6, < 5)
|
19
|
+
thread_safe (~> 0.1)
|
19
20
|
warden (~> 1.2.3)
|
20
21
|
|
21
22
|
GEM
|
@@ -46,17 +47,17 @@ GEM
|
|
46
47
|
thread_safe (~> 0.1)
|
47
48
|
tzinfo (~> 0.3.37)
|
48
49
|
arel (4.0.0)
|
49
|
-
atomic (1.1.
|
50
|
+
atomic (1.1.12)
|
50
51
|
bcrypt-ruby (3.1.1)
|
51
52
|
builder (3.1.4)
|
52
53
|
erubis (2.7.0)
|
53
|
-
faraday (0.8.
|
54
|
-
multipart-post (~> 1.
|
54
|
+
faraday (0.8.8)
|
55
|
+
multipart-post (~> 1.2.0)
|
55
56
|
hashie (1.2.0)
|
56
57
|
hike (1.2.3)
|
57
58
|
httpauth (0.2.0)
|
58
|
-
i18n (0.6.
|
59
|
-
json (1.
|
59
|
+
i18n (0.6.5)
|
60
|
+
json (1.8.0)
|
60
61
|
jwt (0.1.8)
|
61
62
|
multi_json (>= 1.5)
|
62
63
|
mail (2.5.4)
|
@@ -67,8 +68,8 @@ GEM
|
|
67
68
|
minitest (4.7.5)
|
68
69
|
mocha (0.13.3)
|
69
70
|
metaclass (~> 0.0.1)
|
70
|
-
moped (1.
|
71
|
-
multi_json (1.7.
|
71
|
+
moped (1.5.1)
|
72
|
+
multi_json (1.7.9)
|
72
73
|
multipart-post (1.2.0)
|
73
74
|
nokogiri (1.5.9)
|
74
75
|
oauth2 (0.8.1)
|
@@ -125,7 +126,7 @@ GEM
|
|
125
126
|
sprockets (~> 2.8)
|
126
127
|
sqlite3 (1.3.7)
|
127
128
|
thor (0.18.1)
|
128
|
-
thread_safe (0.1.
|
129
|
+
thread_safe (0.1.2)
|
129
130
|
atomic
|
130
131
|
tilt (1.4.1)
|
131
132
|
treetop (1.4.14)
|
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
By [Plataformatec](http://plataformatec.com.br/).
|
4
4
|
|
5
|
-
[](http://badge.fury.io/rb/devise)
|
6
5
|
[](http://travis-ci.org/plataformatec/devise)
|
7
6
|
[](https://codeclimate.com/github/plataformatec/devise)
|
8
7
|
|
@@ -12,13 +11,12 @@ Devise is a flexible authentication solution for Rails based on Warden. It:
|
|
12
11
|
|
13
12
|
* Is Rack based;
|
14
13
|
* Is a complete MVC solution based on Rails engines;
|
15
|
-
* Allows you to have multiple
|
14
|
+
* Allows you to have multiple models signed in at the same time;
|
16
15
|
* Is based on a modularity concept: use just what you really need.
|
17
16
|
|
18
|
-
It's composed of
|
17
|
+
It's composed of 10 modules:
|
19
18
|
|
20
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.
|
21
|
-
* [Token Authenticatable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/TokenAuthenticatable): signs in a user based on an authentication token (also known as "single access token"). The token can be given both through query string or HTTP Basic Authentication.
|
22
20
|
* [Omniauthable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Omniauthable): adds Omniauth (https://github.com/intridea/omniauth) support;
|
23
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.
|
24
22
|
* [Recoverable](http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Recoverable): resets the user password and sends reset instructions.
|
@@ -188,7 +186,7 @@ There are just three actions in Devise that allows any set of parameters to be p
|
|
188
186
|
* `sign_up` (`Devise::RegistrationsController#create`) - Permits authentication keys plus `password` and `password_confirmation`
|
189
187
|
* `account_update` (`Devise::RegistrationsController#update`) - Permits authentication keys plus `password`, `password_confirmation` and `current_password`
|
190
188
|
|
191
|
-
In case you want to
|
189
|
+
In case you want to permit additional parameters (the lazy way™) you can do with a simple before filter in your `ApplicationController`:
|
192
190
|
|
193
191
|
```ruby
|
194
192
|
class ApplicationController < ActionController::Base
|
@@ -197,12 +195,20 @@ class ApplicationController < ActionController::Base
|
|
197
195
|
protected
|
198
196
|
|
199
197
|
def configure_permitted_parameters
|
200
|
-
devise_parameter_sanitizer.for(:
|
198
|
+
devise_parameter_sanitizer.for(:sign_up) << :username
|
201
199
|
end
|
202
200
|
end
|
203
201
|
```
|
204
202
|
|
205
|
-
|
203
|
+
To completely change Devise defaults or invoke custom behaviour, you can also pass a block:
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
def configure_permitted_parameters
|
207
|
+
devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :email) }
|
208
|
+
end
|
209
|
+
```
|
210
|
+
|
211
|
+
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:
|
206
212
|
|
207
213
|
```ruby
|
208
214
|
class User::ParameterSanitizer < Devise::ParameterSanitizer
|
@@ -240,7 +246,7 @@ Since Devise is an engine, all its views are packaged inside the gem. These view
|
|
240
246
|
rails generate devise:views
|
241
247
|
```
|
242
248
|
|
243
|
-
If you have more than one
|
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".
|
244
250
|
|
245
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:
|
246
252
|
|
@@ -252,7 +258,7 @@ rails generate devise:views users
|
|
252
258
|
|
253
259
|
If the customization at the views level is not enough, you can customize each controller by following these steps:
|
254
260
|
|
255
|
-
1. Create your custom controller, for example a `Admins::SessionsController`:
|
261
|
+
1. Create your custom controller, for example a `Admins::SessionsController`:
|
256
262
|
|
257
263
|
```ruby
|
258
264
|
class Admins::SessionsController < Devise::SessionsController
|
@@ -384,7 +390,7 @@ You can read more about Omniauth support in the wiki:
|
|
384
390
|
|
385
391
|
### Configuring multiple models
|
386
392
|
|
387
|
-
Devise allows you to set up as many
|
393
|
+
Devise allows you to set up as many Devise models as you want. If you want to have an Admin model with just authentication and timeout features, in addition to the User model above, just run:
|
388
394
|
|
389
395
|
```ruby
|
390
396
|
# Create a migration with the required fields
|
@@ -409,7 +415,9 @@ current_admin
|
|
409
415
|
admin_session
|
410
416
|
```
|
411
417
|
|
412
|
-
|
418
|
+
Alternatively, you can simply run the Devise generator.
|
419
|
+
|
420
|
+
Keep in mind that those models will have completely different routes. They **do not** and **cannot** share the same controller for sign in, sign out and so on. In case you want to have different roles sharing the same actions, we recommend you to use a role-based approach, by either providing a role column or using [CanCan](https://github.com/ryanb/cancan).
|
413
421
|
|
414
422
|
### Other ORMs
|
415
423
|
|
@@ -439,12 +447,6 @@ We have a long list of valued contributors. Check them all at:
|
|
439
447
|
|
440
448
|
https://github.com/plataformatec/devise/contributors
|
441
449
|
|
442
|
-
### Maintainers
|
443
|
-
|
444
|
-
* José Valim (https://github.com/josevalim)
|
445
|
-
* Carlos Antônio da Silva (https://github.com/carlosantoniodasilva)
|
446
|
-
* Rodrigo Flores (https://github.com/rodrigoflores)
|
447
|
-
|
448
450
|
## License
|
449
451
|
|
450
452
|
MIT License. Copyright 2009-2013 Plataformatec. http://plataformatec.com.br
|
@@ -20,8 +20,12 @@ class Devise::ConfirmationsController < DeviseController
|
|
20
20
|
self.resource = resource_class.confirm_by_token(params[:confirmation_token])
|
21
21
|
|
22
22
|
if resource.errors.empty?
|
23
|
-
|
24
|
-
|
23
|
+
if Devise.allow_insecure_sign_in_after_confirmation
|
24
|
+
set_flash_message(:notice, :confirmed_and_signed_in) if is_navigational_format?
|
25
|
+
sign_in(resource_name, resource)
|
26
|
+
else
|
27
|
+
set_flash_message(:notice, :confirmed) if is_navigational_format?
|
28
|
+
end
|
25
29
|
respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
|
26
30
|
else
|
27
31
|
respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new }
|
@@ -37,6 +41,10 @@ class Devise::ConfirmationsController < DeviseController
|
|
37
41
|
|
38
42
|
# The path used after confirmation.
|
39
43
|
def after_confirmation_path_for(resource_name, resource)
|
40
|
-
|
44
|
+
if Devise.allow_insecure_sign_in_after_confirmation
|
45
|
+
after_sign_in_path_for(resource)
|
46
|
+
else
|
47
|
+
new_session_path(resource_name)
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|
@@ -40,7 +40,7 @@ class Devise::RegistrationsController < DeviseController
|
|
40
40
|
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
|
41
41
|
prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)
|
42
42
|
|
43
|
-
if resource
|
43
|
+
if update_resource(resource, account_update_params)
|
44
44
|
if is_navigational_format?
|
45
45
|
flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
|
46
46
|
:update_needs_confirmation : :updated
|
@@ -80,6 +80,12 @@ class Devise::RegistrationsController < DeviseController
|
|
80
80
|
previous != resource.unconfirmed_email
|
81
81
|
end
|
82
82
|
|
83
|
+
# By default we want to require a password checks on update.
|
84
|
+
# You can overwrite this method in your own RegistrationsController.
|
85
|
+
def update_resource(resource, params)
|
86
|
+
resource.update_with_password(params)
|
87
|
+
end
|
88
|
+
|
83
89
|
# Build a devise resource passing in the session. Useful to move
|
84
90
|
# temporary session data to the newly created user.
|
85
91
|
def build_resource(hash=nil)
|
@@ -117,10 +123,10 @@ class Devise::RegistrationsController < DeviseController
|
|
117
123
|
end
|
118
124
|
|
119
125
|
def sign_up_params
|
120
|
-
devise_parameter_sanitizer.
|
126
|
+
devise_parameter_sanitizer.sanitize(:sign_up)
|
121
127
|
end
|
122
128
|
|
123
129
|
def account_update_params
|
124
|
-
devise_parameter_sanitizer.
|
130
|
+
devise_parameter_sanitizer.sanitize(:account_update)
|
125
131
|
end
|
126
132
|
end
|
@@ -1,15 +1,18 @@
|
|
1
1
|
class Devise::Mailer < Devise.parent_mailer.constantize
|
2
2
|
include Devise::Mailers::Helpers
|
3
3
|
|
4
|
-
def confirmation_instructions(record, opts={})
|
4
|
+
def confirmation_instructions(record, token, opts={})
|
5
|
+
@token = token
|
5
6
|
devise_mail(record, :confirmation_instructions, opts)
|
6
7
|
end
|
7
8
|
|
8
|
-
def reset_password_instructions(record, opts={})
|
9
|
+
def reset_password_instructions(record, token, opts={})
|
10
|
+
@token = token
|
9
11
|
devise_mail(record, :reset_password_instructions, opts)
|
10
12
|
end
|
11
13
|
|
12
|
-
def unlock_instructions(record, opts={})
|
14
|
+
def unlock_instructions(record, token, opts={})
|
15
|
+
@token = token
|
13
16
|
devise_mail(record, :unlock_instructions, opts)
|
14
17
|
end
|
15
18
|
end
|
@@ -2,4 +2,4 @@
|
|
2
2
|
|
3
3
|
<p>You can confirm your account email through the link below:</p>
|
4
4
|
|
5
|
-
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @
|
5
|
+
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %></p>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
4
4
|
|
5
|
-
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @
|
5
|
+
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %></p>
|
6
6
|
|
7
7
|
<p>If you didn't request this, please ignore this email.</p>
|
8
8
|
<p>Your password won't change until you access the link above and create a new one.</p>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
7
7
|
<% end -%>
|
8
8
|
|
9
|
-
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
10
10
|
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
11
11
|
<% end -%>
|
12
12
|
|
@@ -22,4 +22,4 @@
|
|
22
22
|
<%- resource_class.omniauth_providers.each do |provider| %>
|
23
23
|
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
|
24
24
|
<% end -%>
|
25
|
-
<% end -%>
|
25
|
+
<% end -%>
|
data/config/locales/en.yml
CHANGED
@@ -3,17 +3,18 @@
|
|
3
3
|
en:
|
4
4
|
devise:
|
5
5
|
confirmations:
|
6
|
-
confirmed: "Your account was successfully confirmed.
|
6
|
+
confirmed: "Your account was successfully confirmed. Please sign in."
|
7
|
+
confirmed_and_signed_in: "Your account was successfully confirmed. You are now signed in."
|
7
8
|
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
|
8
9
|
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
|
9
10
|
failure:
|
10
11
|
already_authenticated: "You are already signed in."
|
11
|
-
inactive: "Your account
|
12
|
+
inactive: "Your account is not activated yet."
|
12
13
|
invalid: "Invalid email or password."
|
13
14
|
invalid_token: "Invalid authentication token."
|
14
15
|
locked: "Your account is locked."
|
15
16
|
not_found_in_database: "Invalid email or password."
|
16
|
-
timeout: "Your session expired
|
17
|
+
timeout: "Your session expired. Please sign in again to continue."
|
17
18
|
unauthenticated: "You need to sign in or sign up before continuing."
|
18
19
|
unconfirmed: "You have to confirm your account before continuing."
|
19
20
|
mailer:
|
data/devise.gemspec
CHANGED