#!/usr/local/bin/perl # session_login.cgi # Display the login form used in session login mode $pragma_no_cache = 1; #$ENV{'MINISERV_INTERNAL'} || die "Can only be called by miniserv.pl"; require './web-lib.pl'; require './ui-lib.pl'; &init_config(); &ReadParse(); if ($gconfig{'loginbanner'} && $ENV{'HTTP_COOKIE'} !~ /banner=1/ && !$in{'logout'} && !$in{'failed'} && !$in{'timed_out'}) { # Show pre-login HTML page print "Set-Cookie: banner=1; path=/\r\n"; &PrintHeader(); $url = $in{'page'}; open(BANNER, $gconfig{'loginbanner'}); while() { s/LOGINURL/$url/g; print; } close(BANNER); return; } $sec = uc($ENV{'HTTPS'}) eq 'ON' ? "; secure" : ""; &get_miniserv_config(\%miniserv); $sidname = $miniserv{'sidname'} || "sid"; print "Set-Cookie: banner=0; path=/$sec\r\n" if ($gconfig{'loginbanner'}); print "Set-Cookie: $sidname=x; path=/$sec\r\n" if ($in{'logout'}); print "Set-Cookie: testing=1; path=/$sec\r\n"; &ui_print_unbuffered_header(undef, undef, undef, undef, undef, 1, 1, undef, undef, "onLoad='document.forms[0].pass.value = \"\"; document.forms[0].user.focus()'"); if ($tconfig{'inframe'}) { # Framed themes lose original page $in{'page'} = "/"; } print "
\n"; if (defined($in{'failed'})) { print "

$text{'session_failed'}

\n"; } elsif ($in{'logout'}) { print "

$text{'session_logout'}

\n"; } elsif ($in{'timed_out'}) { print "

",&text('session_timed_out', int($in{'timed_out'}/60)),"

\n"; } print "$text{'session_prefix'}\n"; print "

\n"; print "\n"; print "\n"; print "\n"; print "
$text{'session_header'}
\n"; if ($gconfig{'realname'}) { $host = &get_display_hostname(); } else { $host = $ENV{'HTTP_HOST'}; $host =~ s/:\d+//g; $host = &html_escape($host); } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
", &text($gconfig{'nohostname'} ? 'session_mesg2' : 'session_mesg', "$host"),"
$text{'session_user'}
$text{'session_pass'}
\n"; print "
\n"; if (!$gconfig{'noremember'}) { print " $text{'session_save'}\n"; } print "

\n"; print "

\n"; print "$text{'session_postfix'}\n"; # Output frame-detection Javascript, if theme uses frames if ($tconfig{'inframe'}) { print < if (window != window.top) { window.top.location = window.location; } EOF } &ui_print_footer();