Added basic Registrant portal

This commit is contained in:
Priit Tark 2015-05-13 13:02:08 +03:00
parent 90633160c0
commit fdcad95683
28 changed files with 810 additions and 26 deletions

View file

@ -97,6 +97,7 @@ class Epp::Domain < Domain
at[:registrant_id] = regt.id
delivery_date = frame.css('registrant').attr('verified').to_s.downcase == 'yes' ? nil : Time.zone.now
at[:registrant_verification_asked_at] = delivery_date
at[:registrant_verification_token] = SecureRandom.hex(42)
else
add_epp_error('2303', 'registrant', code, [:registrant, :not_found])
end

View file

@ -0,0 +1,46 @@
require 'open3'
# rubocop: disable Metrics/ClassLength
class ApiUser < User
include EppErrors
def epp_code_map # rubocop:disable Metrics/MethodLength
{
'2306' => [ # Parameter policy error
[:password, :blank]
]
}
end
# TODO: should have max request limit per day
belongs_to :registrar
has_many :certificates
validates :username, :password, :registrar, presence: true
validates :username, uniqueness: true
attr_accessor :registrar_typeahead
def ability
@ability ||= Ability.new(self)
end
delegate :can?, :cannot?, to: :ability
after_initialize :set_defaults
def set_defaults
return unless new_record?
self.active = true unless active_changed?
end
def registrar_typeahead
@registrar_typeahead || registrar || nil
end
def to_s
username
end
def queued_messages
registrar.messages.queued
end
end
# rubocop: enable Metrics/ClassLength