From c55400717d252a2617abd5ef25dd7815e46215f0 Mon Sep 17 00:00:00 2001 From: martinahansen Date: Sat, 13 Mar 2010 18:38:15 +0000 Subject: [PATCH] fixed login issue in BGB git-svn-id: http://biopieces.googlecode.com/svn/trunk@899 74ccb610-7750-0410-82ae-013aeee3265d --- www/index.cgi | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/www/index.cgi b/www/index.cgi index 8a3377f..dedd080 100755 --- a/www/index.cgi +++ b/www/index.cgi @@ -62,8 +62,8 @@ push @html, Maasha::XHTML::body_end; 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; @@ -108,7 +108,6 @@ sub cookie_default $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' ); @@ -118,7 +117,7 @@ sub cookie_default $cookie->{ 'PAGE' } ||= $cgi->param( 'page' ) || 'login'; - if ( $cookie->{ 'LOGIN' } eq 'OK' ) + if ( $cookie->{ 'LOGIN' } ) { if ( $cgi->param( 'genome' ) ) { $cookie->{ 'PAGE' } = 'browse'; @@ -166,7 +165,7 @@ sub cookie_default $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' } ); @@ -250,7 +249,7 @@ sub cookie_login my ( $session ); - if ( $cookie->{ 'USER' } and $cookie->{ 'PASSWORD' } ) + if ( defined $cookie->{ 'PASSWORD' } ) { $session = Maasha::BGB::Session::session_restore( "$cookie->{ 'SESSION_DIR' }/sessions.json" ); @@ -262,13 +261,13 @@ sub cookie_login $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; } } } @@ -671,7 +670,7 @@ sub section_login 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' ); } -- 2.39.5