Merge branch 'develop' of https://code.gab.com/gab/social/gab-social into develop
This commit is contained in:
@@ -520,15 +520,5 @@ module GabSocial
|
||||
|
||||
private
|
||||
|
||||
def rotate_keys_for_account(account, delay = 0)
|
||||
if account.nil?
|
||||
say('No such account', :red)
|
||||
exit(1)
|
||||
end
|
||||
|
||||
old_key = account.private_key
|
||||
new_key = OpenSSL::PKey::RSA.new(2048)
|
||||
account.update(private_key: new_key.to_pem, public_key: new_key.public_key.to_pem)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
task fix_key_pairs: 'gabsocial:fix_key_pairs'
|
||||
|
||||
namespace :gabsocial do
|
||||
desc 'Generates key pairs for migrated accounts'
|
||||
task :fix_key_pairs => :environment do
|
||||
Account.select(:id, :username, :private_key, :public_key).all.each do |a|
|
||||
if a.public_key == "tobefilled"
|
||||
keypair = OpenSSL::PKey::RSA.new(2048)
|
||||
private_key = keypair.to_pem
|
||||
public_key = keypair.public_key.to_pem
|
||||
a.update_columns private_key: private_key, public_key: public_key
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user