修改同步登录的接口
This commit is contained in:
parent
bc460a6e48
commit
c88ba4a4d3
|
@ -72,6 +72,17 @@ class AccountsController < ApplicationController
|
||||||
tip_exception(-1, e.message)
|
tip_exception(-1, e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 其他平台同步登录
|
||||||
|
def remote_login
|
||||||
|
@user = User.try_to_login(params[:login], params[:password])
|
||||||
|
if @user
|
||||||
|
successful_authentication(@user)
|
||||||
|
render_ok({user: {id: @user.id, token: @user.gitea_token}})
|
||||||
|
else
|
||||||
|
render_error("用户不存在")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 用户注册
|
# 用户注册
|
||||||
|
@ -162,9 +173,6 @@ class AccountsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
successful_authentication(@user)
|
successful_authentication(@user)
|
||||||
login_control.clear # 重置每日密码错误次数
|
|
||||||
Rails.logger.info("#########_______User_current_id________#############{User.current.try(:id)}")
|
|
||||||
Rails.logger.info("#########_______current_user_id________#############{current_user.try(:id)}")
|
|
||||||
|
|
||||||
# session[:user_id] = @user.id
|
# session[:user_id] = @user.id
|
||||||
end
|
end
|
||||||
|
|
|
@ -123,6 +123,7 @@ Rails.application.routes.draw do
|
||||||
get :valid_email_and_phone
|
get :valid_email_and_phone
|
||||||
post :remote_register
|
post :remote_register
|
||||||
post :remote_update
|
post :remote_update
|
||||||
|
post :remote_login
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue