From 435f458f6a7e3b787cd5af5f0bdb20dd98b795f1 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 12 Aug 2024 15:01:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9Aacge=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E7=94=A8=E6=88=B7=E6=A0=87=E8=AF=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/oauth/acge_controller.rb | 12 ++++++++++++ config/routes.rb | 1 + 2 files changed, 13 insertions(+) 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'