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]}" 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