diff --git a/Gemfile.lock b/Gemfile.lock index e4222be0b8c7543ca19a360f2f3596e575e564c5..8f2d46fe37b0adffcf97256e2594d595fd898b1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,10 +12,10 @@ GIT GIT remote: https://github.com/lynndylanhurley/devise_token_auth.git - revision: b1ceb54f33841eafffc31f1e47de378296fa990b + revision: 4c5245b88b39c1bb305e0cbdbfc2513eebdeda93 branch: master specs: - devise_token_auth (1.1.4) + devise_token_auth (1.2.0) bcrypt (~> 3.0) devise (> 3.5.2, < 5) rails (>= 4.2.0, < 6.2) @@ -35,40 +35,40 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (6.1.3.2) - actionpack (= 6.1.3.2) - activesupport (= 6.1.3.2) + actioncable (6.1.4) + actionpack (= 6.1.4) + activesupport (= 6.1.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.3.2) - actionpack (= 6.1.3.2) - activejob (= 6.1.3.2) - activerecord (= 6.1.3.2) - activestorage (= 6.1.3.2) - activesupport (= 6.1.3.2) + actionmailbox (6.1.4) + actionpack (= 6.1.4) + activejob (= 6.1.4) + activerecord (= 6.1.4) + activestorage (= 6.1.4) + activesupport (= 6.1.4) mail (>= 2.7.1) - actionmailer (6.1.3.2) - actionpack (= 6.1.3.2) - actionview (= 6.1.3.2) - activejob (= 6.1.3.2) - activesupport (= 6.1.3.2) + actionmailer (6.1.4) + actionpack (= 6.1.4) + actionview (= 6.1.4) + activejob (= 6.1.4) + activesupport (= 6.1.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.3.2) - actionview (= 6.1.3.2) - activesupport (= 6.1.3.2) + actionpack (6.1.4) + actionview (= 6.1.4) + activesupport (= 6.1.4) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.3.2) - actionpack (= 6.1.3.2) - activerecord (= 6.1.3.2) - activestorage (= 6.1.3.2) - activesupport (= 6.1.3.2) + actiontext (6.1.4) + actionpack (= 6.1.4) + activerecord (= 6.1.4) + activestorage (= 6.1.4) + activesupport (= 6.1.4) nokogiri (>= 1.8.5) - actionview (6.1.3.2) - activesupport (= 6.1.3.2) + actionview (6.1.4) + activesupport (= 6.1.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -78,24 +78,24 @@ GEM activemodel (>= 4.1, < 6.2) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.3) - activejob (6.1.3.2) - activesupport (= 6.1.3.2) + activejob (6.1.4) + activesupport (= 6.1.4) globalid (>= 0.3.6) - activemodel (6.1.3.2) - activesupport (= 6.1.3.2) - activerecord (6.1.3.2) - activemodel (= 6.1.3.2) - activesupport (= 6.1.3.2) + activemodel (6.1.4) + activesupport (= 6.1.4) + activerecord (6.1.4) + activemodel (= 6.1.4) + activesupport (= 6.1.4) activerecord-import (1.1.0) activerecord (>= 3.2) - activestorage (6.1.3.2) - actionpack (= 6.1.3.2) - activejob (= 6.1.3.2) - activerecord (= 6.1.3.2) - activesupport (= 6.1.3.2) + activestorage (6.1.4) + actionpack (= 6.1.4) + activejob (= 6.1.4) + activerecord (= 6.1.4) + activesupport (= 6.1.4) marcel (~> 1.0.0) - mini_mime (~> 1.0.2) - activesupport (6.1.3.2) + mini_mime (>= 1.1.0) + activesupport (6.1.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -135,7 +135,7 @@ GEM coderay (1.1.3) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.1.8) + concurrent-ruby (1.1.9) connection_pool (2.2.5) crass (1.0.6) curb (0.9.11) @@ -231,8 +231,8 @@ GEM gitlab (4.17.0) httparty (~> 0.18) terminal-table (~> 1.5, >= 1.5.1) - globalid (0.4.2) - activesupport (>= 4.2.0) + globalid (0.5.1) + activesupport (>= 5.0) haml (5.2.1) temple (>= 0.8.0) tilt @@ -255,7 +255,7 @@ GEM launchy (2.5.0) addressable (~> 2.7) logger-colors (1.0.0) - loofah (2.9.1) + loofah (2.10.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -273,8 +273,8 @@ GEM open4 (~> 1.3.4) rake mini_histogram (0.3.1) - mini_mime (1.0.3) - mini_portile2 (2.5.1) + mini_mime (1.1.0) + mini_portile2 (2.5.3) minitest (5.14.4) minitest-reporters (1.4.3) ansi @@ -290,7 +290,7 @@ GEM net-http-persistent (4.0.1) connection_pool (~> 2.2) nio4r (2.5.7) - nokogiri (1.11.6) + nokogiri (1.11.7) mini_portile2 (~> 2.5.0) racc (~> 1.4) oauth (0.5.6) @@ -357,20 +357,20 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.1.3.2) - actioncable (= 6.1.3.2) - actionmailbox (= 6.1.3.2) - actionmailer (= 6.1.3.2) - actionpack (= 6.1.3.2) - actiontext (= 6.1.3.2) - actionview (= 6.1.3.2) - activejob (= 6.1.3.2) - activemodel (= 6.1.3.2) - activerecord (= 6.1.3.2) - activestorage (= 6.1.3.2) - activesupport (= 6.1.3.2) + rails (6.1.4) + actioncable (= 6.1.4) + actionmailbox (= 6.1.4) + actionmailer (= 6.1.4) + actionpack (= 6.1.4) + actiontext (= 6.1.4) + actionview (= 6.1.4) + activejob (= 6.1.4) + activemodel (= 6.1.4) + activerecord (= 6.1.4) + activestorage (= 6.1.4) + activesupport (= 6.1.4) bundler (>= 1.15.0) - railties (= 6.1.3.2) + railties (= 6.1.4) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -382,14 +382,14 @@ GEM ruby-graphviz (~> 1.2) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (6.1.3.2) - actionpack (= 6.1.3.2) - activesupport (= 6.1.3.2) + railties (6.1.4) + actionpack (= 6.1.4) + activesupport (= 6.1.4) method_source - rake (>= 0.8.7) + rake (>= 0.13) thor (~> 1.0) rainbow (3.0.0) - rake (13.0.3) + rake (13.0.6) rdoc (6.3.1) redis (4.2.5) reek (6.0.4) @@ -533,7 +533,7 @@ GEM activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - websocket-driver (0.7.4) + websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) whenever (1.0.0) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9db44f7a1adecccb1545b35e9845b7aba599804c..7d8ea4cded332be1ef2e742db89cef19020aeae2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -27,6 +27,7 @@ class ApplicationController < ActionController::API before_action :set_paper_trail_whodunnit rescue_from Exception do |exception| + logger.fatal "The request raised an exception:" logger.fatal exception logger.fatal exception.backtrace.first(10).join("\n") unless response_body diff --git a/app/controllers/v1/omniauth_callbacks_controller.rb b/app/controllers/v1/omniauth_callbacks_controller.rb index d644919e26c37b0e990b66e2477481fbdccd95f5..4c833a696d45d1efe71f57b0ccf3ed5087880263 100644 --- a/app/controllers/v1/omniauth_callbacks_controller.rb +++ b/app/controllers/v1/omniauth_callbacks_controller.rb @@ -20,15 +20,11 @@ require 'open-uri' class V1::OmniauthCallbacksController < DeviseTokenAuth::OmniauthCallbacksController - def get_redirect_route(devise_mapping) - redirect_route = "#{request.protocol}#{request.host_with_port}/#{Devise.mappings[devise_mapping.to_sym].fullpath}/#{params[:provider]}/callback" - end - protected # break out provider attribute assignment for easy method extension def assign_provider_attrs(user, auth_hash) - avatar = open(auth_hash['info']['image']) + avatar = URI.parse(open(auth_hash['info']['image'])).open user.assign_attributes({ nickname: auth_hash['info']['nickname'], diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index e31df4a910c49d055336e969014fb585a19338a3..130cb78a3536fbdcce4ddf88312458eceeee5c3f 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -27,3 +27,5 @@ Rails.application.config.middleware.use OmniAuth::Builder do } provider :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'] end + +OmniAuth.config.allowed_request_methods = [:post, :get]