]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Autologin implemented and tested.
authorMetabox <redacted>
Sat, 1 Jun 2019 03:53:39 +0000 (13:53 +1000)
committerMetabox <redacted>
Sat, 1 Jun 2019 03:53:39 +0000 (13:53 +1000)
Current Development Check List.md
htdocs/cgi-bin/login_ctr.cgi
htdocs/cgi-bin/tempCodeRunnerFile.cgi

index 331a64690bb7158b9f8fcee83ec7c9f4e7d717d8..8709a0e12d0b7658c52669480942216b849d9a01 100644 (file)
@@ -1,6 +1,6 @@
 # Current Branch Development Moon-Stable-1.4
 ## Urgent
-* Autologin feature, that expires on logout.
+*&#10004; Autologin feature, that expires on logout.
 *&#10004; Data/Login control updated to read the configuration file.
 >> Configuration file to be updated to carry also categories.
 * &#10004; Configuration page to be updated, system variables description field to be implemented.
index 1221cc8e5d01afde9c6cbb89a897b21d645aafbd..7094fc936272bdeefcdb29e4afa91bbd6082c183 100755 (executable)
@@ -50,6 +50,7 @@ my $cipher_key = '95d7a85ba891da';
 
 if($cgi->param('logout')){&logout}
 
+&checkAutologinSet;
 if(&processSubmit==0){
 
   print $cgi->header(-expires=>"0s", -charset=>"UTF-8", -cookie=>$cookie);  
@@ -94,7 +95,7 @@ exit;
 
 sub processSubmit{
 try{
-       &checkAutologinSet;
+
        if($alias&&$passw){
                        
                        $passw = uc crypt $passw, hex $cipher_key;
@@ -140,12 +141,12 @@ try{
                         my $db = DBI->connect($dsn, $cre[0], $cre[1], { RaiseError => 1 }) 
                                                                or die "<p>Error->"& $DBI::errstri &"</p>";
                                        #check if enabled.      
-                        my $st = $db->prepare("SELECT NAME, VALUE FROM CONFIG WHERE NAME='$AUTO_LOGIN';");
+                        my $st = $db->prepare("SELECT VALUE FROM CONFIG WHERE NAME='AUTO_LOGIN';");
                                        $st->execute();
                         my @set = $st->fetchrow_array();
                                        if(@set && $set[0]=="1"){
                                                 $alias = $cre[0];
-                                                $passw = $cre[1];
+                                                $passw = $cre[1];                                               
                                        }
                }
 }
index 494187fd52b72d6deb5951a07f54bd8790c634de..58ddcc1e2544697f6736afc321cd027cec7522fb 100644 (file)
@@ -5,8 +5,15 @@
 #
 use strict;
 use warnings;
+use DBI;
+#DEFAULT SETTINGS HERE!
+our $LOG_PATH    = '/home/will/dev/LifeLog/dbLifeLog/';
 
 
+#END OF SETTINGS
+
+
+my @cre;
 
                open(my $fh, '<', '/home/will/dev/LifeLog/htdocs/cgi-bin/main.cnf' ) or die "Can't open main.cnf: $!";
                while (my $line = <$fh>) {
@@ -14,14 +21,34 @@ use warnings;
                                        if(rindex ($line, "<<AUTO_LOGIN<", 0)==0){
                                                 my $end = index $line, ">", 14;
                                                 my $crest = substr $line, 13, $end - 13;
-                         my @cre = split '/', $crest;
+                          @cre = split '/', $crest;
                          if(@cre &&scalar(@cre)>1){
-                         print @cre;
+                         print @cre; last;
                          }
 
                                        }
                }
        close $fh;
+
+               if(scalar(@cre)>1){                     
+
+                        my $database = $LOG_PATH.'data_'.$cre[0].'_log.db';
+                        my $dsn= "DBI:SQLite:dbname=$database";
+                        my $db = DBI->connect($dsn, $cre[0], $cre[1], { RaiseError => 1 }) 
+                                                               or die "<p>Error-></p>";
+                                       #check if enabled.      
+                        my $st = $db->prepare("SELECT VALUE FROM CONFIG WHERE NAME='AUTO_LOGIN';");
+                                       $st->execute();
+                        my @set = $st->fetchrow_array();
+             print $set[0];
+                                       if($set[0] eq "0"){
+                                               my $alias = $cre[0];
+                                               my $passw = $cre[1];                                             
+                                       }
+                    else{
+                        print "sucks cock!"
+                    }
+               }
 =Comm
 my $fh;
 my $inData = 0;