From: Will Budic Date: Sat, 2 Nov 2019 07:39:04 +0000 (+1100) Subject: Bettered autologin enable to bring up login screen on logout. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=a55c141b13f0e1d4cee6af0f58dc55272e952fad;p=LifeLog.git Bettered autologin enable to bring up login screen on logout. --- diff --git a/htdocs/cgi-bin/login_ctr.cgi b/htdocs/cgi-bin/login_ctr.cgi index 4dd01cd..9021574 100755 --- a/htdocs/cgi-bin/login_ctr.cgi +++ b/htdocs/cgi-bin/login_ctr.cgi @@ -108,13 +108,15 @@ try{ if($alias&&$passw){ $passw = uc crypt $passw, hex $cipher_key; - &checkCreateTables; - $session->param('alias', $alias); - $session->param('passw', $passw); - $session->param('database', 'data_'.$alias.'_log.db'); - $session->flush(); - print $cgi->header(-expires=>"0s", -charset=>"UTF-8", -cookie=>$cookie, -location=>"main.cgi"); - return 1; + #CheckTables will return 1 if it was an logout set in config table. + if(&checkCreateTables()==0){ + $session->param('alias', $alias); + $session->param('passw', $passw); + $session->param('database', 'data_'.$alias.'_log.db'); + $session->flush(); + print $cgi->header(-expires=>"0s", -charset=>"UTF-8", -cookie=>$cookie, -location=>"main.cgi"); + return 1; + } } else{ &removeOldSessions; @@ -124,7 +126,7 @@ return 0; catch{ print $cgi->header; print "SERVER ERROR dump ->". $session->dump(); - print $cgi->end_html; + print $cgi->end_html; } } @@ -180,7 +182,7 @@ try{ $st->execute(); my $changed = 0; - + if(!$st->fetchrow_array()) { my $stmt = qq( CREATE TABLE LOG ( @@ -230,8 +232,8 @@ try{ # 00|DEFAULT`No action idle use.| # 02|CONF_UPD`Configuration file update with db. # 03|EMAIL`Issue email.| - # 06|DESTRUCT`Self destruct, remove alias and all data. - # 08|CHNG_PASS`Change password. + # 06|DESTRUCT`Self destruct, remove alias and all data. + # 08|CHNG_PASS`Change password. # 10|CHNG_ALIAS`Change alias. my $stmt = qq( @@ -317,8 +319,13 @@ try{ } # &populate($db) if $changed; - # - $db->disconnect(); + $db->disconnect(); + # + #Still going through checking tables and data, all above as we might have an version update in code. + #Then we check if we are login in intereactively back. Interective, logout should bring us to the login screen. + #Bypassing auto login. So to start maybe working on another database, and a new session. + return $cgi->param('autologoff') == 1; + } catch{ print $cgi->header; @@ -326,8 +333,10 @@ try{ print $cgi->end_html; exit; } + } + sub populate { my $db = shift; @@ -456,7 +465,7 @@ sub logout{ print qq(

You have properly loged out of the Life Log Application!


-

+