Better error on signing csr twice

This commit is contained in:
Martin Lensment 2015-04-24 17:16:38 +03:00
parent 85b6ea913e
commit 4388be15d6
2 changed files with 8 additions and 2 deletions

View file

@ -55,11 +55,16 @@ class Certificate < ActiveRecord::Base
self.crt = crt_file.read
save!
else
errors.add(:base, I18n.t('failed_to_create_certificate'))
logger.error('FAILED TO CREATE CLIENT CERTIFICATE')
if err.match(/TXT_DB error number 2/)
errors.add(:base, I18n.t('failed_to_create_crt_csr_already_signed'))
logger.error('CSR ALREADY SIGNED')
else
errors.add(:base, I18n.t('failed_to_create_certificate'))
end
logger.error(err)
# rubocop:disable Rails/Output
puts "Certificate sign issue: #{err.inspect}" if Rails.env.test?
puts "Certificate sign issue: #{err.inspect}" if Rails.env.test?
# rubocop:enable Rails/Output
return false
end

View file

@ -732,3 +732,4 @@ en:
you_have_a_new_invoice: 'You have a new invoice.'
sincerely: 'Sincerely'
expiry: 'Expiry'
failed_to_create_crt_csr_already_signed: 'Failed to create certificate: CSR is already signed'