FIX 解决用户同步问题

This commit is contained in:
jasder 2021-07-09 17:53:14 +08:00
parent 06e24a8ea4
commit a7e20dcae2
2 changed files with 3 additions and 3 deletions

View File

@ -8,8 +8,8 @@ class AccountsController < ApplicationController
# 为了同步平台上未注册gitea的用户
def gitea_register
Users::SyncGiteaForm.new(sync_gitea_params).validate!
user = User.find_by(login: sync_gitea_params[:login])
Users::SyncGiteaForm.new(sync_gitea_params.merge(user: user)).validate!
return render_error("该用户已同步协作平台") if user.gitea_token.present? && user.gitea_uid.present?
result = create_gitea_user!(user, sync_gitea_params[:login], sync_gitea_params[:email], sync_gitea_params[:password])

View File

@ -8,7 +8,7 @@ class Users::SyncGiteaForm
validate :check_user, :check_password
def check_user
@user = User.find_by(login: login)
user = User.find_by(login: login)
raise '用户不存在.' unless user.present?
end