devise 3.5.10 → 4.0.0.rc1

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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -9
  3. data/CHANGELOG.md +33 -1188
  4. data/Gemfile +0 -1
  5. data/Gemfile.lock +15 -18
  6. data/MIT-LICENSE +1 -1
  7. data/README.md +20 -10
  8. data/app/controllers/devise/omniauth_callbacks_controller.rb +4 -4
  9. data/app/controllers/devise/passwords_controller.rb +2 -2
  10. data/app/controllers/devise/registrations_controller.rb +2 -2
  11. data/app/controllers/devise/sessions_controller.rb +4 -4
  12. data/app/controllers/devise/unlocks_controller.rb +1 -1
  13. data/app/controllers/devise_controller.rb +11 -7
  14. data/devise.gemspec +2 -3
  15. data/gemfiles/Gemfile.rails-4.1-stable +0 -1
  16. data/gemfiles/Gemfile.rails-4.1-stable.lock +38 -41
  17. data/gemfiles/Gemfile.rails-4.2-stable +0 -1
  18. data/gemfiles/Gemfile.rails-4.2-stable.lock +47 -50
  19. data/gemfiles/Gemfile.rails-5.0-beta +37 -0
  20. data/gemfiles/Gemfile.rails-5.0-beta.lock +242 -0
  21. data/lib/devise.rb +8 -8
  22. data/lib/devise/controllers/helpers.rb +7 -11
  23. data/lib/devise/failure_app.rb +17 -9
  24. data/lib/devise/models/authenticatable.rb +5 -1
  25. data/lib/devise/models/confirmable.rb +3 -4
  26. data/lib/devise/models/database_authenticatable.rb +1 -0
  27. data/lib/devise/models/lockable.rb +1 -5
  28. data/lib/devise/models/rememberable.rb +5 -11
  29. data/lib/devise/parameter_sanitizer.rb +176 -61
  30. data/lib/devise/rails.rb +1 -10
  31. data/lib/devise/rails/routes.rb +25 -14
  32. data/lib/devise/rails/warden_compat.rb +1 -10
  33. data/lib/devise/strategies/rememberable.rb +6 -3
  34. data/lib/devise/test_helpers.rb +9 -4
  35. data/lib/devise/token_generator.rb +1 -41
  36. data/lib/devise/version.rb +1 -1
  37. data/lib/generators/active_record/devise_generator.rb +3 -3
  38. data/lib/generators/active_record/templates/migration.rb +1 -1
  39. data/lib/generators/active_record/templates/migration_existing.rb +1 -1
  40. data/lib/generators/devise/orm_helpers.rb +0 -17
  41. data/lib/generators/templates/controllers/registrations_controller.rb +4 -4
  42. data/lib/generators/templates/controllers/sessions_controller.rb +2 -2
  43. data/lib/generators/templates/devise.rb +4 -5
  44. data/test/controllers/custom_registrations_controller_test.rb +5 -5
  45. data/test/controllers/custom_strategy_test.rb +7 -5
  46. data/test/controllers/helper_methods_test.rb +3 -2
  47. data/test/controllers/helpers_test.rb +1 -1
  48. data/test/controllers/inherited_controller_i18n_messages_test.rb +2 -2
  49. data/test/controllers/internal_helpers_test.rb +8 -10
  50. data/test/controllers/load_hooks_controller_test.rb +1 -1
  51. data/test/controllers/passwords_controller_test.rb +4 -3
  52. data/test/controllers/sessions_controller_test.rb +21 -18
  53. data/test/controllers/url_helpers_test.rb +1 -1
  54. data/test/failure_app_test.rb +19 -14
  55. data/test/generators/active_record_generator_test.rb +0 -26
  56. data/test/helpers/devise_helper_test.rb +1 -1
  57. data/test/integration/authenticatable_test.rb +18 -18
  58. data/test/integration/confirmable_test.rb +5 -5
  59. data/test/integration/database_authenticatable_test.rb +1 -1
  60. data/test/integration/http_authenticatable_test.rb +4 -5
  61. data/test/integration/lockable_test.rb +4 -3
  62. data/test/integration/omniauthable_test.rb +1 -1
  63. data/test/integration/recoverable_test.rb +10 -10
  64. data/test/integration/registerable_test.rb +9 -11
  65. data/test/integration/rememberable_test.rb +7 -43
  66. data/test/integration/timeoutable_test.rb +4 -4
  67. data/test/integration/trackable_test.rb +1 -1
  68. data/test/models/confirmable_test.rb +5 -13
  69. data/test/models/lockable_test.rb +0 -22
  70. data/test/models/rememberable_test.rb +0 -12
  71. data/test/models/validatable_test.rb +2 -10
  72. data/test/omniauth/url_helpers_test.rb +1 -2
  73. data/test/orm/active_record.rb +6 -1
  74. data/test/parameter_sanitizer_test.rb +103 -53
  75. data/test/rails_app/app/active_record/user.rb +3 -0
  76. data/test/rails_app/app/controllers/admins_controller.rb +1 -1
  77. data/test/rails_app/app/controllers/application_controller.rb +2 -2
  78. data/test/rails_app/app/controllers/home_controller.rb +5 -1
  79. data/test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb +2 -2
  80. data/test/rails_app/app/controllers/users_controller.rb +5 -5
  81. data/test/rails_app/config/application.rb +1 -1
  82. data/test/rails_app/config/boot.rb +3 -3
  83. data/test/rails_app/config/environments/test.rb +6 -1
  84. data/test/rails_app/config/initializers/secret_token.rb +1 -6
  85. data/test/routes_test.rb +26 -11
  86. data/test/support/http_method_compatibility.rb +51 -0
  87. data/test/support/webrat/integrations/rails.rb +9 -0
  88. data/test/test_helpers_test.rb +3 -3
  89. metadata +13 -31
  90. data/gemfiles/Gemfile.rails-3.2-stable +0 -29
  91. data/gemfiles/Gemfile.rails-3.2-stable.lock +0 -172
  92. data/gemfiles/Gemfile.rails-4.0-stable +0 -30
  93. data/gemfiles/Gemfile.rails-4.0-stable.lock +0 -166
  94. data/script/cached-bundle +0 -49
  95. data/script/s3-put +0 -71
  96. data/test/time_helpers.rb +0 -137
@@ -1,166 +0,0 @@
1
- GIT
2
- remote: git://github.com/rails/rails.git
3
- revision: 9be9597e510d185ca7964d0a05b4ea2a7f2d50d1
4
- branch: 4-0-stable
5
- specs:
6
- actionmailer (4.0.13)
7
- actionpack (= 4.0.13)
8
- mail (~> 2.5, >= 2.5.4)
9
- actionpack (4.0.13)
10
- activesupport (= 4.0.13)
11
- builder (~> 3.1.0)
12
- erubis (~> 2.7.0)
13
- rack (~> 1.5.2)
14
- rack-test (~> 0.6.2)
15
- activemodel (4.0.13)
16
- activesupport (= 4.0.13)
17
- builder (~> 3.1.0)
18
- activerecord (4.0.13)
19
- activemodel (= 4.0.13)
20
- activerecord-deprecated_finders (~> 1.0.2)
21
- activesupport (= 4.0.13)
22
- arel (~> 4.0.0)
23
- activesupport (4.0.13)
24
- i18n (~> 0.6, >= 0.6.9)
25
- minitest (~> 4.2)
26
- multi_json (~> 1.3)
27
- thread_safe (~> 0.1)
28
- tzinfo (~> 0.3.37)
29
- rails (4.0.13)
30
- actionmailer (= 4.0.13)
31
- actionpack (= 4.0.13)
32
- activerecord (= 4.0.13)
33
- activesupport (= 4.0.13)
34
- bundler (>= 1.3.0, < 2.0)
35
- railties (= 4.0.13)
36
- sprockets-rails (~> 2.0)
37
- railties (4.0.13)
38
- actionpack (= 4.0.13)
39
- activesupport (= 4.0.13)
40
- rake (>= 0.8.7)
41
- thor (>= 0.18.1, < 2.0)
42
-
43
- PATH
44
- remote: ..
45
- specs:
46
- devise (3.5.8)
47
- bcrypt (~> 3.0)
48
- orm_adapter (~> 0.1)
49
- railties (>= 3.2.6, < 5)
50
- responders
51
- thread_safe (~> 0.1)
52
- warden (~> 1.2.3)
53
-
54
- GEM
55
- remote: https://rubygems.org/
56
- specs:
57
- activerecord-deprecated_finders (1.0.4)
58
- arel (4.0.2)
59
- bcrypt (3.1.11)
60
- bson (3.2.6)
61
- builder (3.1.4)
62
- concurrent-ruby (1.0.1)
63
- connection_pool (2.2.0)
64
- erubis (2.7.0)
65
- faraday (0.9.2)
66
- multipart-post (>= 1.2, < 3)
67
- hashie (3.4.3)
68
- i18n (0.7.0)
69
- json (1.8.3)
70
- jwt (1.5.4)
71
- mail (2.6.4)
72
- mime-types (>= 1.16, < 4)
73
- metaclass (0.0.4)
74
- mime-types (2.99.1)
75
- mini_portile2 (2.0.0)
76
- minitest (4.7.5)
77
- mocha (1.1.0)
78
- metaclass (~> 0.0.1)
79
- mongoid (4.0.2)
80
- activemodel (~> 4.0)
81
- moped (~> 2.0.0)
82
- origin (~> 2.1)
83
- tzinfo (>= 0.3.37)
84
- moped (2.0.7)
85
- bson (~> 3.0)
86
- connection_pool (~> 2.0)
87
- optionable (~> 0.2.0)
88
- multi_json (1.11.3)
89
- multi_xml (0.5.5)
90
- multipart-post (2.0.0)
91
- nokogiri (1.6.7.2)
92
- mini_portile2 (~> 2.0.0.rc2)
93
- oauth2 (0.9.4)
94
- faraday (>= 0.8, < 0.10)
95
- jwt (~> 1.0)
96
- multi_json (~> 1.3)
97
- multi_xml (~> 0.5)
98
- rack (~> 1.2)
99
- omniauth (1.2.2)
100
- hashie (>= 1.2, < 4)
101
- rack (~> 1.0)
102
- omniauth-facebook (1.6.0)
103
- omniauth-oauth2 (~> 1.1)
104
- omniauth-oauth2 (1.1.2)
105
- faraday (>= 0.8, < 0.10)
106
- multi_json (~> 1.3)
107
- oauth2 (~> 0.9.3)
108
- omniauth (~> 1.2)
109
- omniauth-openid (1.0.1)
110
- omniauth (~> 1.0)
111
- rack-openid (~> 1.3.1)
112
- optionable (0.2.0)
113
- origin (2.2.0)
114
- orm_adapter (0.5.0)
115
- rack (1.5.5)
116
- rack-openid (1.3.1)
117
- rack (>= 1.1.0)
118
- ruby-openid (>= 2.1.8)
119
- rack-test (0.6.3)
120
- rack (>= 1.0)
121
- rake (11.1.2)
122
- rdoc (4.2.2)
123
- json (~> 1.4)
124
- responders (1.1.2)
125
- railties (>= 3.2, < 4.2)
126
- ruby-openid (2.7.0)
127
- sprockets (3.6.0)
128
- concurrent-ruby (~> 1.0)
129
- rack (> 1, < 3)
130
- sprockets-rails (2.3.3)
131
- actionpack (>= 3.0)
132
- activesupport (>= 3.0)
133
- sprockets (>= 2.8, < 4.0)
134
- sqlite3 (1.3.11)
135
- thor (0.19.1)
136
- thread_safe (0.3.5)
137
- tzinfo (0.3.49)
138
- warden (1.2.6)
139
- rack (>= 1.0)
140
- webrat (0.7.3)
141
- nokogiri (>= 1.2.0)
142
- rack (>= 1.0)
143
- rack-test (>= 0.5.3)
144
-
145
- PLATFORMS
146
- ruby
147
-
148
- DEPENDENCIES
149
- activerecord-jdbc-adapter
150
- activerecord-jdbcsqlite3-adapter
151
- devise!
152
- jruby-openssl
153
- mime-types (~> 2.99)
154
- mocha (~> 1.1)
155
- mongoid (~> 4.0.0)
156
- omniauth (~> 1.2.0)
157
- omniauth-facebook
158
- omniauth-oauth2 (~> 1.1.0)
159
- omniauth-openid (~> 1.0.1)
160
- rails!
161
- rdoc
162
- sqlite3
163
- webrat (= 0.7.3)
164
-
165
- BUNDLED WITH
166
- 1.11.2
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Usage: cached-bundle install --deployment
3
- #
4
- # After running `bundle`, caches the `vendor/bundle` directory to S3.
5
- # On the next run, restores the cached directory before running `bundle`.
6
- # When `Gemfile.lock` changes, the cache gets rebuilt.
7
- #
8
- # Requirements:
9
- # - Gemfile.lock
10
- # - TRAVIS_REPO_SLUG
11
- # - TRAVIS_RUBY_VERSION
12
- # - AMAZON_S3_BUCKET
13
- # - script/s3-put
14
- # - bundle
15
- # - curl
16
- #
17
- # Author: Mislav Marohnić
18
-
19
- set -e
20
-
21
- compute_md5() {
22
- local output="$(openssl md5)"
23
- echo "${output##* }"
24
- }
25
-
26
- download() {
27
- curl --tcp-nodelay -qsfL "$1" -o "$2"
28
- }
29
-
30
-
31
- gemfile="${BUNDLE_GEMFILE:-Gemfile}"
32
- bundle_fullpath="$(dirname $gemfile)/vendor/bundle"
33
- bundle_path=${bundle_fullpath#$PWD/}
34
- gemfile_hash="$(compute_md5 <"${gemfile}.lock")"
35
- cache_name="${TRAVIS_RUBY_VERSION}-${gemfile_hash}.tgz"
36
- fetch_url="http://${AMAZON_S3_BUCKET}.s3.amazonaws.com/${TRAVIS_REPO_SLUG}/${cache_name}"
37
-
38
- if download "$fetch_url" "$cache_name"; then
39
- echo "Reusing cached bundle ${cache_name}"
40
- tar xzf "$cache_name"
41
- fi
42
-
43
- bundle "$@"
44
-
45
- if [ ! -f "$cache_name" ] && [ -n "$AMAZON_SECRET_ACCESS_KEY" ]; then
46
- echo "Caching \`${bundle_path}' to S3"
47
- tar czf "$cache_name" "$bundle_path"
48
- script/s3-put "$cache_name" "${AMAZON_S3_BUCKET}:${TRAVIS_REPO_SLUG}/${cache_name}"
49
- fi
@@ -1,71 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Usage: s3-put <FILE> <S3_BUCKET>[:<PATH>] [<CONTENT_TYPE>]
3
- #
4
- # Uploads a file to the Amazon S3 service.
5
- # Outputs the URL for the newly uploaded file.
6
- #
7
- # Requirements:
8
- # - AMAZON_ACCESS_KEY_ID
9
- # - AMAZON_SECRET_ACCESS_KEY
10
- # - openssl
11
- # - curl
12
- #
13
- # Author: Mislav Marohnić
14
-
15
- set -e
16
-
17
- authorization() {
18
- local signature="$(string_to_sign | hmac_sha1 | base64)"
19
- echo "AWS ${AMAZON_ACCESS_KEY_ID?}:${signature}"
20
- }
21
-
22
- hmac_sha1() {
23
- openssl dgst -binary -sha1 -hmac "${AMAZON_SECRET_ACCESS_KEY?}"
24
- }
25
-
26
- base64() {
27
- openssl enc -base64
28
- }
29
-
30
- bin_md5() {
31
- openssl dgst -binary -md5
32
- }
33
-
34
- string_to_sign() {
35
- echo "$http_method"
36
- echo "$content_md5"
37
- echo "$content_type"
38
- echo "$date"
39
- echo "x-amz-acl:$acl"
40
- printf "/$bucket/$remote_path"
41
- }
42
-
43
- date_string() {
44
- LC_TIME=C date "+%a, %d %h %Y %T %z"
45
- }
46
-
47
- file="$1"
48
- bucket="${2%%:*}"
49
- remote_path="${2#*:}"
50
- content_type="$3"
51
-
52
- if [ -z "$remote_path" ] || [ "$remote_path" = "$bucket" ]; then
53
- remote_path="${file##*/}"
54
- fi
55
-
56
- http_method=PUT
57
- acl="public-read"
58
- content_md5="$(bin_md5 < "$file" | base64)"
59
- date="$(date_string)"
60
-
61
- url="https://$bucket.s3.amazonaws.com/$remote_path"
62
-
63
- curl -qsSf -T "$file" \
64
- -H "Authorization: $(authorization)" \
65
- -H "x-amz-acl: $acl" \
66
- -H "Date: $date" \
67
- -H "Content-MD5: $content_md5" \
68
- -H "Content-Type: $content_type" \
69
- "$url"
70
-
71
- echo "$url"
@@ -1,137 +0,0 @@
1
- # A copy of Rails time helpers. With this file we can support the `travel_to`
2
- # helper for Rails versions prior 4.1.
3
- # File origin: https://github.com/rails/rails/blob/52ce6ece8c8f74064bb64e0a0b1ddd83092718e1/activesupport/lib/active_support/testing/time_helpers.rb
4
- module ActiveSupport
5
- module Testing
6
- class SimpleStubs # :nodoc:
7
- Stub = Struct.new(:object, :method_name, :original_method)
8
-
9
- def initialize
10
- @stubs = {}
11
- end
12
-
13
- def stub_object(object, method_name, return_value)
14
- key = [object.object_id, method_name]
15
-
16
- if stub = @stubs[key]
17
- unstub_object(stub)
18
- end
19
-
20
- new_name = "__simple_stub__#{method_name}"
21
-
22
- @stubs[key] = Stub.new(object, method_name, new_name)
23
-
24
- object.singleton_class.send :alias_method, new_name, method_name
25
- object.define_singleton_method(method_name) { return_value }
26
- end
27
-
28
- def unstub_all!
29
- @stubs.each_value do |stub|
30
- unstub_object(stub)
31
- end
32
- @stubs = {}
33
- end
34
-
35
- private
36
-
37
- def unstub_object(stub)
38
- singleton_class = stub.object.singleton_class
39
- singleton_class.send :undef_method, stub.method_name
40
- singleton_class.send :alias_method, stub.method_name, stub.original_method
41
- singleton_class.send :undef_method, stub.original_method
42
- end
43
- end
44
-
45
- # Contains helpers that help you test passage of time.
46
- module TimeHelpers
47
- # Changes current time to the time in the future or in the past by a given time difference by
48
- # stubbing +Time.now+, +Date.today+, and +DateTime.now+.
49
- #
50
- # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
51
- # travel 1.day
52
- # Time.current # => Sun, 10 Nov 2013 15:34:49 EST -05:00
53
- # Date.current # => Sun, 10 Nov 2013
54
- # DateTime.current # => Sun, 10 Nov 2013 15:34:49 -0500
55
- #
56
- # This method also accepts a block, which will return the current time back to its original
57
- # state at the end of the block:
58
- #
59
- # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
60
- # travel 1.day do
61
- # User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00
62
- # end
63
- # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
64
- def travel(duration, &block)
65
- travel_to Time.now + duration, &block
66
- end
67
-
68
- # Changes current time to the given time by stubbing +Time.now+,
69
- # +Date.today+, and +DateTime.now+ to return the time or date passed into this method.
70
- #
71
- # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
72
- # travel_to Time.new(2004, 11, 24, 01, 04, 44)
73
- # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
74
- # Date.current # => Wed, 24 Nov 2004
75
- # DateTime.current # => Wed, 24 Nov 2004 01:04:44 -0500
76
- #
77
- # Dates are taken as their timestamp at the beginning of the day in the
78
- # application time zone. <tt>Time.current</tt> returns said timestamp,
79
- # and <tt>Time.now</tt> its equivalent in the system time zone. Similarly,
80
- # <tt>Date.current</tt> returns a date equal to the argument, and
81
- # <tt>Date.today</tt> the date according to <tt>Time.now</tt>, which may
82
- # be different. (Note that you rarely want to deal with <tt>Time.now</tt>,
83
- # or <tt>Date.today</tt>, in order to honor the application time zone
84
- # please always use <tt>Time.current</tt> and <tt>Date.current</tt>.)
85
- #
86
- # Note that the usec for the time passed will be set to 0 to prevent rounding
87
- # errors with external services, like MySQL (which will round instead of floor,
88
- # leading to off-by-one-second errors).
89
- #
90
- # This method also accepts a block, which will return the current time back to its original
91
- # state at the end of the block:
92
- #
93
- # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
94
- # travel_to Time.new(2004, 11, 24, 01, 04, 44) do
95
- # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
96
- # end
97
- # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
98
- def travel_to(date_or_time)
99
- if date_or_time.is_a?(Date) && !date_or_time.is_a?(DateTime)
100
- now = date_or_time.midnight.to_time
101
- else
102
- now = date_or_time.to_time.change(usec: 0)
103
- end
104
-
105
- simple_stubs.stub_object(Time, :now, now)
106
- simple_stubs.stub_object(Date, :today, now.to_date)
107
- simple_stubs.stub_object(DateTime, :now, now.to_datetime)
108
-
109
- if block_given?
110
- begin
111
- yield
112
- ensure
113
- travel_back
114
- end
115
- end
116
- end
117
-
118
- # Returns the current time back to its original state, by removing the stubs added by
119
- # `travel` and `travel_to`.
120
- #
121
- # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
122
- # travel_to Time.new(2004, 11, 24, 01, 04, 44)
123
- # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
124
- # travel_back
125
- # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
126
- def travel_back
127
- simple_stubs.unstub_all!
128
- end
129
-
130
- private
131
-
132
- def simple_stubs
133
- @simple_stubs ||= SimpleStubs.new
134
- end
135
- end
136
- end
137
- end