<%args> $uname => 'x' $passwd => 'x' $url <%perl> use warnings; use strict; use lib "/var/www/itiv/modules"; use Mapps::Session; use Mapps::Auth; ########################## # try to authenticate ########################## my ($auth, $uid) = Mapps::Auth::auth($uname, $passwd); if ($auth == 1){ my $s = Mapps::Session->new(); my $sid = $s->new_session($uid); #my $sid = $s->sid(); # set cookie Apache::Cookie->new( $r, name => 'session', value => $sid, path => '/', expires => '30m', )->bake; $r->internal_redirect($url); $m->auto_send_headers(0); $m->clear_buffer; $m->abort; # else no auth }else{ $r->internal_redirect("/login.html?msg=Wrong%20username%20or%20password"); $m->auto_send_headers(0); $m->clear_buffer; $m->abort; }