Obsolete
/
dnsmanagerv1
Archived
3
0
Fork 0

debug suppr domaines, affichage

master
Philippe Pittoli 2014-01-25 02:33:38 +01:00
parent a7a334e330
commit b556491b72
7 changed files with 73 additions and 26 deletions

View File

@ -97,10 +97,16 @@ sub add_domain {
sub delete_domain {
my ($self, $login, $domain) = @_;
my ($success, $user, $isadmin) = ${$self->um}->get_user($login);
$user->delete_domain($domain);
return 0 unless $success;
return 0 unless $user->delete_domain($domain);
my $ze = app::zone::edit->new(zname => $domain, zdir => $self->zdir);
$ze->del();
1;
}
sub update_domain_raw {

View File

@ -12,4 +12,22 @@ sub delete_zone {
my ($self, $domain) = @_;
}
# $success delete_domain
sub delete_domain {
my ($self, $domain) = @_;
my $sth;
$sth = $self->dbh->prepare('delete from domain where domain=?');
unless ( $sth->execute($domain) ) {
$sth->finish();
return 0;
}
$sth->finish();
# delete the domain from our domains
@{ $self->domains } = grep { $_ ne $domain } @{ $self->domains };
return 1;
}
1;

View File

@ -15,9 +15,10 @@ has passwd => (is => 'rw', trigger => \&_update_passwd );
# $success delete_domain
sub delete_domain {
# check if we are the owner then delete
my ($self, $domain) = @_;
my $sth;
# check if we are the owner then delete
return 0 if (grep { $domain eq $_ } @{ $self->domains }) == 0;
$sth = $self->dbh->prepare('delete from domain where domain=?');
@ -25,7 +26,9 @@ sub delete_domain {
$sth->finish();
return 0;
}
$sth->finish();
# delete the domain from our domains
@{ $self->domains } = grep { $_ ne $domain } @{ $self->domains };
return 1;
}

View File

@ -331,8 +331,8 @@ prefix '/domain' => sub {
else {
session errmsg => "Impossible de supprimer le domaine "
. param 'domain'
. '.' ;
. param('domain')
. '.' ;
redirect request->referer;
}

View File

@ -7,16 +7,15 @@
<h3>Fichier de zone de <% domain %></h3>
<% IF expert %>
<a href='/domain/details/<% domain %>'><button type="button" class="btn btn-primary">Visualisation pour débutants</button></a>
<form class="form" action='/domain/updateraw/<% domain %>' method="post" >
<textarea name="zoneupdated" rows="20" cols="100"><% domain_zone %></textarea>
<br />
<input type="submit" value="Mettre à jour la zone" />
<textarea name="zoneupdated" rows="15" cols="75"><% domain_zone %></textarea>
<input type="submit" value="Mettre à jour la zone" />
</form>
<a href='/domain/details/<% domain %>' >Easy Mode</a>
<% ELSE %>
<table border=1 >
<table class="table" >
<caption>
<td>Name</td>
<td>Class</td>
@ -86,12 +85,13 @@
<% END %>
</table>
<a href='/domain/details/<% domain %>?expert=1'>Expert Mode</a>
<a href='/domain/details/<% domain %>?expert=1'><button type="button" class="btn btn-primary">Visualisation en mode expert</button></a>
<br /><br />
Ajouter un enregistrement : <br />
<form action='/domain/update/<% domain %>' method='post' >
<label for="name">Nom : </label><input type="text" name="name" />
<label for="type">Type : </label><select name="type" id="type" >
<option value="A">A</option>
@ -101,9 +101,10 @@
<option value="NS">NS</option>
<option value="PTR">PTR</option>
</select>
<label for="value">Valeur : </label><input type="text" id="value" name="value" />
<label for="input_ttl">TTL</label><input type="number" id="input_ttl" name="ttl" min='1' value="3"/>
<input type="submit">Valider</input>
<label for="input_ttl">TTL</label><input type="number" id="input_ttl" name="ttl" min='1' value="3600"/>
<button type="submit" class="btn btn-sm btn-primary">Valider</button>
</form>
<% END %>

View File

@ -34,16 +34,18 @@
<% END %>
<% ELSE %>
<form role="form" action="/user/login" method="post" accept-charset="utf-8">
<form class="form" role="form" action="/user/login" method="post" accept-charset="utf-8">
<div class="form-group">
<fieldset>
<legend>Se connecter:</legend>
<label for="login">Votre identifiant : </label>
<input type="text" name="login" value="" />
<input type="text" name="login" class="form-control" id="login" placeholder="Votre futur identifiant de connexion" />
<label for="password">Votre mot de passe : </label>
<input type="password" name="password" value="" />
<p><input type="submit" value="Connexion &rarr;" /></p>
<input type="password" name="password" class="form-control" id="password" placeholder="Mot de passe" />
<br />
<button type="submit" class="btn btn-default">Connexion &rarr;</button>
</fieldset>
</div>
</form>

View File

@ -7,18 +7,35 @@
<h3>S'enregistrer</h3>
<hr />
<form class="form" action='/user/add/' method="post" >
<label for='login'>login : </label>
<input type='text' name='login' id='login' />
<br />
<form class="form-horizontal" role="form" action='/user/add/' method="post">
<label for='password'>password : </label>
<input type='password' name='password' id='password' />
<br />
<div class="form-group">
<label for="login" class="col-sm-2 control-label">Identifiant</label>
<div class="col-sm-10">
<input type="text" id="login" name="login" class="form-control" placeholder="Votre futur identifiant de connexion">
</div>
</div>
<div class="form-group">
<label for="password" class="col-sm-2 control-label">Mot de passe</label>
<div class="col-sm-10">
<input type="password" id="password" name="password" class="form-control" placeholder="Mot de passe">
</div>
</div>
<div class="form-group">
<label for="password2" class="col-sm-2 control-label">Mot de passe (vérification)</label>
<div class="col-sm-10">
<input type="password" id="password2" name="password2" class="form-control" placeholder="Mot de passe (pour vérification)">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">S'enregistrer</button>
</div>
</div>
<label for='password2'>password (pour être sûr): </label>
<input type='password' name='password2' id='password2' />
<input type='submit' name='submit'/>
</form>
</div>