From 1c6357b9cef677982ced79a38cc96baae321af68 Mon Sep 17 00:00:00 2001 From: jasder duan Date: Fri, 6 Dec 2024 16:25:33 +0800 Subject: [PATCH] =?UTF-8?q?FIX=20=E4=B8=BB=E5=8A=A8=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=A4=B4=E6=AD=8C=E8=B4=A6=E5=8F=B7=E5=88=B0gitea=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=89=8D=E7=AB=AF=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- app/models/user.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f3431ff0a..0a75a48eb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -310,7 +310,7 @@ class ApplicationController < ActionController::Base create_gitea_user!(current_user, current_user.login, email, 'zq123456') rescue => e Rails.logger.info "@@主动检测并同步gitea账号错误: #{e.message}" - next + return end end end diff --git a/app/models/user.rb b/app/models/user.rb index 6f50a3cd9..67c048f26 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -759,6 +759,10 @@ class User < Owner laboratory_id.present? && laboratory_id != 1 end + def has_gitea_user? + self.gitea_token.present? && self.gitea_uid.present? + end + protected def validate_password_length # 管理员的初始密码是5位 @@ -785,10 +789,6 @@ class User < Owner def set_lastname self.lastname = self.nickname if changes[:nickname].present? end - - def has_gitea_user? - self.gitea_token.present? && self.gitea_uid.present? - end end