diff --git a/app/app.pm b/app/app.pm index a714812..2790e7d 100644 --- a/app/app.pm +++ b/app/app.pm @@ -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 { diff --git a/app/bdd/admin.pm b/app/bdd/admin.pm index d9c4b4c..845a3bf 100644 --- a/app/bdd/admin.pm +++ b/app/bdd/admin.pm @@ -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; diff --git a/app/bdd/lambda.pm b/app/bdd/lambda.pm index 5feeb12..4b793be 100644 --- a/app/bdd/lambda.pm +++ b/app/bdd/lambda.pm @@ -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; } diff --git a/www/lib/DNSManager.pm b/www/lib/DNSManager.pm index 3450da7..c0f61cf 100644 --- a/www/lib/DNSManager.pm +++ b/www/lib/DNSManager.pm @@ -331,8 +331,8 @@ prefix '/domain' => sub { else { session errmsg => "Impossible de supprimer le domaine " - . param 'domain' - . '.' ; + . param('domain') + . '.' ; redirect request->referer; } diff --git a/www/views/details.tt b/www/views/details.tt index e883ee9..72c7a7f 100644 --- a/www/views/details.tt +++ b/www/views/details.tt @@ -7,16 +7,15 @@

Fichier de zone de <% domain %>

<% IF expert %> +
- -
- + +
- Easy Mode <% ELSE %> - +
@@ -86,12 +85,13 @@ <% END %>
Name Class
- Expert Mode +

Ajouter un enregistrement :
+ + - - Valider + +
<% END %> diff --git a/www/views/sidebar.tt b/www/views/sidebar.tt index 997143f..f529c86 100644 --- a/www/views/sidebar.tt +++ b/www/views/sidebar.tt @@ -34,16 +34,18 @@ <% END %> <% ELSE %> -
+
Se connecter: - + - -

+ + +
+
diff --git a/www/views/subscribe.tt b/www/views/subscribe.tt index 90c42ff..9557697 100644 --- a/www/views/subscribe.tt +++ b/www/views/subscribe.tt @@ -7,18 +7,35 @@

S'enregistrer


-
- - -
+ - - -
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
- - -