5 #$ENV{'MINISERV_INTERNAL'} || die "Can only be called by miniserv.pl";
6 require './web-lib.pl';
9 if ($gconfig{'loginbanner'} && $ENV{'HTTP_COOKIE'} !~ /banner=1/ &&
11 # Show pre-login HTML page
12 print "Set-Cookie: banner=1; path=/\r\n";
15 open(BANNER, $gconfig{'loginbanner'});
23 $sec = uc($ENV{'HTTPS'}) eq 'ON' ? "; secure" : "";
24 &get_miniserv_config(\%miniserv);
25 print "Set-Cookie: banner=0; path=/$sec\r\n" if ($gconfig{'loginbanner'});
26 print "Set-Cookie: testing=1; path=/$sec\r\n";
27 &header(undef, undef, undef, undef, 1, 1, undef, undef,
28 "document.forms[0].answer.focus()'");
32 if (defined($in{'failed'})) {
33 print "<h3>$text{'session_failed'}</h3><p>\n";
35 elsif ($in{'logout'}) {
36 print "<h3>$text{'session_logout'}</h3><p>\n";
38 elsif ($in{'timed_out'}) {
39 print "<h3>",&text('session_timed_out', int($in{'timed_out'}/60)),"</h3><p>\n";
42 print "$text{'pam_prefix'}\n";
43 print "<form action=$gconfig{'webprefix'}/pam_login.cgi method=post>\n";
44 print "<input type=hidden name=cid value='$in{'cid'}'>\n";
46 print "<table border width=40%>\n";
47 print "<tr $tb> <td><b>$text{'pam_header'}</b></td> </tr>\n";
48 print "<tr $cb> <td align=center><table cellpadding=3>\n";
49 if ($gconfig{'realname'}) {
50 $host = &get_system_hostname();
53 $host = $ENV{'HTTP_HOST'};
55 $host = &html_escape($host);
60 print "<tr> <td colspan=2 align=center>",
61 $in{'message'},"</td> </tr>\n";
62 print "<input type=hidden name=message value=1>\n";
66 print "<tr> <td colspan=2 align=center>",
67 &text($gconfig{'nohostname'} ? 'pam_mesg2' : 'pam_mesg',
68 "<tt>$host</tt>"),"</td> </tr>\n";
70 $pass = "type=password" if ($in{'password'});
71 print "<tr> <td><b>$in{'question'}</b></td>\n";
72 print "<td><input name=answer $pass size=20></td> </tr>\n";
75 print "<tr> <td colspan=2 align=center>\n";
76 print "<input type=submit value='$text{'pam_login'}'>\n";
77 print "<input type=reset value='$text{'session_clear'}'>\n";
78 if (!$in{'initial'}) {
79 print "<input type=submit name=restart value='$text{'pam_restart'}'>\n";
83 print "</td> </tr>\n";
84 print "</table></td></tr></table><p>\n";
86 print "</form></center>\n";
87 print "$text{'pam_postfix'}\n";
89 # Output frame-detection Javascript, if theme uses frames
90 if ($tconfig{'inframe'}) {
93 if (window != window.top) {
94 window.top.location = window.location;