push @html, Maasha::XHTML::html_end;
# push @html, Maasha::XHTML::hdump( { $cgi->Vars } ); # DEBUG
-# push @html, Maasha::XHTML::hdump( \%ENV ); # DEBUG
# push @html, Maasha::XHTML::hdump( $cookie ); # DEBUG
+# push @html, Maasha::XHTML::hdump( \%ENV ); # DEBUG
print "$_\n" foreach @html;
$cookie->{ 'DATA_DIR' } = "Data";
$cookie->{ 'SESSION_DIR' } = "Sessions";
$cookie->{ 'LIST_PAGES' } = [ qw( clade genome assembly contig browse ) ];
-
$cookie->{ 'USER' } = $cgi->param( 'user' ) || '';
$cookie->{ 'PASSWORD' } = $cgi->param( 'password' );
$cookie->{ 'SESSION_ID' } = $cgi->param( 'session_id' );
$cookie->{ 'PAGE' } ||= $cgi->param( 'page' ) || 'login';
- if ( $cookie->{ 'LOGIN' } eq 'OK' )
+ if ( $cookie->{ 'LOGIN' } )
{
if ( $cgi->param( 'genome' ) ) {
$cookie->{ 'PAGE' } = 'browse';
$cookie->{ 'LIST_USER' } = Maasha::BGB::Track::list_users();
- if ( $cookie->{ 'USER' } )
+ if ( $cookie->{ 'USER' } and not $cookie->{ 'LOGIN_ERROR' } )
{
$cookie->{ 'LIST_CLADE' } = Maasha::BGB::Track::list_clades( $cookie->{ 'USER' } );
$cookie->{ 'LIST_GENOME' } = Maasha::BGB::Track::list_genomes( $cookie->{ 'USER' }, $cookie->{ 'CLADE' } );
my ( $session );
- if ( $cookie->{ 'USER' } and $cookie->{ 'PASSWORD' } )
+ if ( defined $cookie->{ 'PASSWORD' } )
{
$session = Maasha::BGB::Session::session_restore( "$cookie->{ 'SESSION_DIR' }/sessions.json" );
$session->{ $cookie->{ 'USER' } }->{ 'TIME' } = Maasha::Common::time_stamp();
$cookie->{ 'SESSION_ID' } = $session->{ $cookie->{ 'USER' } }->{ 'SESSION_ID' };
- $cookie->{ 'LOGIN' } = "OK";
+ $cookie->{ 'LOGIN' } = 1;
Maasha::BGB::Session::session_store( "$cookie->{ 'SESSION_DIR' }/sessions.json", $session );
}
else
{
- $cookie->{ 'LOGIN' } = "ERROR";
+ $cookie->{ 'LOGIN_ERROR' } = 1;
}
}
}
push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "nav_end", value => $cookie->{ 'NAV_END' } ) );
}
- if ( $cookie->{ 'LOGIN' } and $cookie->{ 'LOGIN' } eq 'ERROR' ) {
+ if ( $cookie->{ 'LOGIN_ERROR' } ) {
push @html, Maasha::XHTML::h3( txt => "Bad user or password - please retry", class => 'error' );
}