Browse Source

新增:acge查询用户标识接口

pull/347/head
yystopf 1 year ago
parent
commit
435f458f6a
2 changed files with 13 additions and 0 deletions
  1. +12
    -0
      app/controllers/oauth/acge_controller.rb
  2. +1
    -0
      config/routes.rb

+ 12
- 0
app/controllers/oauth/acge_controller.rb View File

@@ -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


+ 1
- 0
config/routes.rb View File

@@ -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'


Loading…
Cancel
Save