mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Form for uploading CRT directly
This commit is contained in:
parent
4cd8df079f
commit
405bb0dfd4
7 changed files with 56 additions and 29 deletions
|
@ -11,9 +11,11 @@ class Admin::CertificatesController < AdminController
|
|||
|
||||
def create
|
||||
@api_user = ApiUser.find(params[:api_user_id])
|
||||
|
||||
crt = certificate_params[:crt].open.read if certificate_params[:crt]
|
||||
csr = certificate_params[:csr].open.read if certificate_params[:csr]
|
||||
|
||||
@certificate = @api_user.certificates.build(csr: csr)
|
||||
@certificate = @api_user.certificates.build(csr: csr, crt: crt)
|
||||
if @api_user.save
|
||||
flash[:notice] = I18n.t('record_created')
|
||||
redirect_to [:admin, @api_user, @certificate]
|
||||
|
@ -63,6 +65,10 @@ class Admin::CertificatesController < AdminController
|
|||
end
|
||||
|
||||
def certificate_params
|
||||
params.require(:certificate).permit(:csr)
|
||||
if params[:certificate]
|
||||
params.require(:certificate).permit(:csr, :crt)
|
||||
else
|
||||
{}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue