]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed login issue in BGB
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Sat, 13 Mar 2010 18:38:15 +0000 (18:38 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Sat, 13 Mar 2010 18:38:15 +0000 (18:38 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@899 74ccb610-7750-0410-82ae-013aeee3265d

www/index.cgi

index 8a3377f0248fdfcc9b35bb7fde3905e0e2551f84..dedd080b544892833b035fe03a48f25e220e8401 100755 (executable)
@@ -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' );
     }