mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Improve keyrelay registrar
This commit is contained in:
parent
cdc93a570f
commit
b1714f4b1f
7 changed files with 25 additions and 26 deletions
|
@ -9,8 +9,8 @@ class Registrar::KeyrelaysController < Registrar::DeppController # EPP controlle
|
|||
@data = keyrelay.keyrelay(params)
|
||||
|
||||
if response_ok?
|
||||
flash[:epp_results] = [{ 'code' => '1000', 'msg' => 'Command completed successfully' }]
|
||||
redirect_to keyrelay_path
|
||||
flash[:epp_results] = [{ 'code' => '1000', 'msg' => 'Command completed successfully', 'show' => true }]
|
||||
redirect_to registrar_keyrelay_path
|
||||
else
|
||||
render 'show'
|
||||
end
|
||||
|
|
|
@ -30,13 +30,17 @@ module Depp
|
|||
authInfo: {
|
||||
pw: { value: params['password'] }
|
||||
},
|
||||
expiry: {
|
||||
relative: { value: params['expiry_relative'] },
|
||||
absolute: { value: params['expiry_absolute'] }
|
||||
}
|
||||
expiry: expiry(params['expiry'])
|
||||
}, custom_params)
|
||||
|
||||
current_user.request(xml)
|
||||
end
|
||||
|
||||
def expiry(value)
|
||||
ISO8601::Duration.new(value)
|
||||
{ relative: { value: value } }
|
||||
rescue => _e
|
||||
{ absolute: { value: value } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class DurationIso8601Validator < ActiveModel::EachValidator
|
|||
|
||||
class << self
|
||||
def validate(value)
|
||||
return false if value.blank?
|
||||
return true if value.blank?
|
||||
return true if value.empty?
|
||||
|
||||
begin
|
||||
|
|
|
@ -19,16 +19,9 @@
|
|||
|
||||
.form-group
|
||||
.col-md-3.control-label
|
||||
= label_tag :expiry_relative, t(:expiry_relative), class: 'required'
|
||||
= label_tag :expiry, t(:expiry), class: 'required'
|
||||
.col-md-7
|
||||
= text_field_tag :expiry_relative, params[:expiry_relative],
|
||||
class: 'form-control', autocomplete: 'off', required: true
|
||||
|
||||
.form-group
|
||||
.col-md-3.control-label
|
||||
= label_tag :expiry_absolute, t(:expiry_absolute), class: 'required'
|
||||
.col-md-7
|
||||
= text_field_tag :expiry_absolute, params[:expiry_absolute],
|
||||
= text_field_tag :expiry, params[:expiry],
|
||||
class: 'form-control', autocomplete: 'off', required: true
|
||||
|
||||
.form-group
|
||||
|
|
|
@ -18,10 +18,12 @@
|
|||
|
||||
- if flash[:epp_results]
|
||||
- flash[:epp_results].each do |x|
|
||||
- next if success_codes.include?(x['code'])
|
||||
- next if success_codes.include?(x['code']) && x['show'] != true
|
||||
- c = 'alert-danger'
|
||||
- c = 'alert-success' if success_codes.include?(x['code'])
|
||||
.row
|
||||
.col-md-12
|
||||
%p{class: "alert alert-danger"}
|
||||
%p{class: "alert #{c}"}
|
||||
= x['msg'].split('[').first
|
||||
- if x['value'].present?
|
||||
= " - #{x['value']}"
|
||||
|
|
|
@ -731,3 +731,4 @@ en:
|
|||
client: 'Client'
|
||||
you_have_a_new_invoice: 'You have a new invoice.'
|
||||
sincerely: 'Sincerely'
|
||||
expiry: 'Expiry'
|
||||
|
|
|
@ -16,7 +16,6 @@ describe Keyrelay do
|
|||
@keyrelay.errors.full_messages.should match_array([
|
||||
"Auth info pw Password is missing",
|
||||
"Domain is missing",
|
||||
"Expiry relative Expiry relative must be compatible to ISO 8601",
|
||||
"Key data alg Algorithm is missing",
|
||||
"Key data flags Flag is missing",
|
||||
"Key data protocol Protocol is missing",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue