mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
Added basic Registrant portal
This commit is contained in:
parent
90633160c0
commit
fdcad95683
28 changed files with 810 additions and 26 deletions
|
@ -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
|
||||
|
|
46
app/models/registrant_user.rb
Normal file
46
app/models/registrant_user.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue