lemonldap-ng/modules/lemonldap-ng-portal/example/error.pl
Clément Oudot 3222021897 Portal:
* Use HTML templates to send fancy reset password mail, with translations
* Send the new password by mail instead of diplaying it n the web page
* Remove the need to configure : the value is now set with help of {DOCUMENT_ROOT}
2010-01-22 11:25:37 +00:00

37 lines
991 B
Perl
Executable File

#!/usr/bin/perl
use HTML::Template;
my $portal = Lemonldap::NG::Portal::SharedConf->new(
# PORTAL CUSTOMIZATION
# Skin
#portalSkin => 'pastel',
);
my $skin = $portal->{portalSkin};
my $skin_dir = $ENV{DOCUMENT_ROOT} . "skins";
my $portal_url = $portal->{portal};
my $logout_url = "$portal_url?logout=1";
# Which HTTP error?
my $http_error = $portal->param('error');
my $error500 = 1 if ( $http_error eq "500" );
my $error403 = 1 if ( $http_error eq "403" or !$error500 );
my $template = HTML::Template->new(
filename => "$skin_dir/$skin/error.tpl",
die_on_bad_params => 0,
cache => 0,
filter => sub { $portal->translate_template(@_) }
);
$template->param( PORTAL_URL => "$portal_url" );
$template->param( LOGOUT_URL => "$logout_url" );
$template->param( SKIN => "$skin" );
$template->param( ERROR403 => "$error403" );
$template->param( ERROR500 => "$error500" );
print $portal->header('text/html; charset=utf8');
print $template->output;