1
0
Fork 0

URL-encode AES256 secret as query param

This commit is contained in:
Alex Kotov 2019-09-12 03:10:00 +05:00
parent 8779f34f98
commit 9c7408d6a2
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 7 additions and 4 deletions

View file

@ -35,9 +35,10 @@ class Staffs::X509CertificatesController < ApplicationController
result = CreateRSAKeysAndX509SelfSignedCertificate.call \
@x509_certificate_form.attributes
return render :new unless result.success?
redirect_to [:staff, result.certificate]
redirect_to staff_x509_certificate_url(
result.certificate,
private_key_secret: Base64.urlsafe_encode64(result.private_key_pem_key),
)
end
private

View file

@ -26,6 +26,7 @@ module Partynest
confirmation_token
password
password_confirmation
private_key_secret
reset_password_token
secret
unlock_token

View file

@ -58,7 +58,8 @@ RSpec.describe 'POST /staff/x509_certificates' do
before { make_request }
specify do
expect(response).to redirect_to [:staff, X509Certificate.last]
expect(response).to \
redirect_to(/\A#{staff_x509_certificate_url(X509Certificate.last)}\?/)
end
specify do