From 189348cbd816d3180555daffbd2151f4debe6571 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 29 Mar 2023 10:12:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2bot=20client=5Fid=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/installations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/installations_controller.rb b/app/controllers/installations_controller.rb index d299f6710..2addade2d 100644 --- a/app/controllers/installations_controller.rb +++ b/app/controllers/installations_controller.rb @@ -29,7 +29,7 @@ class InstallationsController < ApplicationController begin @bot = Bot.find params[:id] tip_exception("该Bot已激活") if Doorkeeper::Application.find_by(uid: @bot.client_id, secret: @bot.client_secret).present? - @bot.client_id = Doorkeeper::OAuth::Helpers::UniqueToken.generate if params[:client_id].blank? + @bot.client_id = SecureRandom.uuid.gsub("-", "") if params[:client_id].blank? @bot.client_secret = Doorkeeper::OAuth::Helpers::UniqueToken.generate if params[:client_secret].blank? @bot.private_key = OpenSSL::PKey::RSA::generate(2048).to_s @bot.owner_id = current_user.id