更换bot client_id生成方式
This commit is contained in:
parent
ca449ccc8a
commit
189348cbd8
|
@ -29,7 +29,7 @@ class InstallationsController < ApplicationController
|
||||||
begin
|
begin
|
||||||
@bot = Bot.find params[:id]
|
@bot = Bot.find params[:id]
|
||||||
tip_exception("该Bot已激活") if Doorkeeper::Application.find_by(uid: @bot.client_id, secret: @bot.client_secret).present?
|
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.client_secret = Doorkeeper::OAuth::Helpers::UniqueToken.generate if params[:client_secret].blank?
|
||||||
@bot.private_key = OpenSSL::PKey::RSA::generate(2048).to_s
|
@bot.private_key = OpenSSL::PKey::RSA::generate(2048).to_s
|
||||||
@bot.owner_id = current_user.id
|
@bot.owner_id = current_user.id
|
||||||
|
|
Loading…
Reference in New Issue