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 \ result = CreateRSAKeysAndX509SelfSignedCertificate.call \
@x509_certificate_form.attributes @x509_certificate_form.attributes
return render :new unless result.success? redirect_to staff_x509_certificate_url(
result.certificate,
redirect_to [:staff, result.certificate] private_key_secret: Base64.urlsafe_encode64(result.private_key_pem_key),
)
end end
private private

View file

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

View file

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