Show index.html syntax highlighted
% # vim:set syntax=mason:
<%args>
$mx => ''
</%args>
<%once>
use AlphaMail::HTMLHelper qw(hyperlink);
use AlphaMail;
</%once>
<%init>
# my $r = Apache->request;
my $logger = Log::Log4perl->get_logger('login');
my $uri;
my $reason = undef;
my $args;
my $motd = $config->get('motd', '');
if(!$mx) {
$mx = $config->get('default_domain', 'uoregon.edu');
}
if($r->prev) {
$uri = $r->prev->uri;
$reason = $r->prev->subprocess_env("AuthCookieReason");
$args = $r->prev->args;
}
if ($args) {
$uri .= "?$args";
$logger->debug("Previous URI with params: $uri");
}
my $imaps = $config->getIMAPServers;
my $base = $config->get('base_uri');
$logger->debug("Reason was set to $reason") if($reason);
$logger->debug("Previous URI: $uri");
</%init>
<html>
<head>
<title><% $config->get('organization_name') %> Alpha Mail</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="pragma" content="no-cache">
<link href="<% $base %>/static/default.css" rel="stylesheet" type="text/css" title="Default Stylesheet">
<script type="text/javascript">
<!--
function getById(name)
{
var ele = 0;
eval("ele = document.getElementById(name);");
if(!ele)
eval("ele = document.all[" + name + "];");
return ele;
}
function check_form()
{
var login_field = getById("login");
var password_field = getById("password");
if(login_field && login_field.value == "") return false;
if(password_field && password_field.value == "") return false;
return true;
}
// -->
</script>
</head>
<body class="login_screen" onLoad="document.forms[0].credential_0.focus();">
<form name="login_form" method="post" action="<% $base %>/LOGIN"
onsubmit="return check_form()">
<input type="hidden" name="destination"
value="<% $base %>/mail/index.html">
<table>
<tr>
<td> </td>
<td>
<h1 class="login_title"><% $config->get('organization_name') %> Web Email</h1>
</td>
</tr>
<tr>
<td class="label">
Login:
</td>
<td>
<input type="text" id="login" name="credential_0" size="10" maxlength="10">
% my @servers = sort keys %$imaps;
% if(scalar(@servers) == 1) {
<input type="hidden" name="credential_2" value="<% $servers[0] |h %>">
% } else {
@<select name="credential_2">
% for my $k (sort keys %$imaps) {
<option <% $mx eq $k ? "selected":"" %>><% $k |h %></option>
% }
</select>
% }
</td>
</tr>
<tr>
<td class="label">
Password:
</td>
<td>
% if($config->get('nologin', 0)) {
<p><% $config->get('nologin_message', 'Maintenance in progress') |h %></p>
% } else {
<input type="password" id="password" name="credential_1" size="10">
% }
% if($reason =~ m/^bad_credential/i) {
<span class="error">Unable to log in.</span>
% } elsif($reason =~ m/^bad_cook/i) {
<span class="error">Cookie error. If this persists, please clear your browser cookies.</span>
% }
</td>
</tr>
<tr>
<td class="label">
Interface:
</td>
<td>
<select name="credential_3">
<option value="std">Standard</option>
<option value="pda">Small Screen Mode</option>
</select>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="submit" name="login" value="Login">
</td>
</tr>
</td>
</tr>
</table>
% if($motd) {
<div class="motd">
<% $motd |h %>
</div>
% }
<input type="hidden" name="credential_4" value="0">
<input type="hidden" name="credential_5" value="0">
<input type="hidden" name="credential_6" value="0">
<script language="JavaScript">
<!--
// Detect javascript support
document.login_form.credential_4.value = 1;
document.login_form.credential_5.value = navigator.userAgent;
document.login_form.credential_6.value = navigator.appVersion;
// -->
</script>
</form>
% if($config->get('support_phone', 0)) {
<div class="login_help">
<p>Live help is available from 9am to 5pm Monday through Friday by calling <% $config->get('support_phone', '') |h %>
or by mailing <% $config->get('support_email', '<unknown>') |h %>
</div>
% }
<div class="smallprint">
Running
<a target="_blank"
href="http://www.uoregon.edu/~tkay/alphamail.html">
AlphaMail Version <% $AlphaMail::VERSION %>
</a>
</div>
</body>
</html>
See more files for this project here