X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fadmin.pl;h=02821989668c7a40ff5face5127cf67e358df650;hb=a25cb06e5823fc35924c0eae0c358763841307d0;hp=afd284bd932b38ee117d8be14269434f6b60530c;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl old mode 100644 new mode 100755 index afd284bd9..028219896 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -34,19 +34,43 @@ $menufile = "menu.ini"; +use DBI; +use CGI; +use English qw(-no_match_vars); +use Fcntl; +use File::Copy; +use IO::File; +use POSIX qw(strftime); +use Sys::Hostname; + +use SL::Auth; use SL::Form; +use SL::Mailer; use SL::User; +use SL::Common; +use SL::Inifile; +use SL::DBUpgrade2; +use SL::DBUtils; + +require "bin/mozilla/common.pl"; +require "bin/mozilla/admin_groups.pl"; + +our $cgi = new CGI(''); $form = new Form; $locale = new Locale $language, "admin"; -eval { require DBI; }; -$form->error($locale->text('DBI not installed!')) if ($@); +our $auth = SL::Auth->new(); +if ($auth->session_tables_present()) { + $auth->expire_sessions(); + $auth->restore_session(); + $auth->set_session_value('rpw', $form->{rpw}); +} # customization -if (-f "$form->{path}/custom_$form->{script}") { - eval { require "$form->{path}/custom_$form->{script}"; }; +if (-f "bin/mozilla/custom_$form->{script}") { + eval { require "bin/mozilla/custom_$form->{script}"; }; $form->error($@) if ($@); } @@ -54,38 +78,28 @@ $form->{stylesheet} = "lx-office-erp.css"; $form->{favicon} = "favicon.ico"; if ($form->{action}) { + if ($auth->authenticate_root($form->{rpw}, 0) != Auth::OK) { + $form->{error_message} = $locale->text('Incorrect Password!'); + adminlogin(); + exit; + } - $subroutine = $locale->findsub($form->{action}); + $auth->create_or_refresh_session() if ($auth->session_tables_present()); - if ($subroutine eq 'login') { - if ($form->{rpw}) { - $form->{rpw} = crypt $form->{rpw}, "ro"; - } - } + call_sub($locale->findsub($form->{action})); - &check_password; +} elsif ($auth->authenticate_root($form->{rpw}, 0) == Auth::OK) { - &$subroutine; + $auth->create_or_refresh_session() if ($auth->session_tables_present()); -} else { + login(); +} else { # if there are no drivers bail out $form->error($locale->text('No Database Drivers available!')) unless (User->dbdrivers); - # create memberfile - if (!-f $memberfile) { - open(FH, ">$memberfile") or $form->error("$memberfile : $!"); - print FH qq|# SQL-Ledger Accounting members - -[root login] -password= - -|; - close FH; - } - - &adminlogin; + adminlogin(); } @@ -95,736 +109,351 @@ password= sub adminlogin { - $form->{title} = - qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); - - $form->header; - - print qq| -
+ $form->{title} = qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); + $form->header(); + print $form->parse_html_template('admin/adminlogin'); +} -| - . $locale->text('Administration') - . qq| +sub logout { + $auth->destroy_session(); + adminlogin(); +} -
+ exit 0; + } -Lx-Office | - . $locale->text('website') . qq| + if (!$auth->check_tables()) { + $form->{title} = $locale->text('Authentification tables creation'); + $form->header(); + print $form->parse_html_template('admin/check_auth_tables', \%params); -