X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fadmin.pl;h=4248a9c126ac8df985a08c465d95446593661790;hb=6cbeab9a2d7691fa8fb69faab3f21a662df8740f;hp=a6200bad227be8def10e3d6be7a403fe08211180;hpb=8c7e44938a661e035f62840e1e177353240ace5d;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index a6200bad2..4248a9c12 100644 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -78,10 +78,7 @@ $form->{stylesheet} = "lx-office-erp.css"; $form->{favicon} = "favicon.ico"; if ($form->{action}) { - - $subroutine = $locale->findsub($form->{action}); - - if ($auth->authenticate_root($form->{rpw}, 0)) { + if ($auth->authenticate_root($form->{rpw}, 0) != Auth::OK) { $form->{error_message} = $locale->text('Incorrect Password!'); adminlogin(); exit; @@ -89,10 +86,15 @@ if ($form->{action}) { $auth->create_or_refresh_session() if ($auth->session_tables_present()); - call_sub($subroutine); + call_sub($locale->findsub($form->{action})); -} else { +} elsif ($auth->authenticate_root($form->{rpw}, 0) == Auth::OK) { + + $auth->create_or_refresh_session() if ($auth->session_tables_present()); + + login(); +} else { # if there are no drivers bail out $form->error($locale->text('No Database Drivers available!')) unless (User->dbdrivers); @@ -626,12 +628,29 @@ sub dbselect_source { $form->{title} = "Lx-Office ERP / " . $locale->text('Database Administration'); - $form->{ALLOW_DBBACKUP} = "$pg_dump_exe" ne "DISABLED"; + # Intentionnaly disabled unless fixed to work with the authentication DB. + $form->{ALLOW_DBBACKUP} = 0; # "$pg_dump_exe" ne "DISABLED"; $form->header(); print $form->parse_html_template("admin/dbadmin"); } +sub test_db_connection { + $form->{dbdriver} = 'Pg'; + User::dbconnect_vars($form, $form->{dbname}); + + my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}); + + $form->{connection_ok} = $dbh ? 1 : 0; + $form->{errstr} = $DBI::errstr; + + $dbh->disconnect() if ($dbh); + + $form->{title} = $locale->text('Database Connection Test'); + $form->header(); + print $form->parse_html_template("admin/test_db_connection"); +} + sub continue { call_sub($form->{"nextsub"}); }