Hello community, here is the log from the commit of package rubygem-devise for openSUSE:Factory checked in at 2018-07-18 22:49:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-devise (Old) and /work/SRC/openSUSE:Factory/.rubygem-devise.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-devise" Wed Jul 18 22:49:04 2018 rev:4 rq:620995 version:4.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-devise/rubygem-devise.changes 2018-02-12 10:15:00.429954574 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-devise.new/rubygem-devise.changes 2018-07-18 22:49:11.175906622 +0200 @@ -1,0 +2,26 @@ +Tue Mar 20 10:07:29 UTC 2018 - [email protected] + +- updated to version 4.4.3 + see installed CHANGELOG.md + + ### 4.4.3 - 2018-03-17 + + * bug fixes + * Fix undefined method `rails5?` for Devise::Test:Module (by @tegon) + * Fix: secret key was being required to be set inside credentials on Rails 5.2 (by @tegon) + + ### 4.4.2 - 2018-03-15 + + * enhancements + * Support for :credentials on Rails v5.2.x. (by @gencer) + * Improve documentation about the test suite. (by @tegon) + * Test with Rails 5.2.rc1 on Travis. (by @jcoyne) + * Allow test with Rails 6. (by @Fudoshiki) + * Creating a new section for controller configuration on `devise.rb` template (by @Danilo-Araujo-Silva) + + * bug fixes + * Preserve content_type for unauthenticated tests (by @gmcnaughton) + * Check if the resource is persisted in `update_tracked_fields!` instead of performing validations (by @tegon) + * Revert "Replace log_process_action to append_info_to_payload" (by @tegon) + +------------------------------------------------------------------- Old: ---- devise-4.4.1.gem New: ---- devise-4.4.3.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-devise.spec ++++++ --- /var/tmp/diff_new_pack.rSxaN3/_old 2018-07-18 22:49:12.123903479 +0200 +++ /var/tmp/diff_new_pack.rSxaN3/_new 2018-07-18 22:49:12.123903479 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-devise -Version: 4.4.1 +Version: 4.4.3 Release: 0 %define mod_name devise %define mod_full_name %{mod_name}-%{version} ++++++ devise-4.4.1.gem -> devise-4.4.3.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 2018-01-23 19:11:17.000000000 +0100 +++ new/.travis.yml 2018-03-18 01:00:30.000000000 +0100 @@ -10,6 +10,7 @@ gemfile: - Gemfile + - gemfiles/Gemfile.rails-5.2-rc1 - gemfiles/Gemfile.rails-5.0-stable - gemfiles/Gemfile.rails-4.2-stable - gemfiles/Gemfile.rails-4.1-stable @@ -18,6 +19,8 @@ exclude: - rvm: 2.1.10 gemfile: Gemfile + - rvm: 2.1.10 + gemfile: gemfiles/Gemfile.rails-5.2-rc1 - rvm: 2.5.0 gemfile: gemfiles/Gemfile.rails-4.1-stable - rvm: 2.4.2 @@ -32,6 +35,8 @@ gemfile: Gemfile - env: DEVISE_ORM=mongoid gemfile: gemfiles/Gemfile.rails-5.0-stable + - env: DEVISE_ORM=mongoid + gemfile: gemfiles/Gemfile.rails-5.2-rc1 allow_failures: - rvm: ruby-head services: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2018-01-23 19:11:17.000000000 +0100 +++ new/CHANGELOG.md 2018-03-18 01:00:30.000000000 +0100 @@ -1,5 +1,25 @@ ### Unreleased +### 4.4.3 - 2018-03-17 + +* bug fixes + * Fix undefined method `rails5?` for Devise::Test:Module (by @tegon) + * Fix: secret key was being required to be set inside credentials on Rails 5.2 (by @tegon) + +### 4.4.2 - 2018-03-15 + +* enhancements + * Support for :credentials on Rails v5.2.x. (by @gencer) + * Improve documentation about the test suite. (by @tegon) + * Test with Rails 5.2.rc1 on Travis. (by @jcoyne) + * Allow test with Rails 6. (by @Fudoshiki) + * Creating a new section for controller configuration on `devise.rb` template (by @Danilo-Araujo-Silva) + +* bug fixes + * Preserve content_type for unauthenticated tests (by @gmcnaughton) + * Check if the resource is persisted in `update_tracked_fields!` instead of performing validations (by @tegon) + * Revert "Replace log_process_action to append_info_to_payload" (by @tegon) + ### 4.4.1 - 2018-01-23 * bug fixes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile.lock new/Gemfile.lock --- old/Gemfile.lock 2018-01-23 19:11:17.000000000 +0100 +++ new/Gemfile.lock 2018-03-18 01:00:30.000000000 +0100 @@ -10,10 +10,10 @@ PATH remote: . specs: - devise (4.4.1) + devise (4.4.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0, < 5.2) + railties (>= 4.1.0, < 6.0) responders warden (~> 1.2.3) @@ -190,4 +190,4 @@ webrat (= 0.7.3) BUNDLED WITH - 1.16.0 + 1.16.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2018-01-23 19:11:17.000000000 +0100 +++ new/README.md 2018-03-18 01:00:30.000000000 +0100 @@ -123,7 +123,36 @@ https://github.com/plataformatec/devise/wiki/Contributing -You will usually want to write tests for your changes. To run the test suite, go into Devise's top-level directory and run "bundle install" and "rake". For the tests to pass, you will need to have a MongoDB server (version 2.0 or newer) running on your system. +You will usually want to write tests for your changes. To run the test suite, go into Devise's top-level directory and run `bundle install` and `bin/test`. +Devise works with multiple Ruby and Rails versions, and ActiveRecord and Mongoid ORMs, which means you can run the test suite with some modifiers: `DEVISE_ORM` and `BUNDLE_GEMFILE`. + +### DEVISE_ORM +Since Devise support both Mongoid and ActiveRecord, we rely on this variable to run specific code for each ORM. +The default value of `DEVISE_ORM` is `active_record`. To run the tests for mongoid, you can pass `mongoid`: +``` +DEVISE_ORM=mongoid bin/test + +==> Devise.orm = :mongoid +``` +When running the tests for Mongoid, you will need to have a MongoDB server (version 2.0 or newer) running on your system. + +Please note that the command output will show the variable value being used. + +### BUNDLE_GEMFILE +We can use this variable to tell bundler what Gemfile it should use (instead of the one in the current directory). +Inside the [gemfiles](https://github.com/plataformatec/devise/tree/master/gemfiles) directory, we have one for each version of Rails we support. When you send us a pull request, it may happen that the test suite brakes on Travis using some of them. If that's the case, you can simulate the same environment using the `BUNDLE_GEMFILE` variable. +For example, if the tests broke using Ruby 2.4.2 and Rails 4.1, you can do the following: +```bash +rbenv shell 2.4.2 # or rvm use 2.4.2 +BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bundle install +BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bin/test +``` + +You can also combine both of them if the tests broke for Mongoid: +```bash +BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable bundle install +BUNDLE_GEMFILE=gemfiles/Gemfile.rails-4.1-stable DEVISE_ORM=mongoid bin/test +``` ## Starting with Rails? Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/devise.gemspec new/devise.gemspec --- old/devise.gemspec 2018-01-23 19:11:17.000000000 +0100 +++ new/devise.gemspec 2018-03-18 01:00:30.000000000 +0100 @@ -23,6 +23,6 @@ s.add_dependency("warden", "~> 1.2.3") s.add_dependency("orm_adapter", "~> 0.1") s.add_dependency("bcrypt", "~> 3.0") - s.add_dependency("railties", ">= 4.1.0", "< 5.2") + s.add_dependency("railties", ">= 4.1.0", "< 6.0") s.add_dependency("responders") end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gemfiles/Gemfile.rails-4.1-stable.lock new/gemfiles/Gemfile.rails-4.1-stable.lock --- old/gemfiles/Gemfile.rails-4.1-stable.lock 2018-01-23 19:11:17.000000000 +0100 +++ new/gemfiles/Gemfile.rails-4.1-stable.lock 2018-03-18 01:00:30.000000000 +0100 @@ -21,10 +21,10 @@ PATH remote: .. specs: - devise (4.4.1) + devise (4.4.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0, < 5.2) + railties (>= 4.1.0, < 6.0) responders warden (~> 1.2.3) @@ -168,4 +168,4 @@ webrat (= 0.7.3) BUNDLED WITH - 1.16.0 + 1.16.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gemfiles/Gemfile.rails-4.2-stable.lock new/gemfiles/Gemfile.rails-4.2-stable.lock --- old/gemfiles/Gemfile.rails-4.2-stable.lock 2018-01-23 19:11:17.000000000 +0100 +++ new/gemfiles/Gemfile.rails-4.2-stable.lock 2018-03-18 01:00:30.000000000 +0100 @@ -57,10 +57,10 @@ PATH remote: .. specs: - devise (4.4.1) + devise (4.4.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0, < 5.2) + railties (>= 4.1.0, < 6.0) responders warden (~> 1.2.3) @@ -189,4 +189,4 @@ webrat (= 0.7.3) BUNDLED WITH - 1.16.0 + 1.16.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gemfiles/Gemfile.rails-5.0-stable.lock new/gemfiles/Gemfile.rails-5.0-stable.lock --- old/gemfiles/Gemfile.rails-5.0-stable.lock 2018-01-23 19:11:17.000000000 +0100 +++ new/gemfiles/Gemfile.rails-5.0-stable.lock 2018-03-18 01:00:30.000000000 +0100 @@ -10,10 +10,10 @@ PATH remote: .. specs: - devise (4.4.1) + devise (4.4.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0, < 5.2) + railties (>= 4.1.0, < 6.0) responders warden (~> 1.2.3) @@ -189,4 +189,4 @@ webrat (= 0.7.3) BUNDLED WITH - 1.16.0 + 1.16.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gemfiles/Gemfile.rails-5.2-rc1 new/gemfiles/Gemfile.rails-5.2-rc1 --- old/gemfiles/Gemfile.rails-5.2-rc1 1970-01-01 01:00:00.000000000 +0100 +++ new/gemfiles/Gemfile.rails-5.2-rc1 2018-03-18 01:00:30.000000000 +0100 @@ -0,0 +1,26 @@ +source "https://rubygems.org" + +gemspec path: ".." + +gem "rails", '~> 5.2.0.rc1' +gem "omniauth" +gem "omniauth-oauth2" +gem "rdoc" + +gem "activemodel-serializers-xml", github: "rails/activemodel-serializers-xml" + +gem "rails-controller-testing" + +gem "responders", "~> 2.1" + +group :test do + gem "omniauth-facebook" + gem "omniauth-openid" + gem "webrat", "0.7.3", require: false + gem "mocha", "~> 1.1", require: false + gem 'test_after_commit', require: false +end + +platforms :ruby do + gem "sqlite3" +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gemfiles/Gemfile.rails-5.2-rc1.lock new/gemfiles/Gemfile.rails-5.2-rc1.lock --- old/gemfiles/Gemfile.rails-5.2-rc1.lock 1970-01-01 01:00:00.000000000 +0100 +++ new/gemfiles/Gemfile.rails-5.2-rc1.lock 2018-03-18 01:00:30.000000000 +0100 @@ -0,0 +1,201 @@ +GIT + remote: git://github.com/rails/activemodel-serializers-xml.git + revision: 356edf4dfc38fb1fbfee90c87856e4fe5b73c5e1 + specs: + activemodel-serializers-xml (1.0.2) + activemodel (> 5.x) + activesupport (> 5.x) + builder (~> 3.1) + +PATH + remote: .. + specs: + devise (4.4.3) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0, < 6.0) + responders + warden (~> 1.2.3) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.0.rc1) + actionpack (= 5.2.0.rc1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.0.rc1) + actionpack (= 5.2.0.rc1) + actionview (= 5.2.0.rc1) + activejob (= 5.2.0.rc1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.0.rc1) + actionview (= 5.2.0.rc1) + activesupport (= 5.2.0.rc1) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.0.rc1) + activesupport (= 5.2.0.rc1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.0.rc1) + activesupport (= 5.2.0.rc1) + globalid (>= 0.3.6) + activemodel (5.2.0.rc1) + activesupport (= 5.2.0.rc1) + activerecord (5.2.0.rc1) + activemodel (= 5.2.0.rc1) + activesupport (= 5.2.0.rc1) + arel (>= 9.0) + activestorage (5.2.0.rc1) + actionpack (= 5.2.0.rc1) + activerecord (= 5.2.0.rc1) + marcel (~> 0.3.1) + activesupport (5.2.0.rc1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (~> 0.7) + minitest (~> 5.1) + tzinfo (~> 1.1) + arel (9.0.0) + bcrypt (3.1.11) + builder (3.2.3) + concurrent-ruby (1.0.5) + crass (1.0.3) + erubi (1.7.0) + faraday (0.12.2) + multipart-post (>= 1.2, < 3) + globalid (0.4.1) + activesupport (>= 4.2.0) + hashie (3.5.7) + i18n (0.9.3) + concurrent-ruby (~> 1.0) + jwt (1.5.6) + loofah (2.1.1) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.0) + mini_mime (>= 0.1.1) + marcel (0.3.1) + mimemagic (~> 0.3.2) + metaclass (0.0.4) + method_source (0.9.0) + mimemagic (0.3.2) + mini_mime (1.0.0) + mini_portile2 (2.3.0) + minitest (5.11.3) + mocha (1.3.0) + metaclass (~> 0.0.1) + multi_json (1.13.1) + multi_xml (0.6.0) + multipart-post (2.0.0) + nio4r (2.2.0) + nokogiri (1.8.2) + mini_portile2 (~> 2.3.0) + oauth2 (1.4.0) + faraday (>= 0.8, < 0.13) + jwt (~> 1.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (>= 1.2, < 3) + omniauth (1.8.1) + hashie (>= 3.4.6, < 3.6.0) + rack (>= 1.6.2, < 3) + omniauth-facebook (4.0.0) + omniauth-oauth2 (~> 1.2) + omniauth-oauth2 (1.5.0) + oauth2 (~> 1.1) + omniauth (~> 1.2) + omniauth-openid (1.0.1) + omniauth (~> 1.0) + rack-openid (~> 1.3.1) + orm_adapter (0.5.0) + rack (2.0.4) + rack-openid (1.3.1) + rack (>= 1.1.0) + ruby-openid (>= 2.1.8) + rack-test (0.8.2) + rack (>= 1.0, < 3) + rails (5.2.0.rc1) + actioncable (= 5.2.0.rc1) + actionmailer (= 5.2.0.rc1) + actionpack (= 5.2.0.rc1) + actionview (= 5.2.0.rc1) + activejob (= 5.2.0.rc1) + activemodel (= 5.2.0.rc1) + activerecord (= 5.2.0.rc1) + activestorage (= 5.2.0.rc1) + activesupport (= 5.2.0.rc1) + bundler (>= 1.3.0) + railties (= 5.2.0.rc1) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.2) + actionpack (~> 5.x, >= 5.0.1) + actionview (~> 5.x, >= 5.0.1) + activesupport (~> 5.x) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + railties (5.2.0.rc1) + actionpack (= 5.2.0.rc1) + activesupport (= 5.2.0.rc1) + method_source + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + rake (12.3.0) + rdoc (6.0.1) + responders (2.4.0) + actionpack (>= 4.2.0, < 5.3) + railties (>= 4.2.0, < 5.3) + ruby-openid (2.7.0) + sprockets (3.7.1) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.3.13) + test_after_commit (1.1.0) + activerecord (>= 3.2) + thor (0.20.0) + thread_safe (0.3.6) + tzinfo (1.2.5) + thread_safe (~> 0.1) + warden (1.2.7) + rack (>= 1.0) + webrat (0.7.3) + nokogiri (>= 1.2.0) + rack (>= 1.0) + rack-test (>= 0.5.3) + websocket-driver (0.7.0) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) + +PLATFORMS + ruby + +DEPENDENCIES + activemodel-serializers-xml! + devise! + mocha (~> 1.1) + omniauth + omniauth-facebook + omniauth-oauth2 + omniauth-openid + rails (~> 5.2.0.rc1) + rails-controller-testing + rdoc + responders (~> 2.1) + sqlite3 + test_after_commit + webrat (= 0.7.3) + +BUNDLED WITH + 1.16.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/devise/controllers/helpers.rb new/lib/devise/controllers/helpers.rb --- old/lib/devise/controllers/helpers.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/lib/devise/controllers/helpers.rb 2018-03-18 01:00:30.000000000 +0100 @@ -12,11 +12,6 @@ if respond_to?(:helper_method) helper_method :warden, :signed_in?, :devise_controller? end - - def append_info_to_payload(payload) - super - payload[:status] ||= 401 unless payload[:exception] - end end module ClassMethods @@ -83,6 +78,11 @@ end METHODS end + + def log_process_action(payload) + payload[:status] ||= 401 unless payload[:exception] + super + end end # Define authentication filters and accessor helpers based on mappings. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/devise/models/trackable.rb new/lib/devise/models/trackable.rb --- old/lib/devise/models/trackable.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/lib/devise/models/trackable.rb 2018-03-18 01:00:30.000000000 +0100 @@ -31,8 +31,13 @@ end def update_tracked_fields!(request) + # We have to check if the user is already persisted before running + # `save` here because invalid users can be saved if we don't. + # See https://github.com/plataformatec/devise/issues/4673 for more details. + return if new_record? + update_tracked_fields(request) - save + save(validate: false) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/devise/rails.rb new/lib/devise/rails.rb --- old/lib/devise/rails.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/lib/devise/rails.rb 2018-03-18 01:00:30.000000000 +0100 @@ -34,11 +34,7 @@ end initializer "devise.secret_key" do |app| - if app.respond_to?(:secrets) - Devise.secret_key ||= app.secrets.secret_key_base - elsif app.config.respond_to?(:secret_key_base) - Devise.secret_key ||= app.config.secret_key_base - end + Devise.secret_key ||= Devise::SecretKeyFinder.new(app).find Devise.token_generator ||= if secret_key = Devise.secret_key diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/devise/secret_key_finder.rb new/lib/devise/secret_key_finder.rb --- old/lib/devise/secret_key_finder.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/devise/secret_key_finder.rb 2018-03-18 01:00:30.000000000 +0100 @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Devise + class SecretKeyFinder + def initialize(application) + @application = application + end + + def find + if @application.respond_to?(:credentials) && key_exists?(@application.credentials) + @application.credentials.secret_key_base + elsif @application.respond_to?(:secrets) && key_exists?(@application.secrets) + @application.secrets.secret_key_base + elsif @application.config.respond_to?(:secret_key_base) && key_exists?(@application.config) + @application.config.secret_key_base + end + end + + private + + def key_exists?(object) + object.secret_key_base.present? + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/devise/test/controller_helpers.rb new/lib/devise/test/controller_helpers.rb --- old/lib/devise/test/controller_helpers.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/lib/devise/test/controller_helpers.rb 2018-03-18 01:00:30.000000000 +0100 @@ -139,6 +139,7 @@ status, headers, response = Devise.warden_config[:failure_app].call(env).to_a @controller.response.headers.merge!(headers) + @controller.response.content_type = headers["Content-Type"] unless Rails.version.start_with?('5') @controller.status = status @controller.response.body = response.body nil # causes process return @response diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/devise/version.rb new/lib/devise/version.rb --- old/lib/devise/version.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/lib/devise/version.rb 2018-03-18 01:00:30.000000000 +0100 @@ -1,5 +1,5 @@ # frozen_string_literal: true module Devise - VERSION = "4.4.1".freeze + VERSION = "4.4.3".freeze end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/devise.rb new/lib/devise.rb --- old/lib/devise.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/lib/devise.rb 2018-03-18 01:00:30.000000000 +0100 @@ -18,6 +18,7 @@ autoload :TestHelpers, 'devise/test_helpers' autoload :TimeInflector, 'devise/time_inflector' autoload :TokenGenerator, 'devise/token_generator' + autoload :SecretKeyFinder, 'devise/secret_key_finder' module Controllers autoload :Helpers, 'devise/controllers/helpers' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/generators/templates/devise.rb new/lib/generators/templates/devise.rb --- old/lib/generators/templates/devise.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/lib/generators/templates/devise.rb 2018-03-18 01:00:30.000000000 +0100 @@ -9,6 +9,10 @@ # Devise will use the `secret_key_base` as its `secret_key` # by default. You can change it below and use your own secret key. # config.secret_key = '<%= SecureRandom.hex(64) %>' + + # ==> Controller configuration + # Configure the parent class to the devise controllers. + # config.parent_controller = 'DeviseController' # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2018-01-23 19:11:17.000000000 +0100 +++ new/metadata 2018-03-18 01:00:30.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: devise version: !ruby/object:Gem::Version - version: 4.4.1 + version: 4.4.3 platform: ruby authors: - José Valim @@ -9,7 +9,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2018-01-23 00:00:00.000000000 Z +date: 2018-03-18 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: warden @@ -62,7 +62,7 @@ version: 4.1.0 - - "<" - !ruby/object:Gem::Version - version: '5.2' + version: '6.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement @@ -72,7 +72,7 @@ version: 4.1.0 - - "<" - !ruby/object:Gem::Version - version: '5.2' + version: '6.0' - !ruby/object:Gem::Dependency name: responders requirement: !ruby/object:Gem::Requirement @@ -137,6 +137,8 @@ - gemfiles/Gemfile.rails-4.2-stable.lock - gemfiles/Gemfile.rails-5.0-stable - gemfiles/Gemfile.rails-5.0-stable.lock +- gemfiles/Gemfile.rails-5.2-rc1 +- gemfiles/Gemfile.rails-5.2-rc1.lock - guides/bug_report_templates/integration_test.rb - lib/devise.rb - lib/devise/controllers/helpers.rb @@ -181,6 +183,7 @@ - lib/devise/rails.rb - lib/devise/rails/routes.rb - lib/devise/rails/warden_compat.rb +- lib/devise/secret_key_finder.rb - lib/devise/strategies/authenticatable.rb - lib/devise/strategies/base.rb - lib/devise/strategies/database_authenticatable.rb @@ -347,6 +350,7 @@ - test/rails_app/public/favicon.ico - test/rails_test.rb - test/routes_test.rb +- test/secret_key_finder_test.rb - test/support/action_controller/record_identifier.rb - test/support/assertions.rb - test/support/helpers.rb @@ -379,7 +383,7 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.6.13 +rubygems_version: 2.7.3 signing_key: specification_version: 4 summary: Flexible authentication solution for Rails with Warden @@ -510,6 +514,7 @@ - test/rails_app/public/favicon.ico - test/rails_test.rb - test/routes_test.rb +- test/secret_key_finder_test.rb - test/support/action_controller/record_identifier.rb - test/support/assertions.rb - test/support/helpers.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/integration/authenticatable_test.rb new/test/integration/authenticatable_test.rb --- old/test/integration/authenticatable_test.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/test/integration/authenticatable_test.rb 2018-03-18 01:00:30.000000000 +0100 @@ -3,6 +3,12 @@ require 'test_helper' class AuthenticationSanityTest < Devise::IntegrationTest + test 'sign in should not run model validations' do + sign_in_as_user + + refute User.validations_performed + end + test 'home should be accessible without sign in' do visit '/' assert_response :success @@ -545,18 +551,6 @@ refute warden.authenticated?(:user) end end - - test 'not signed in should return notification payload with 401 status' do - begin - subscriber = ActiveSupport::Notifications.subscribe /process_action.action_controller/ do |_name, _start, _finish, _id, payload| - assert_equal 401, payload[:status] - end - - get admins_path - ensure - ActiveSupport::Notifications.unsubscribe(subscriber) - end - end end class AuthenticationKeysTest < Devise::IntegrationTest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/integration/http_authenticatable_test.rb new/test/integration/http_authenticatable_test.rb --- old/test/integration/http_authenticatable_test.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/test/integration/http_authenticatable_test.rb 2018-03-18 01:00:30.000000000 +0100 @@ -3,6 +3,12 @@ require 'test_helper' class HttpAuthenticationTest < Devise::IntegrationTest + test 'sign in with HTTP should not run model validations' do + sign_in_as_new_user_with_http + + refute User.validations_performed + end + test 'handles unverified requests gets rid of caches but continues signed in' do swap ApplicationController, allow_forgery_protection: true do create_user diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/integration/omniauthable_test.rb new/test/integration/omniauthable_test.rb --- old/test/integration/omniauthable_test.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/test/integration/omniauthable_test.rb 2018-03-18 01:00:30.000000000 +0100 @@ -42,6 +42,17 @@ end end + test "omniauth sign in should not run model validations" do + stub_action!(:sign_in_facebook) do + create_user + visit "/users/sign_in" + click_link "Sign in with FaceBook" + assert warden.authenticated?(:user) + + refute User.validations_performed + end + end + test "can access omniauth.auth in the env hash" do visit "/users/sign_in" click_link "Sign in with FaceBook" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/integration/rememberable_test.rb new/test/integration/rememberable_test.rb --- old/test/integration/rememberable_test.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/test/integration/rememberable_test.rb 2018-03-18 01:00:30.000000000 +0100 @@ -12,7 +12,7 @@ end def generate_signed_cookie(raw_cookie) - request = if Devise::Test.rails51? + request = if Devise::Test.rails51? || Devise::Test.rails52? ActionController::TestRequest.create(Class.new) # needs a "controller class" elsif Devise::Test.rails5? ActionController::TestRequest.create diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/integration/trackable_test.rb new/test/integration/trackable_test.rb --- old/test/integration/trackable_test.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/test/integration/trackable_test.rb 2018-03-18 01:00:30.000000000 +0100 @@ -3,6 +3,11 @@ require 'test_helper' class TrackableHooksTest < Devise::IntegrationTest + test "trackable should not run model validations" do + sign_in_as_user + + refute User.validations_performed + end test "current and last sign in timestamps are updated on each sign in" do user = create_user diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/models/trackable_test.rb new/test/models/trackable_test.rb --- old/test/models/trackable_test.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/test/models/trackable_test.rb 2018-03-18 01:00:30.000000000 +0100 @@ -41,7 +41,7 @@ assert_equal 0, user.sign_in_count end - test 'update_tracked_fields should run model validations' do + test "update_tracked_fields! should not persist invalid records" do user = UserWithValidations.new request = mock request.stubs(:remote_ip).returns("127.0.0.1") @@ -49,4 +49,14 @@ assert_not user.update_tracked_fields!(request) assert_not user.persisted? end + + test "update_tracked_fields! should not run model validations" do + user = User.new + request = mock + request.stubs(:remote_ip).returns("127.0.0.1") + + user.expects(:after_validation_callback).never + + assert_not user.update_tracked_fields!(request) + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/orm/active_record.rb new/test/orm/active_record.rb --- old/test/orm/active_record.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/test/orm/active_record.rb 2018-03-18 01:00:30.000000000 +0100 @@ -4,7 +4,12 @@ ActiveRecord::Base.logger = Logger.new(nil) ActiveRecord::Base.include_root_in_json = true -ActiveRecord::Migrator.migrate(File.expand_path("../../rails_app/db/migrate/", __FILE__)) +migrate_path = File.expand_path("../../rails_app/db/migrate/", __FILE__) +if Devise::Test.rails52? + ActiveRecord::MigrationContext.new(migrate_path).migrate +else + ActiveRecord::Migrator.migrate(migrate_path) +end class ActiveSupport::TestCase if Devise::Test.rails5? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/rails_app/app/active_record/user.rb new/test/rails_app/app/active_record/user.rb --- old/test/rails_app/app/active_record/user.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/test/rails_app/app/active_record/user.rb 2018-03-18 01:00:30.000000000 +0100 @@ -8,4 +8,13 @@ include ActiveModel::Serializers::Xml if Devise::Test.rails5? validates :sign_in_count, presence: true + + cattr_accessor :validations_performed + + after_validation :after_validation_callback + + def after_validation_callback + # used to check in our test if the validations were called + @@validations_performed = true + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/rails_app/app/mongoid/user.rb new/test/rails_app/app/mongoid/user.rb --- old/test/rails_app/app/mongoid/user.rb 2018-01-23 19:11:17.000000000 +0100 +++ new/test/rails_app/app/mongoid/user.rb 2018-03-18 01:00:30.000000000 +0100 @@ -38,4 +38,13 @@ field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts field :unlock_token, type: String # Only if unlock strategy is :email or :both field :locked_at, type: Time + + cattr_accessor :validations_performed + + after_validation :after_validation_callback + + def after_validation_callback + # used to check in our test if the validations were called + @@validations_performed = true + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/rails_app/config/application.rb new/test/rails_app/config/application.rb --- old/test/rails_app/config/application.rb 2018-01-23 19:11:18.000000000 +0100 +++ new/test/rails_app/config/application.rb 2018-03-18 01:00:30.000000000 +0100 @@ -33,8 +33,10 @@ # config.assets.enabled = false config.action_mailer.default_url_options = { host: "localhost", port: 3000 } - - if DEVISE_ORM == :active_record && (Rails::VERSION::MAJOR >= 4 && Rails::VERSION::MINOR >= 2) + rails_version = Gem::Version.new(Rails.version) + if DEVISE_ORM == :active_record && + rails_version >= Gem::Version.new('4.2.0') && + rails_version < Gem::Version.new('5.1.0') config.active_record.raise_in_transactional_callbacks = true end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/rails_app/config/boot.rb new/test/rails_app/config/boot.rb --- old/test/rails_app/config/boot.rb 2018-01-23 19:11:18.000000000 +0100 +++ new/test/rails_app/config/boot.rb 2018-03-18 01:00:30.000000000 +0100 @@ -6,7 +6,12 @@ module Devise module Test - # Detection for minor differences between Rails 4 and 5, and 5.1 in tests. + # Detection for minor differences between Rails 4 and 5, 5.1, and 5.2 in tests. + + def self.rails52? + Rails.version.start_with? '5.2' + end + def self.rails51? Rails.version.start_with? '5.1' end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/secret_key_finder_test.rb new/test/secret_key_finder_test.rb --- old/test/secret_key_finder_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/secret_key_finder_test.rb 2018-03-18 01:00:30.000000000 +0100 @@ -0,0 +1,97 @@ +# frozen_string_literal: true + +require 'test_helper' + +class Rails52Credentials + def credentials + OpenStruct.new(secret_key_base: 'credentials') + end +end + +class Rails52Secrets + def credentials + OpenStruct.new(secret_key_base: nil) + end + + def secrets + OpenStruct.new(secret_key_base: 'secrets') + end +end + +class Rails52Config + def credentials + OpenStruct.new(secret_key_base: nil) + end + + def secrets + OpenStruct.new(secret_key_base: nil) + end + + def config + OpenStruct.new(secret_key_base: 'config') + end +end + +class Rails41Secrets + def secrets + OpenStruct.new(secret_key_base: 'secrets') + end + + def config + OpenStruct.new(secret_key_base: nil) + end +end + +class Rails41Config + def secrets + OpenStruct.new(secret_key_base: nil) + end + + def config + OpenStruct.new(secret_key_base: 'config') + end +end + +class Rails40Config + def config + OpenStruct.new(secret_key_base: 'config') + end +end + +class SecretKeyFinderTest < ActiveSupport::TestCase + test "rails 5.2 uses credentials when they're available" do + secret_key_finder = Devise::SecretKeyFinder.new(Rails52Credentials.new) + + assert_equal 'credentials', secret_key_finder.find + end + + test "rails 5.2 uses secrets when credentials are empty" do + secret_key_finder = Devise::SecretKeyFinder.new(Rails52Secrets.new) + + assert_equal 'secrets', secret_key_finder.find + end + + test "rails 5.2 uses config when secrets are empty" do + secret_key_finder = Devise::SecretKeyFinder.new(Rails52Config.new) + + assert_equal 'config', secret_key_finder.find + end + + test "rails 4.1 uses secrets" do + secret_key_finder = Devise::SecretKeyFinder.new(Rails41Secrets.new) + + assert_equal 'secrets', secret_key_finder.find + end + + test "rails 4.1 uses config when secrets are empty" do + secret_key_finder = Devise::SecretKeyFinder.new(Rails41Config.new) + + assert_equal 'config', secret_key_finder.find + end + + test "rails 4.0 uses config" do + secret_key_finder = Devise::SecretKeyFinder.new(Rails40Config.new) + + assert_equal 'config', secret_key_finder.find + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/support/integration.rb new/test/support/integration.rb --- old/test/support/integration.rb 2018-01-23 19:11:18.000000000 +0100 +++ new/test/support/integration.rb 2018-03-18 01:00:30.000000000 +0100 @@ -19,6 +19,7 @@ user.update_attribute(:confirmation_sent_at, options[:confirmation_sent_at]) if options[:confirmation_sent_at] user.confirm unless options[:confirm] == false user.lock_access! if options[:locked] == true + User.validations_performed = false user end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test/controller_helpers_test.rb new/test/test/controller_helpers_test.rb --- old/test/test/controller_helpers_test.rb 2018-01-23 19:11:18.000000000 +0100 +++ new/test/test/controller_helpers_test.rb 2018-03-18 01:00:30.000000000 +0100 @@ -100,6 +100,11 @@ assert_equal response.body, "<html><body>You are being <a href=\"http://test.host/users/sign_in\">redirected</a>.</body></html>" end + test "returns the content type of a failure app" do + get :index, params: { format: :xml } + assert response.content_type.include?('application/xml') + end + test "defined Warden after_authentication callback should not be called when sign_in is called" do begin Warden::Manager.after_authentication do |user, auth, opts| @@ -166,7 +171,7 @@ test "creates a new warden proxy if the request object has changed" do old_warden_proxy = warden - @request = if Devise::Test.rails51? + @request = if Devise::Test.rails51? || Devise::Test.rails52? ActionController::TestRequest.create(Class.new) # needs a "controller class" elsif Devise::Test.rails5? ActionController::TestRequest.create
