This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
2015-10-13 19:06:37 +02:00
|
|
|
package rt::root;
|
|
|
|
|
|
|
|
use configuration ':all';
|
|
|
|
use app;
|
|
|
|
use utf8;
|
2016-02-10 11:07:34 +01:00
|
|
|
use open qw/:std :utf8/;
|
2015-10-13 19:06:37 +02:00
|
|
|
|
|
|
|
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;
|