/usr/share/netdisco/html/login.html is in netdisco-frontend 1.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | <h1 class="pagehead">Enter Login Information</h1>
% if ($err) {
<h2 class="subheader"><%$err%></h2>
%}
% if ($m->session->{_login_msg}) {
<h2 class="subheader"><%$m->session->{_login_msg}%></h2>
% }
<FORM ACTION="<%$r->uri%>" METHOD="POST" NAME="loginForm">
<DIV>
<INPUT TYPE="hidden" NAME="cmd" VALUE="login">
<INPUT TYPE="hidden" NAME="done" VALUE="<%$done|h%>">
<TABLE BORDER=0>
<TR>
<TD>User Name</TD>
<TD><INPUT TYPE="TEXT" NAME="user" VALUE="<%$user%>" size=15 MAXLENGTH=50 AUTOCOMPLETE=OFF></TD>
</TR>
<TR>
<TD>Password</TD>
<TD><INPUT TYPE="PASSWORD" NAME="pw" size=10 MAXLENGTH=30 AUTOCOMPLETE=off></TD>
</TR>
<TR>
<TD COLSPAN=2><INPUT TYPE="submit" CLASS="navbutton" VALUE="Log On"></TD>
</TR>
</TABLE>
</DIV>
</FORM>
<h2 class="subheader">Note</h2>
<UL>
<LI>Sessions Last for <%$session_time%> minutes.
<LI>Administrator: If you are having login problems (Appears to accept password but still sends you back to the
login page) see the comments in <i>netdisco_apache.conf</i>.
</UL>
<!--
<% join("\n",join('=',each(%{$m->session}))) %>
<% $m->session->{logged_in} %>
<% $m->session->{user} %>
-->
<SCRIPT LANGUAGE="JavaScript">
<!--
document.loginForm.user.focus();
//-->
</SCRIPT>
<%args>
$user => undef
$cmd => undef
$pw => undef
$done => undef
</%args>
<%shared>
my $userip = $r->connection->remote_ip;
</%shared>
<%method login>
<%args>
$user => undef
$pw => undef
$how => 'login'
$done => undef
</%args>
<%perl>
my $err = '';
my $useuserdb = 0;
$user = lc($user);
my $db_user = sql_hash('users',['*'],{'username' => $user});
if ($how eq 'login') {
unless (defined $db_user->{username}){
$err .= "User Not Found.\n";
}
if ($db_user->{ldap}) {
if (!user_ldap_verify($user,$pw)) {
$err .= "Bad Login.\n";
}
} else {
# User from local Database
my $md5_pw = Digest::MD5::md5_hex($pw);
unless ($err or $md5_pw eq $db_user->{password}){
$err .= "Bad Login.\n";
}
}
$useuserdb = 1;
} else {
unless ($db_user) {
# Synthesized user with no privileges.
$db_user->{username} = $user;
$db_user->{port_control} = 0;
$db_user->{admin} = 0;
}
}
if ($err) {
$m->session->{_logged_in} = 0;
# Log Failed Attempt
insert_or_update('user_log',{},
{'username'=>$user,'event'=>'login_failure',
'userip'=>$userip,'details'=>$err});
delete $m->session->{user};
delete $m->session->{user_port_ctl};
delete $m->session->{user_admin};
delete $m->session->{start};
delete $m->session->{useuserdb};
return $err;
} else {
$m->session->{_logged_in} = 1;
$m->session->{user} = $db_user->{username};
$m->session->{user_port_ctl} = $db_user->{port_control};
$m->session->{user_admin} = $db_user->{admin};
$m->session->{start} = time;
$m->session->{useuserdb} = $useuserdb;
$r->connection->user($db_user->{username});
# Update record
if ($useuserdb) {
insert_or_update('users',{'username' => $m->session->{user}},
{'last_on' => scalar(localtime)}
);
}
# Log Login
insert_or_update('user_log',{},
{'username'=>$m->session->{user},'event'=>$how,
'userip'=>$userip,'details'=>$done});
# Remove any login message
$m->session->{_login_msg} = undef;
# Redirect
if (defined $done and length($done)) {
$m->redirect("$done");
} else {
$m->redirect('.');
}
return undef;
}
</%perl>
</%method>
<%init>
my $err = '';
my $secure = &is_secure;
my $session_time = $netdisco::CONFIG{websession} || 60;
# Force us to login via HTTPS if configured
if (!$secure){
my $page = $r->uri;
my $args = $r->args;
my $url = url_secure($page);
HTML::Mason::Escapes::url_escape(\$args) if $args;
$url .= "?$args" if ($args);
$m->redirect($url);
}
if ($cmd eq 'login'){
$err = $m->comp('SELF:login', %ARGS);
}
</%init>
<%method title>
- Login \
</%method>
%# $Id: login.html,v 1.19 2009/06/11 00:22:33 maxbaker Exp $
%# vim:syntax=mason
|