From 318b11e7f357c23dc57484c38be449a73a923370 Mon Sep 17 00:00:00 2001 From: Julien Simonet Date: Sun, 26 Jan 2014 21:05:19 +0100 Subject: [PATCH] Get back admin page --- www/lib/DNSManager.pm | 65 ++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/www/lib/DNSManager.pm b/www/lib/DNSManager.pm index cc422ae..e3cf446 100644 --- a/www/lib/DNSManager.pm +++ b/www/lib/DNSManager.pm @@ -410,40 +410,41 @@ prefix '/domain' => sub { redirect '/domain/details/'. param('domain'); } }; - any ['get', 'post'] => '/admin' => sub { - - unless( session('login') ) - { - redirect '/'; - } - else - { - my $app = initco(); - my ($auth_ok, $user, $isadmin) = $app->auth(session('login'), - session('password') ); - - unless ( $auth_ok && $isadmin ) { - redirect '/ '; - } - else { - - my %alldomains = $app->get_all_domains; - my %allusers = $app->get_all_users; - my ($success, @domains) = $app->get_domains( session('login') ); - - template administration => { - login => session('login') - , admin => session('admin') - , errmsg => get_errmsg - , domains => [ @domains ] - , alldomains => { %alldomains } - , allusers => { %allusers } }; - } - } - }; - }; +any ['get', 'post'] => '/admin' => sub { + + unless( session('login') ) + { + redirect '/'; + } + else + { + my $app = initco(); + my ($auth_ok, $user, $isadmin) = $app->auth(session('login'), + session('password') ); + + unless ( $auth_ok && $isadmin ) { + redirect '/ '; + } + else { + + my %alldomains = $app->get_all_domains; + my %allusers = $app->get_all_users; + my ($success, @domains) = $app->get_domains( session('login') ); + + template administration => { + login => session('login') + , admin => session('admin') + , errmsg => get_errmsg + , domains => [ @domains ] + , alldomains => { %alldomains } + , allusers => { %allusers } }; + } + } +}; + + prefix '/user' => sub { get '/logout' => sub {