Merge branch 'features/ajoutTld'
This commit is contained in:
commit
33305b7901
@ -1,11 +1,18 @@
|
||||
# TLD
|
||||
# Must contains the first "."
|
||||
tld = ".netlib.re"
|
||||
|
||||
# Database Options
|
||||
sgbd = mysql
|
||||
dbname = dnsmanager
|
||||
host = localhost
|
||||
# other options : see DBI module
|
||||
sgbd = mysql
|
||||
|
||||
# default port for mysql
|
||||
port = 3306
|
||||
user = bla
|
||||
passwd = HardPass4bla
|
||||
# other options : see DBI module
|
||||
|
||||
# possible options for dnsserver : bind rndc
|
||||
dnsapp = rndc
|
||||
zones_path = "/srv/named/"
|
||||
|
@ -67,15 +67,35 @@ get '/home' => sub {
|
||||
my %domains = ();
|
||||
my %zone_properties = ();
|
||||
|
||||
my @d = @{$app->get_domains( session('login') )};
|
||||
|
||||
template home => {
|
||||
login => session('login')
|
||||
, domains => $app->get_domains(session('login'))
|
||||
, zones_domains => \%domains
|
||||
, zone_properties => \%zone_properties
|
||||
, admin => session('admin') };
|
||||
# my @d = @{$app->get_domains( session('login') )};
|
||||
|
||||
if( session('creationSuccess') || session('creationFailure') )
|
||||
{
|
||||
my $cs = session('creationSuccess');
|
||||
session 'creationSuccess' => '';
|
||||
my $cf = session('creationFailure');
|
||||
session 'creationFailure' => '';
|
||||
my $dn = session('domainName');
|
||||
session 'domainName' => '';
|
||||
template home =>
|
||||
{ 'login' => session('login'),
|
||||
'domains' => $app->get_domains(session('login')),
|
||||
'zones_domains' => \%domains,
|
||||
'zone_properties' => \%zone_properties,
|
||||
'admin' => session('admin'),
|
||||
'creationSuccess' => $cs,
|
||||
'creationFailure' => $cf,
|
||||
'domainName' => $dn };
|
||||
}
|
||||
else
|
||||
{
|
||||
template home =>
|
||||
{ 'login' => session('login'),
|
||||
'domains' => $app->get_domains(session('login')),
|
||||
'zones_domains' => \%domains,
|
||||
'zone_properties' => \%zone_properties,
|
||||
'admin' => session('admin') };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -137,8 +157,32 @@ prefix '/domain' => sub {
|
||||
else
|
||||
{
|
||||
|
||||
my $creationSuccess = false;
|
||||
my $creationFailure = false;
|
||||
if( param('domain') =~ /^[a-zA-Z0-9]+[a-zA-Z0-9-]+[a-zA-Z0-9]+$|^[a-zA-Z0-9]+$/ )
|
||||
{
|
||||
|
||||
my $cfg = new Config::Simple(dirname(__FILE__).'/../conf/config.ini');
|
||||
my $domain = param('domain').$cfg->param('tld');
|
||||
# $domain =~ s/\.{2,}/\./g;
|
||||
# say "domain after sed : $domain";
|
||||
# create domain
|
||||
my $app = initco();
|
||||
$app->add_domain( session('login'), param('domain') );
|
||||
# Add tld
|
||||
# create domain
|
||||
$app->add_domain( session('login'), $domain );
|
||||
$creationSuccess = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
# say param('domain')." contains a char not valid";
|
||||
$creationFailure = true;
|
||||
}
|
||||
|
||||
session 'creationSuccess' => $creationSuccess;
|
||||
session 'creationFailure' => $creationFailure;
|
||||
session 'domainName' => param('domain');
|
||||
redirect '/home';
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,17 @@
|
||||
|
||||
<div id="page">
|
||||
|
||||
<!-- Permettra une mise en forme plus propre. -->
|
||||
<% IF creationSuccess == 1 %>
|
||||
<p>
|
||||
Le domaine "<% domainName %>" a bien été créée.
|
||||
</p>
|
||||
<% ELSIF creationFailure == 1 %>
|
||||
<p>
|
||||
Le domaine "<% domainName %>" n'a pas été créée.
|
||||
</p>
|
||||
<% END %>
|
||||
|
||||
<% IF domains && domains.size %>
|
||||
<h3>Vos domaines :</h3>
|
||||
<br />
|
||||
|
Reference in New Issue
Block a user