From 8da79f812533c2d3ef9ee9226b8fff7c3c178574 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 12 Mar 2019 19:14:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index e790aa4d..f2594596 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -33,11 +33,11 @@ RedmineApp::Application.routes.draw do ## oauth相关 match 'oauth/cb', to: 'oauth#test_callback', :via => :get match 'oauth/userinfo', to: 'oauth#get_userinfo', :via => :get - match 'ecloud/ecloud_login', to: 'ecloud#ecloud_login_callback', :via => :get - match 'ecloud/bs_new', to: 'ecloud#bs_new', :via => :post - match 'ecloud/bs_edit', to: 'ecloud#bs_edit', :via => :post - match 'ecloud/ps_new', to: 'ecloud#ps_new', :via => :post - match 'ecloud/ps_edit', to: 'ecloud#ps_edit', :via => :post + get 'ecloud/ecloud_login', to: 'ecloud#ecloud_login_callback' + post 'ecloud/bs_new', to: 'ecloud#bs_new' + post 'ecloud/bs_edit', to: 'ecloud#bs_update' + post 'ecloud/ps_new', to: 'ecloud#ps_new' + post 'ecloud/ps_edit', to: 'ecloud#ps_update' resources :ec_course_evaluations do From e5252fa87ea18d48816cc300b1a0ed6a2741d1f8 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 12 Mar 2019 19:26:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/ecloud_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/ecloud_controller.rb b/app/controllers/ecloud_controller.rb index bd0170f9..47b0ca52 100644 --- a/app/controllers/ecloud_controller.rb +++ b/app/controllers/ecloud_controller.rb @@ -101,6 +101,9 @@ class EcloudController < ApplicationController def ecloud_login_callback #获取code logger.info "oauth2 login_callback: #{params}" + + raise "没有code" unless params[:code] + url = "#{SERVER_URL}/oauth2/authorization?grant_type=authorization_code" + "&client_id=#{CLIENT_ID}&scope=&redirect_uri=&code=#{params[:code]}"