forked from Trustie/forgeplus
add login by giteatoken
This commit is contained in:
parent
8670bcf95c
commit
aaeec77d23
|
|
@ -88,4 +88,13 @@ class OauthController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def token_login
|
||||
@user = User.find_by_gitea_token(params[:token])
|
||||
if @user.present?
|
||||
successful_authentication(@user)
|
||||
redirect_to root_url
|
||||
else
|
||||
render json: { error: "用户不存在" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -938,7 +938,7 @@ Rails.application.routes.draw do
|
|||
|
||||
get 'oauth/get_code', to: 'oauth#get_code'
|
||||
get 'oauth/get_token_callback', to: 'oauth#get_token_callback'
|
||||
|
||||
get 'oauth/token_login', to: 'oauth#token_login'
|
||||
root 'main#index'
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue