mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 17:01:44 +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,7 +11,13 @@ class Certificate < ActiveRecord::Base
|
|||
REVOKED = 'revoked'
|
||||
VALID = 'valid'
|
||||
|
||||
validates :csr, presence: true
|
||||
validate :validate_csr_and_crt
|
||||
|
||||
def validate_csr_and_crt
|
||||
if csr.blank? && crt.blank?
|
||||
errors.add(:base, I18n.t(:crt_or_csr_must_be_present))
|
||||
end
|
||||
end
|
||||
|
||||
def parsed_crt
|
||||
@p_crt ||= OpenSSL::X509::Certificate.new(crt) if crt
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue