Obsolete
/
dnsmanagerv1
Archived
3
0
Fork 0
This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
dnsmanagerv1/lib/rt/root.pm

47 lines
987 B
Perl

package rt::root;
use configuration ':all';
use app;
use utf8;
use open qw/:std :utf8/
use Exporter 'import';
# what we want to export eventually
our @EXPORT_OK = qw/rt_root/;
# bundle of exports (tags)
our %EXPORT_TAGS = ( all => [qw/rt_root/] );
sub rt_root {
my ($session) = @_;
my $res;
$$res{template} = 'index';
if( exists $$session{login} && length $$session{login} > 0) {
eval {
my $app = app->new(get_cfg());
my $user = $app->auth($$session{login}, $$session{passwd});
if( $user ) {
$$res{params} = {
login => $$session{login}
, admin => $$user{admin}
, domains => $$user{domains}
};
}
$app->disconnect();
};
if( $@ ) {
$$res{deferred}{errmsg} = q{Une erreur est survenue. } . $@;
$$res{sessiondestroy} = 1;
}
}
$res
}
1;