X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/6c7e41458d2027f72901d16417a37648942f7445..d73a8843d998152d2384a6bb5fd966badcb1e505:/SL/Auth.pm diff --git a/SL/Auth.pm b/SL/Auth.pm index bf2a6a851..6bb7bfaa7 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -33,6 +33,26 @@ sub new { return $self; } +sub get_user_dbh { + my ($self, $login) = @_; + my %user = $self->read_user($login); + my $dbh = DBI->connect( + $user{dbconnect}, + $user{dbuser}, + $user{dbpasswd}, + { + pg_enable_utf8 => $::locale->is_utf8, + AutoCommit => 0 + } + ) or $::form->dberror; + + if ($user{dboptions}) { + $dbh->do($user{dboptions}) or $::form->dberror($user{dboptions}); + } + + return $dbh; +} + sub DESTROY { my $self = shift; @@ -106,7 +126,9 @@ sub authenticate_root { $main::lxdebug->leave_sub(); - return $password eq $admin_password ? OK : ERR_PASSWORD; + return OK if $password eq $admin_password; + sleep 5; + return ERR_PASSWORD; } sub authenticate { @@ -116,7 +138,10 @@ sub authenticate { $main::lxdebug->leave_sub(); - return $self->{authenticator}->authenticate(@_); + my $result = $self->{authenticator}->authenticate(@_); + return OK if $result eq OK; + sleep 5; + return $result; } sub dbconnect {