From 007edd38bea3c7cb478a57be7bf6bde3d55aac32 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 28 Mar 2023 14:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99user.gitea=5Ftoken,=E5=BD=93?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=BAbot=E7=B1=BB=E5=9E=8B=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=9B=BF=E6=8D=A2=E6=88=90=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index 5e21212ab..dbaf74ccc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -845,6 +845,15 @@ class User < Owner end end + # 重写gitea_token,当用户为bot类型时,替换成管理员token + def gitea_token + if self.platform == "bot" + GiteaService.gitea_config[:admin_token] + else + self['gitea_token'] + end + end + protected def validate_password_length # 管理员的初始密码是5位