FIX 解决用户同步问题
This commit is contained in:
parent
06e24a8ea4
commit
a7e20dcae2
|
@ -8,8 +8,8 @@ class AccountsController < ApplicationController
|
||||||
|
|
||||||
# 为了同步平台上未注册gitea的用户
|
# 为了同步平台上未注册gitea的用户
|
||||||
def gitea_register
|
def gitea_register
|
||||||
Users::SyncGiteaForm.new(sync_gitea_params).validate!
|
|
||||||
user = User.find_by(login: sync_gitea_params[:login])
|
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?
|
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])
|
result = create_gitea_user!(user, sync_gitea_params[:login], sync_gitea_params[:email], sync_gitea_params[:password])
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Users::SyncGiteaForm
|
||||||
validate :check_user, :check_password
|
validate :check_user, :check_password
|
||||||
|
|
||||||
def check_user
|
def check_user
|
||||||
@user = User.find_by(login: login)
|
user = User.find_by(login: login)
|
||||||
raise '用户不存在.' unless user.present?
|
raise '用户不存在.' unless user.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue