修改同步登录的接口

This commit is contained in:
sylor_huang@126.com 2020-04-15 10:42:55 +08:00
parent bc460a6e48
commit c88ba4a4d3
2 changed files with 12 additions and 3 deletions

View File

@ -72,6 +72,17 @@ class AccountsController < ApplicationController
tip_exception(-1, e.message)
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
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
end

View File

@ -123,6 +123,7 @@ Rails.application.routes.draw do
get :valid_email_and_phone
post :remote_register
post :remote_update
post :remote_login
end
end