devise 4.6.0 → 4.7.0

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f89e0e322bb87fda7dfb21c558c38138065368ba
4
- data.tar.gz: 88f2a5d3e8aeddaf2dd1a9dc6f6a366cf4b3a3ef
3
+ metadata.gz: 99f73a79ce1b893707bf43346c57fb609226ffdc
4
+ data.tar.gz: 0ab35ec0e647610f96a0a1357b93686237c3a419
5
5
  SHA512:
6
- metadata.gz: 40734474103c3aabd38dfae149a0f38d690d30ac2aa465510869616338a2968ab9f5a128f3263ca34009fb98b7bbb3b4bcd344119532bb56f459d23b3e6d326c
7
- data.tar.gz: 80a1ef0816372c91f91ad27389b1abbe21c80d76ade44f9afce5ef1221b21b195466b1fe74a8a78bc20e70772eeacda06f7b7d06a208355fbf0f858ad3de33e7
6
+ metadata.gz: 385e26f7d0dcf2baed0879a24a445d0758682c5ff42b6b89fda4233b130b40f1eb64bb4fa0a860d4615d4966995504827cd384067b8544feab48958861c9d6be
7
+ data.tar.gz: 3696165b16b2f312d83a67036c4cb930e5ebd3be42103b6d60f5fb09504d3ff40e1d804758faf5a2606beb497ddfb8f62d4b293aa4648d458925deecf7cdd2b9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 4.7.0 - 2019-08-19
4
+
5
+ * enhancements
6
+ * Support Rails 6.0
7
+ * Update CI to rails 6.0.0.beta3 (by @tunnes)
8
+ * refactor method name to be more consistent (by @saiqulhaq)
9
+ * Fix rails 6.0.rc1 email uniqueness validation deprecation warning (by @Vasfed)
10
+
11
+ * bug fixes
12
+ * Add `autocomplete="new-password"` to `password_confirmation` fields (by @ferrl)
13
+ * Fix rails_51_and_up? method for Rails 6.rc1 (by @igorkasyanchuk)
14
+
15
+ ### 4.6.2 - 2019-03-26
16
+
17
+ * bug fixes
18
+ * Revert "Set `encrypted_password` to `nil` when `password` is set to `nil`" since it broke backward compatibility with existing applications. See more on https://github.com/plataformatec/devise/issues/5033#issuecomment-476386275 (by @mracos)
19
+
20
+ ### 4.6.1 - 2019-02-11
21
+
22
+ * bug fixes
23
+ * Check if `root_path` is defined with `#respond_to?` instead of `#present` (by @tegon)
24
+
3
25
  ### 4.6.0 - 2019-02-07
4
26
 
5
27
  * enhancements
data/README.md CHANGED
@@ -56,6 +56,7 @@ It's composed of 10 modules:
56
56
  - [ActiveJob Integration](#activejob-integration)
57
57
  - [Password reset tokens and Rails logs](#password-reset-tokens-and-rails-logs)
58
58
  - [Other ORMs](#other-orms)
59
+ - [Rails API mode](#rails-api-mode)
59
60
  - [Additional information](#additional-information)
60
61
  - [Heroku](#heroku)
61
62
  - [Warden](#warden)
@@ -173,7 +174,7 @@ If you are building your first Rails application, we recommend you *do not* use
173
174
 
174
175
  * Michael Hartl's online book: https://www.railstutorial.org/book/modeling_users
175
176
  * Ryan Bates' Railscast: http://railscasts.com/episodes/250-authentication-from-scratch
176
- * Codecademy's Ruby on Rails: Authentication and Authorization: http://www.codecademy.com/en/learn/rails-auth
177
+ * Codecademy's Ruby on Rails: Authentication and Authorization: https://www.codecademy.com/learn/rails-auth
177
178
 
178
179
  Once you have solidified your understanding of Rails and authentication mechanisms, we assure you Devise will be very pleasant to work with. :smiley:
179
180
 
@@ -619,7 +620,7 @@ are executed in your tests.
619
620
 
620
621
  You can read more about testing your Rails 3 - Rails 4 controllers with RSpec in the wiki:
621
622
 
622
- * https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-3-and-4-%28and-RSpec%29
623
+ * https://github.com/plataformatec/devise/wiki/How-To:-Test-controllers-with-Rails-(and-RSpec)
623
624
 
624
625
  ### OmniAuth
625
626
 
@@ -694,6 +695,17 @@ config.log_level = :warn
694
695
 
695
696
  Devise supports ActiveRecord (default) and Mongoid. To select another ORM, simply require it in the initializer file.
696
697
 
698
+ ### Rails API Mode
699
+
700
+ Rails 5+ has a built-in [API Mode](https://edgeguides.rubyonrails.org/api_app.html) which optimizes Rails for use as an API (only). One of the side effects is that it changes the order of the middleware stack, and this can cause problems for `Devise::Test::IntegrationHelpers`. This problem usually surfaces as an ```undefined method `[]=' for nil:NilClass``` error when using integration test helpers, such as `#sign_in`. The solution is simply to reorder the middlewares by adding the following to test.rb:
701
+
702
+ ```ruby
703
+ Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Cookies
704
+ Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Session::CookieStore
705
+ ```
706
+
707
+ For a deeper understanding of this, review [this issue](https://github.com/plataformatec/devise/issues/4696).
708
+
697
709
  ## Additional information
698
710
 
699
711
  ### Heroku
@@ -720,6 +732,6 @@ https://github.com/plataformatec/devise/graphs/contributors
720
732
 
721
733
  ## License
722
734
 
723
- MIT License. Copyright 2009-2018 Plataformatec. http://plataformatec.com.br
735
+ MIT License. Copyright 2009-2019 Plataformatec. http://plataformatec.com.br
724
736
 
725
737
  You are not granted rights or licenses to the trademarks of Plataformatec, including without limitation the Devise name or logo.
@@ -14,7 +14,7 @@
14
14
 
15
15
  <div class="field">
16
16
  <%= f.label :password_confirmation, "Confirm new password" %><br />
17
- <%= f.password_field :password_confirmation, autocomplete: "off" %>
17
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
18
18
  </div>
19
19
 
20
20
  <div class="actions">
@@ -153,7 +153,7 @@ module Devise
153
153
  # We need to add the rootpath to `script_name` manually for applications that use a Rails
154
154
  # version lower than 5.1. Otherwise, it is going to generate a wrong path for Engines
155
155
  # that use Devise. Remove it when the support of Rails 5.0 is droped.
156
- elsif root_path_defined?(context) && rails_5_and_down?
156
+ elsif root_path_defined?(context) && !rails_51_and_up?
157
157
  rootpath = context.routes.url_helpers.root_path
158
158
  opts[:script_name] = rootpath.chomp('/') if rootpath.length > 1
159
159
  end
@@ -275,17 +275,11 @@ module Devise
275
275
  private
276
276
 
277
277
  def root_path_defined?(context)
278
- defined?(context.routes) && context.routes.url_helpers.root_path.present?
278
+ defined?(context.routes) && context.routes.url_helpers.respond_to?(:root_path)
279
279
  end
280
280
 
281
- def rails_5_and_down?
282
- return false if rails_5_up?
283
-
284
- Rails::VERSION::MAJOR >= 4
285
- end
286
-
287
- def rails_5_up?
288
- Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR > 0
281
+ def rails_51_and_up?
282
+ Rails.gem_version >= Gem::Version.new("5.1")
289
283
  end
290
284
  end
291
285
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_model/version'
4
3
  require 'devise/hooks/activatable'
5
4
  require 'devise/hooks/csrf_cleaner'
6
5
 
@@ -60,7 +60,7 @@ module Devise
60
60
  # the hashed password.
61
61
  def password=(new_password)
62
62
  @password = new_password
63
- self.encrypted_password = password_digest(@password)
63
+ self.encrypted_password = password_digest(@password) if @password.present?
64
64
  end
65
65
 
66
66
  # Verifies whether a password (ie from sign in) is the user password.
@@ -70,7 +70,7 @@ module Devise
70
70
 
71
71
  # Set password and password confirmation to nil
72
72
  def clean_up_passwords
73
- @password = @password_confirmation = nil
73
+ self.password = self.password_confirmation = nil
74
74
  end
75
75
 
76
76
  # Update record attributes when :current_password matches, otherwise
@@ -198,7 +198,6 @@ module Devise
198
198
  # See https://github.com/plataformatec/devise-encryptable for examples
199
199
  # of other hashing engines.
200
200
  def password_digest(password)
201
- return if password.blank?
202
201
  Devise::Encryptor.digest(self.class, password)
203
202
  end
204
203
 
@@ -30,7 +30,7 @@ module Devise
30
30
  base.class_eval do
31
31
  validates_presence_of :email, if: :email_required?
32
32
  if Devise.activerecord51?
33
- validates_uniqueness_of :email, allow_blank: true, if: :will_save_change_to_email?
33
+ validates_uniqueness_of :email, allow_blank: true, case_sensitive: true, if: :will_save_change_to_email?
34
34
  validates_format_of :email, with: email_regexp, allow_blank: true, if: :will_save_change_to_email?
35
35
  else
36
36
  validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
@@ -135,10 +135,10 @@ module ActionDispatch::Routing
135
135
  # * failure_app: a rack app which is invoked whenever there is a failure. Strings representing a given
136
136
  # are also allowed as parameter.
137
137
  #
138
- # * sign_out_via: the HTTP method(s) accepted for the :sign_out action (default: :get),
138
+ # * sign_out_via: the HTTP method(s) accepted for the :sign_out action (default: :delete),
139
139
  # if you wish to restrict this to accept only :post or :delete requests you should do:
140
140
  #
141
- # devise_for :users, sign_out_via: [:post, :delete]
141
+ # devise_for :users, sign_out_via: [:get, :post]
142
142
  #
143
143
  # You need to make sure that your sign_out controls trigger a request with a matching HTTP method.
144
144
  #
@@ -28,7 +28,7 @@ module Devise
28
28
  private
29
29
 
30
30
  # Receives a resource and check if it is valid by calling valid_for_authentication?
31
- # An optional block that will be triggered while validating can be optionally
31
+ # A block that will be triggered while validating can be optionally
32
32
  # given as parameter. Check Devise::Models::Authenticatable.valid_for_authentication?
33
33
  # for more information.
34
34
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Devise
4
- VERSION = "4.6.0".freeze
4
+ VERSION = "4.7.0".freeze
5
5
  end
data/lib/devise.rb CHANGED
File without changes
File without changes
@@ -13,7 +13,10 @@
13
13
  autofocus: true,
14
14
  hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length),
15
15
  input_html: { autocomplete: "new-password" } %>
16
- <%= f.input :password_confirmation, label: "Confirm your new password", required: true %>
16
+ <%= f.input :password_confirmation,
17
+ label: "Confirm your new password",
18
+ required: true,
19
+ input_html: { autocomplete: "new-password" } %>
17
20
  </div>
18
21
 
19
22
  <div class="form-actions">
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.0
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-07 00:00:00.000000000 Z
12
+ date: 2019-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: warden
@@ -60,9 +60,6 @@ dependencies:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: 4.1.0
63
- - - "<"
64
- - !ruby/object:Gem::Version
65
- version: '6.0'
66
63
  type: :runtime
67
64
  prerelease: false
68
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -70,9 +67,6 @@ dependencies:
70
67
  - - ">="
71
68
  - !ruby/object:Gem::Version
72
69
  version: 4.1.0
73
- - - "<"
74
- - !ruby/object:Gem::Version
75
- version: '6.0'
76
70
  - !ruby/object:Gem::Dependency
77
71
  name: responders
78
72
  requirement: !ruby/object:Gem::Requirement