This commit is contained in:
OlegPhenomenon 2025-08-10 02:07:10 +00:00 committed by GitHub
commit 31a90e802e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 96 additions and 4 deletions

View file

@ -19,11 +19,14 @@ module Repp
desc 'Submit a new api user certificate signing request'
def create
@api_user = current_user.registrar.api_users.find(cert_params[:api_user_id])
csr = decode_cert_params(cert_params[:csr])
@certificate = @api_user.certificates.build(csr: csr)
if csr.blank?
@certificate.errors.add(:base, I18n.t(:crt_or_csr_must_be_present))
return handle_non_epp_errors(@certificate)
end
@certificate = @api_user.certificates.build(csr: csr)
if @certificate.save
notify_admins
render_success(data: { api_user: { id: @api_user.id } })
@ -69,7 +72,6 @@ module Repp
def decode_cert_params(csr_params)
return if csr_params.blank?
return nil if csr_params[:body] == 'invalid'
begin