diff --git a/app/controllers/oauth/acge_controller.rb b/app/controllers/oauth/acge_controller.rb index 6f7c8203..d680a26d 100644 --- a/app/controllers/oauth/acge_controller.rb +++ b/app/controllers/oauth/acge_controller.rb @@ -1,6 +1,18 @@ class Oauth::AcgeController < Oauth::BaseController include RegisterHelper + def refer + uid = params['uid'].to_s.strip + tip_exception("uid不能为空") if uid.blank? + + open_user = OpenUsers::Acge.find_by(uid: uid) + if open_user.present? && open_user.user.present? + render :json => {login: open_user.user.login} + else + render_not_found + end + end + def create begin uid = params['uid'].to_s.strip diff --git a/config/routes.rb b/config/routes.rb index 75caa100..f5d2dd2c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,6 +26,7 @@ Rails.application.routes.draw do get 'auth/failure', to: 'oauth/base#auth_failure' get 'auth/cas/callback', to: 'oauth/cas#create' get 'auth/acge/callback', to: "oauth/acge#create" + get 'auth/acge/refer', to: "oauth/acge#refer" get 'auth/:provider/callback', to: 'oauth/callbacks#create' get 'oauth/bind', to: 'oauth/educoder#bind'