From ab00ae90ccd370de4ca0c3f73c6d732f45fd569b Mon Sep 17 00:00:00 2001 From: einhverfr Date: Sun, 7 Oct 2007 20:03:07 +0000 Subject: A few authentication fixes git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1715 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB.pm | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'LedgerSMB.pm') diff --git a/LedgerSMB.pm b/LedgerSMB.pm index 7980d0b4..2be20f6d 100755 --- a/LedgerSMB.pm +++ b/LedgerSMB.pm @@ -646,6 +646,7 @@ sub _db_init { $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,16 +660,6 @@ sub _db_init { ); 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 @@ -679,10 +670,21 @@ sub _db_init { 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. -- cgit v1.2.3