% if (defined $session) {
<meta HTTP-EQUIV="refresh" Content="2; URL=<% $caller %>">
<h2>Successfully logged in</h2>
<p>You will automatically be taken to the page you requested. If
for some reason your browser doesn't take you there in a few
seconds, you can use the following
<a href="<% $caller %>">
link
</a> instead.</p>
% } else {
% if (defined $error) {
<p class="error"><% $error %></p>
% }
<form method="post" action="authenticate.html">
<input type="hidden" name="event" value="activation">
<input type="hidden" name="step" value="1">
<div class="axial">
<table cellspacing="2" cellpadding="3">
<tr><td colspan="2">Please Enter Your Login And Password.</td></tr>
<tr><td colspan="2"> </td></tr>
<tr>
<th>Login</th>
<td><input type="text" name="login" size="15"/></td>
</tr>
<tr>
<th>Password</th>
<td><input type="password" name="password" size="15"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="LOGIN"/></td>
</tr>
</table>
</div>
<input type="hidden" name="caller" value="<% $caller %>"/>
</form>
% }
<%args>
$caller
$login=>''
$password=>''
</%args>
<%once>;
use Bio::Genex::HTMLUtils;
use Bio::Genex::Connect;
use Bio::Genex::Config;
# use Apache::DB ();
</%once>
<%init>;
my $name = 'GeneX DB Authentication Page';
my $error;
my $session;
if ($login) {
unless ($password) {
$error = 'You must provide a valid password';
} else { # not $login
my $dbh = eval {Bio::Genex::Connect->new(USER=>$login,
PASSWORD=>$password)};
if ($@) {
$error = 'Invalid login/password combination. Try again.';
} else {
# Apache::DB->init;
# Apache::DB->handler;
# first get the session
my @args = (username=>$login,
password=>$password,
dbname=>$dbh->db_name,
request=>$r,
);
$session = Bio::Genex::HTMLUtils::set_session_cookie(@args);
}
}
}
</%init>