From 13148890ecb4fb3c9dc73d1cbf87a67f53783c13 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 4 Apr 2023 17:40:53 +0800 Subject: [PATCH] =?UTF-8?q?token=E8=A7=A3=E5=AF=86=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/installations_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/installations_controller.rb b/app/controllers/installations_controller.rb index f4640fb61..807554fb1 100644 --- a/app/controllers/installations_controller.rb +++ b/app/controllers/installations_controller.rb @@ -19,7 +19,7 @@ class InstallationsController < ApplicationController def repositories # 与github差异,所以取安装用户和bot对应所有的仓库 # 必须使用access_tokens获取到bot的token才能查询 - tip_exception "Token无效" if current_user.platform != "bot" + tip_exception "无效Token" if current_user.platform != "bot" bot = Bot.find_by(uid: current_user.id) @install_bots = BotInstall.where(bot_id: bot.id).where(installer_id: params[:id]) end @@ -118,6 +118,9 @@ class InstallationsController < ApplicationController decoded_token = JWT.decode token, nil, false # 前面已验证token有效期和正确性 decoded_token[0]["iss"] + rescue JWT::DecodeError + Rails.logger.error "jwt token decode error:#{token}" + tip_exception("无效Token") end end