From ca9910657a6127499602d9a9099791cb08ac11ff Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Mon, 27 Oct 2008 20:06:17 +0000 Subject: [PATCH] Fix login screen --- blue-theme/session_login.cgi | 94 ++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100755 blue-theme/session_login.cgi diff --git a/blue-theme/session_login.cgi b/blue-theme/session_login.cgi new file mode 100755 index 000000000..139065508 --- /dev/null +++ b/blue-theme/session_login.cgi @@ -0,0 +1,94 @@ +#!/usr/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"; # single cell for border +print "\n"; +print "\n"; +print "\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{'session_header'}
", + &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"; # wrapper +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(); +