Letsencrypt - Add in email field in params
This commit is contained in:
parent
d0a84da130
commit
e49bea28c5
@ -81,22 +81,14 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|||||||
my %ret = (
|
my %ret = (
|
||||||
'Data1'=>'Data for PARAMS', #Example
|
'Data1'=>'Data for PARAMS', #Example
|
||||||
# fields from Inputs in PARAMS $fields['PARAMS']
|
# fields from Inputs in PARAMS $fields['PARAMS']
|
||||||
|
'status'=>get_prop('letsencrypt', 'status', 'disabled',
|
||||||
'status'=>'status contents',
|
'hookScript'=>get_prop('letsencrypt', 'hookScript', 'disabled'),
|
||||||
|
'hostOverride'=>get_prop('letsencrypt', 'hostOverride', 'disabled'),
|
||||||
'hookScript'=>'hookScript contents',
|
'ACCEPT_TERMS'=>get_prop('letsencrypt', 'ACCEPT_TERMS', ''),
|
||||||
|
'API'=>get_prop('letsencrypt', 'API', '2'),
|
||||||
'hostOverride'=>'hostOverride contents',
|
'keysize'=>get_prop('letsencrypt', 'keysize', '4096'),
|
||||||
|
'configure'=>get_prop('letsencrypt', 'configure', 'none' ),
|
||||||
'ACCEPT_TERMS'=>'ACCEPT_TERMS contents',
|
'Email'=>get_prop('letsencrypt', 'email')
|
||||||
|
|
||||||
'API'=>'API contents',
|
|
||||||
|
|
||||||
'keysize'=>'keysize contents',
|
|
||||||
|
|
||||||
'configure'=>'configure contents',
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
return %ret;
|
return %ret;
|
||||||
}
|
}
|
||||||
@ -108,7 +100,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|||||||
'Data1'=>'Data for CHECKALLDOMAINS', #Example
|
'Data1'=>'Data for CHECKALLDOMAINS', #Example
|
||||||
# fields from Inputs in CHECKALLDOMAINS $fields['CHECKALLDOMAINS']
|
# fields from Inputs in CHECKALLDOMAINS $fields['CHECKALLDOMAINS']
|
||||||
|
|
||||||
'AllDomainsCheck'=>'AllDomainsCheck contents',
|
'AllDomainsCheck'=>'Scan running',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
@ -130,6 +122,24 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub get_data_for_panel_CHECKONEDDOMAINS {
|
||||||
|
# Return a hash with the fields required which will be loaded into the shared data
|
||||||
|
my $c = shift;
|
||||||
|
my %ret = (
|
||||||
|
'Data1'=>'Data for CHECKONEDDOMAINS', #Example
|
||||||
|
# fields from Inputs in CHECKONEDDOMAINS $fields['CHECKONEDDOMAINS']
|
||||||
|
|
||||||
|
'OneDomainToCheck'=>'OneDomainToCheck contents',
|
||||||
|
|
||||||
|
'OneDomainsCheck'=>'OneDomainsCheck contents',
|
||||||
|
|
||||||
|
|
||||||
|
);
|
||||||
|
return %ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Get control data for table(s)
|
# Get control data for table(s)
|
||||||
|
|
||||||
@ -225,6 +235,14 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub get_selected_CHECKONEDDOMAINS {
|
||||||
|
my $c = shift;
|
||||||
|
my $selected = shift; #Parameter is name of selected row.
|
||||||
|
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||||
|
my %ret = {};
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#after sucessful modify or create or whatever and submit then perfom (if the params validate)
|
#after sucessful modify or create or whatever and submit then perfom (if the params validate)
|
||||||
|
|
||||||
@ -256,6 +274,13 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub perform_CHECKONEDDOMAINS {
|
||||||
|
my $c = shift;
|
||||||
|
my $prefix_data = shift; #Data hash as parameter
|
||||||
|
my $ret = 'ok';
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub create_link{
|
sub create_link{
|
||||||
# WIP
|
# WIP
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package SrvMngr::Controller::Letsencrypt;
|
package SrvMngr::Controller::Letsencrypt;
|
||||||
#
|
#
|
||||||
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-05 13:20:33
|
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-06 11:09:38
|
||||||
#
|
#
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# heading : Network
|
# heading : Network
|
||||||
@ -70,7 +70,7 @@ sub main {
|
|||||||
my $title = $c->l('lets_Letsencrypt_certificate');
|
my $title = $c->l('lets_Letsencrypt_certificate');
|
||||||
my $modul = '';
|
my $modul = '';
|
||||||
|
|
||||||
$lets_data{'trt'} = 'LIST';
|
$lets_data{'trt'} = 'CHECKALLDOMAINS';
|
||||||
|
|
||||||
#Load any DB entries into the <prefix>_data area so as they are preset in the form
|
#Load any DB entries into the <prefix>_data area so as they are preset in the form
|
||||||
# which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE
|
# which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE
|
||||||
@ -80,7 +80,7 @@ sub main {
|
|||||||
#pickup any other contents needed and load them into hash shared with panel
|
#pickup any other contents needed and load them into hash shared with panel
|
||||||
my %returned_hash;
|
my %returned_hash;
|
||||||
# subroutine returns a hash directly
|
# subroutine returns a hash directly
|
||||||
%returned_hash = get_data_for_panel_LIST();
|
%returned_hash = get_data_for_panel_CHECKALLDOMAINS();
|
||||||
# Copy each key-value pair from the returned hash to the prefix data hash
|
# Copy each key-value pair from the returned hash to the prefix data hash
|
||||||
while (my ($key, $value) = each %returned_hash) {
|
while (my ($key, $value) = each %returned_hash) {
|
||||||
$lets_data{$key} = $value;
|
$lets_data{$key} = $value;
|
||||||
@ -143,7 +143,7 @@ sub do_update {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# the value of trt will tell you which panel has returned
|
# the value of trt will tell you which panel has returned
|
||||||
my $trt = $c->param('trt') || 'LIST'; #hidden control on every form.
|
my $trt = $c->param('trt') || 'CHECKALLDOMAINS'; #hidden control on every form.
|
||||||
my $ret = 'ok';
|
my $ret = 'ok';
|
||||||
#Validate the parameters in a custom sub one for each panel (although only one of these will be executed)
|
#Validate the parameters in a custom sub one for each panel (although only one of these will be executed)
|
||||||
|
|
||||||
@ -173,6 +173,12 @@ sub do_update {
|
|||||||
$thispanel = 'CHECKALLENABLEDDOMAINS';
|
$thispanel = 'CHECKALLENABLEDDOMAINS';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'CHECKONEDDOMAINS'){
|
||||||
|
#Validate form parameters for panel CHECKONEDDOMAINS
|
||||||
|
$ret = $c->validate_CHECKONEDDOMAINS(\%lets_data);
|
||||||
|
$thispanel = 'CHECKONEDDOMAINS';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($ret ne "ok") {
|
if ($ret ne "ok") {
|
||||||
# return to the panel with error message
|
# return to the panel with error message
|
||||||
@ -229,6 +235,18 @@ sub do_update {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'CHECKONEDDOMAINS'){
|
||||||
|
#do whatever is required ...
|
||||||
|
$ret = $c->perform_CHECKONEDDOMAINS(\%lets_data);
|
||||||
|
if ($ret ne "ok") {
|
||||||
|
# return to the panel with error message
|
||||||
|
$c->stash(error => $c->l($ret));
|
||||||
|
$c->render("letsencrypt");
|
||||||
|
} else {
|
||||||
|
$c->stash( success => $c->l('lets_CHECKONEDDOMAINS_panel_action_was_successful')); #A bit bland - edit it in the lex file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# and call any signal-events needed
|
# and call any signal-events needed
|
||||||
|
|
||||||
|
|
||||||
@ -238,7 +256,7 @@ sub do_update {
|
|||||||
lets_data => \%lets_data
|
lets_data => \%lets_data
|
||||||
);
|
);
|
||||||
if ('none' eq 'none') {
|
if ('none' eq 'none') {
|
||||||
$lets_data{'trt'} = 'LIST';
|
$lets_data{'trt'} = 'CHECKALLDOMAINS';
|
||||||
} else {
|
} else {
|
||||||
$lets_data{'trt'} = 'none';
|
$lets_data{'trt'} = 'none';
|
||||||
}
|
}
|
||||||
@ -279,7 +297,7 @@ sub do_display {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# the value of trt will tell you which panel has returned
|
# the value of trt will tell you which panel has returned
|
||||||
my $trt = $c->param('trt') || 'LIST'; #Indicates where to go now
|
my $trt = $c->param('trt') || 'CHECKALLDOMAINS'; #Indicates where to go now
|
||||||
|
|
||||||
# Now add in the params from the selected row from the table
|
# Now add in the params from the selected row from the table
|
||||||
|
|
||||||
@ -305,6 +323,11 @@ sub do_display {
|
|||||||
%selectedrow = $c->get_selected_CHECKALLENABLEDDOMAINS($lets_data{'Selected'},$is_new_record);
|
%selectedrow = $c->get_selected_CHECKALLENABLEDDOMAINS($lets_data{'Selected'},$is_new_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'CHECKONEDDOMAINS'){
|
||||||
|
#Validate form parameters for panel CHECKONEDDOMAINS
|
||||||
|
%selectedrow = $c->get_selected_CHECKONEDDOMAINS($lets_data{'Selected'},$is_new_record);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#Copy in the selected row params to the prefix_data hash to pass to the panel
|
#Copy in the selected row params to the prefix_data hash to pass to the panel
|
||||||
while (my ($key, $value) = each %selectedrow){
|
while (my ($key, $value) = each %selectedrow){
|
||||||
@ -359,6 +382,17 @@ sub do_display {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'CHECKONEDDOMAINS'){
|
||||||
|
# pickup any other contents needed and load them into hash shared with panel
|
||||||
|
my %returned_hash;
|
||||||
|
# subroutine returns a hash directly
|
||||||
|
%returned_hash = get_data_for_panel_CHECKONEDDOMAINS();
|
||||||
|
# Copy each key-value pair from the returned hash to the prefix data hash
|
||||||
|
while (my ($key, $value) = each %returned_hash) {
|
||||||
|
$lets_data{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# and table control fields
|
# and table control fields
|
||||||
|
|
||||||
|
@ -1,16 +1,20 @@
|
|||||||
%#
|
%#
|
||||||
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-05 13:20:33
|
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-06 11:09:38
|
||||||
%#
|
%#
|
||||||
<div id="Letsencrypt-CHECKALLDOMAINS" class="partial Letsencrypt-CHECKALLDOMAINS">
|
<div id="Letsencrypt-CHECKALLDOMAINS" class="partial Letsencrypt-CHECKALLDOMAINS">
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
SelectInput();
|
SelectInput();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
% my $btn = l('lets_APPLY');
|
% if ($config->{debug} == 1) {
|
||||||
%= form_for "Letsencryptd" => (method => 'POST') => begin
|
<pre>
|
||||||
|
%= dumper $lets_data
|
||||||
% param 'trt' => $lets_data->{trt} unless param 'trt';
|
</pre>
|
||||||
|
% }
|
||||||
|
% my $btn = l('lets_APPLY');
|
||||||
|
%= form_for "letsencryptu" => (method => 'POST') => begin
|
||||||
|
% param 'trt' => $lets_data->{trt} unless param 'trt';
|
||||||
%= hidden_field 'trt' => $lets_data->{trt}
|
%= hidden_field 'trt' => $lets_data->{trt}
|
||||||
%# Inputs etc in here.
|
%# Inputs etc in here.
|
||||||
|
|
||||||
@ -22,13 +26,14 @@
|
|||||||
%=l('lets_All_domains_check_result')
|
%=l('lets_All_domains_check_result')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% param 'AllDomainsCheck' => $lets_data->{AllDomainsCheck} unless param 'AllDomainsCheck';
|
% param 'AllDomainsCheck' => $lets_data->{AllDomainsCheck} unless param 'AllDomainsCheck';
|
||||||
%= text_area 'AllDomainsCheck', cols=>40, rows=>10, Readonly=>True
|
%= text_area 'AllDomainsCheck', cols=>40, rows=>10, Readonly=>'true'
|
||||||
</span><br>
|
</span><br>
|
||||||
|
|
||||||
<span class='data'>
|
<span class='data'>
|
||||||
%= submit_button l('lets_Back'), class => 'action subm2'
|
%= submit_button l('lets_Back'), class => 'action back', onclick =>'history.back()'
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
%# Probably finally by a submit.
|
%# Probably finally by a submit.
|
||||||
%end
|
%end
|
||||||
</div>
|
</div>
|
@ -1,16 +1,20 @@
|
|||||||
%#
|
%#
|
||||||
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-05 13:20:33
|
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-06 11:09:38
|
||||||
%#
|
%#
|
||||||
<div id="Letsencrypt-CHECKALLENABLEDDOMAINS" class="partial Letsencrypt-CHECKALLENABLEDDOMAINS">
|
<div id="Letsencrypt-CHECKALLENABLEDDOMAINS" class="partial Letsencrypt-CHECKALLENABLEDDOMAINS">
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
SelectInput();
|
SelectInput();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
% my $btn = l('lets_APPLY');
|
% if ($config->{debug} == 1) {
|
||||||
%= form_for "Letsencryptd" => (method => 'POST') => begin
|
<pre>
|
||||||
|
%= dumper $lets_data
|
||||||
% param 'trt' => $lets_data->{trt} unless param 'trt';
|
</pre>
|
||||||
|
% }
|
||||||
|
% my $btn = l('lets_APPLY');
|
||||||
|
%= form_for "letsencryptu" => (method => 'POST') => begin
|
||||||
|
% param 'trt' => $lets_data->{trt} unless param 'trt';
|
||||||
%= hidden_field 'trt' => $lets_data->{trt}
|
%= hidden_field 'trt' => $lets_data->{trt}
|
||||||
%# Inputs etc in here.
|
%# Inputs etc in here.
|
||||||
|
|
||||||
@ -22,13 +26,14 @@
|
|||||||
%=l('lets_Enabled_domains_check_result')
|
%=l('lets_Enabled_domains_check_result')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
% param 'EnabledDomainsCheck' => $lets_data->{EnabledDomainsCheck} unless param 'EnabledDomainsCheck';
|
% param 'EnabledDomainsCheck' => $lets_data->{EnabledDomainsCheck} unless param 'EnabledDomainsCheck';
|
||||||
%= text_area 'EnabledDomainsCheck', cols=>40, rows=>10, Readonly=>True
|
%= text_area 'EnabledDomainsCheck', cols=>40, rows=>10, Readonly=>'true'
|
||||||
</span><br>
|
</span><br>
|
||||||
|
|
||||||
<span class='data'>
|
<span class='data'>
|
||||||
%= submit_button l('lets_Back'), class => 'action subm2'
|
%= submit_button l('lets_Back'), class => 'action back', onclick =>'history.back()'
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
%# Probably finally by a submit.
|
%# Probably finally by a submit.
|
||||||
%end
|
%end
|
||||||
</div>
|
</div>
|
@ -13,7 +13,7 @@
|
|||||||
</pre>
|
</pre>
|
||||||
% }
|
% }
|
||||||
% my $btn = l('lets_APPLY');
|
% my $btn = l('lets_APPLY');
|
||||||
%= form_for "letsencryptu" => (method => 'POST') => begin
|
%= form_for "letsencryptd" => (method => 'GET') => begin
|
||||||
|
|
||||||
% param 'trt' => $lets_data->{trt} unless param 'trt';
|
% param 'trt' => $lets_data->{trt} unless param 'trt';
|
||||||
%= hidden_field 'trt' => $lets_data->{trt}
|
%= hidden_field 'trt' => $lets_data->{trt}
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span class='data'>
|
<span class='data'>
|
||||||
%= submit_button l('lets_Back'), class => 'action subm10'
|
%= submit_button l('lets_Back'), class => 'action back', onclick =>'history.back()'
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
%# Probably finally by a submit.
|
%# Probably finally by a submit.
|
||||||
|
@ -78,3 +78,7 @@ tbody .tabl1 {}
|
|||||||
.inline-buttons .link:active {
|
.inline-buttons .link:active {
|
||||||
background-color: #c0c0c0; /* Even darker shade on click */
|
background-color: #c0c0c0; /* Even darker shade on click */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
span .label {
|
||||||
|
padding-top:13em;
|
||||||
|
}
|
@ -106,7 +106,7 @@
|
|||||||
]]>
|
]]>
|
||||||
</tel>
|
</tel>
|
||||||
|
|
||||||
<email><![CDATA[
|
<Email><![CDATA[
|
||||||
<p><span class=label>
|
<p><span class=label>
|
||||||
%=l('${Label}')
|
%=l('${Label}')
|
||||||
</span><span class=data>
|
</span><span class=data>
|
||||||
@ -114,7 +114,7 @@
|
|||||||
%=email_field '${Name}', class => 'emai${type_serial}'
|
%=email_field '${Name}', class => 'emai${type_serial}'
|
||||||
</span>span></p>
|
</span>span></p>
|
||||||
]]>
|
]]>
|
||||||
</email>
|
</Email>
|
||||||
|
|
||||||
<password><![CDATA[
|
<password><![CDATA[
|
||||||
<p><span class='label'>
|
<p><span class='label'>
|
||||||
|
@ -225,7 +225,7 @@
|
|||||||
'Input8': {
|
'Input8': {
|
||||||
'Type': 'Email',
|
'Type': 'Email',
|
||||||
'Value': '',
|
'Value': '',
|
||||||
'Name': 'email',
|
'Name': 'Email',
|
||||||
'Label': 'EMAIL'
|
'Label': 'EMAIL'
|
||||||
},
|
},
|
||||||
'Input9': {
|
'Input9': {
|
||||||
@ -235,7 +235,7 @@
|
|||||||
'Label': null
|
'Label': null
|
||||||
},
|
},
|
||||||
'Input10': {
|
'Input10': {
|
||||||
'Type': 'Submit',
|
'Type': 'Back',
|
||||||
'Value': 'Back',
|
'Value': 'Back',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -453,7 +453,7 @@ def extract_input_fields(json_data, value_type):
|
|||||||
# Iterate over each item in the panel
|
# Iterate over each item in the panel
|
||||||
for key, value in panel.items():
|
for key, value in panel.items():
|
||||||
if key.startswith('Input') and isinstance(value, dict):
|
if key.startswith('Input') and isinstance(value, dict):
|
||||||
if value.get('Type').lower() in ['readonlytext', 'text', 'select','checkbox','textarea']:
|
if value.get('Type').lower() in ['readonlytext', 'text', 'select','checkbox','textarea','email']:
|
||||||
# input_value = value.get('Value', '')
|
# input_value = value.get('Value', '')
|
||||||
input_name = value.get('Name', '')
|
input_name = value.get('Name', '')
|
||||||
print(input_name)
|
print(input_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user