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