[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1715] trunk



Revision: 1715
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1715&view=rev
Author:   einhverfr
Date:     2007-10-07 13:03:07 -0700 (Sun, 07 Oct 2007)

Log Message:
-----------
A few authentication fixes

Modified Paths:
--------------
    trunk/LedgerSMB.pm
    trunk/sql/Pg-database.sql

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-10-07 06:57:40 UTC (rev 1714)
+++ trunk/LedgerSMB.pm	2007-10-07 20:03:07 UTC (rev 1715)
@@ -646,6 +646,7 @@
     $auth =~ s/Basic //i; # strip out basic authentication preface
     $auth = MIME::Base64::decode($auth);
     my ($login, $password) = split(/:/, $auth);
+    print STDERR "$auth\n";
     $self->{login} = $login;
     $self->{company} ||= 'lsmb13';
     my $dbname = $self->{company};
@@ -659,18 +660,8 @@
     ); 
      my $dbh = $self->{dbh};
 
-    # This is the general version check
-    my $sth = $dbh->prepare("
-            SELECT value FROM defaults 
-             WHERE setting_key = 'version'");
-    $sth->execute;
 
-    my ($dbversion) = $sth->fetchrow_array;
-    if ($dbversion ne $self->{dbversion}){
-        $self->error("Database is not the expected version.");
-    }
 
-
     if (($self->{script} eq 'login.pl') && ($self->{action} eq 
         'authenticate')){
 
@@ -679,10 +670,21 @@
     elsif (!$dbh){
         $self->_get_password;
     }
-
     $dbh->{pg_server_prepare} = 0;
     $dbh->{pg_enable_utf8} = 1;
 
+    # This is the general version check
+    my $sth = $dbh->prepare("
+            SELECT value FROM defaults 
+             WHERE setting_key = 'version'");
+    $sth->execute;
+    my ($dbversion) = $sth->fetchrow_array;
+    if ($dbversion ne $self->{dbversion}){
+        $self->error("Database is not the expected version.");
+    }
+
+
+
     
     # TODO:  Add date handling settings and the like.
 

Modified: trunk/sql/Pg-database.sql
===================================================================
--- trunk/sql/Pg-database.sql	2007-10-07 06:57:40 UTC (rev 1714)
+++ trunk/sql/Pg-database.sql	2007-10-07 20:03:07 UTC (rev 1715)
@@ -53,7 +53,12 @@
 CREATE TABLE users (
     id serial UNIQUE, 
     username varchar(30) primary key,
-    entity_id int not null references entity(id) on delete cascade
+    entity_id int not null references employee(entity_id) on delete cascade,
+    language text references country(short_name),
+    stylesheet text default 'ledgersmb.css' not null,
+    printer text,
+    dateformat text default 'yyyy-mm-dd' not null,
+    numberformat text default '1000.00' not null
 );
 COMMENT ON TABLE users IS $$username is the actual primary key here because we do not want duplicate users$$;
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.