X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fadmin.pl;h=160d303660a90694fef462ac456d7bc395f2add6;hb=e4d8716c1ae11b6dacf553711848e749ed191d10;hp=e936b2a12430c68d8f04527ea53e822502bbb511;hpb=d629acd82a27e980899a044ca8b0f4becc8e94bb;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index e936b2a12..160d30366 100644 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -35,16 +35,39 @@ $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; -$form->{"root"} = "root login"; $locale = new Locale $language, "admin"; +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 "bin/mozilla/custom_$form->{script}") { eval { require "bin/mozilla/custom_$form->{script}"; }; @@ -55,39 +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; + } + $auth->create_or_refresh_session() if ($auth->session_tables_present()); - $subroutine = $locale->findsub($form->{action}); + call_sub($locale->findsub($form->{action})); - if ($subroutine eq 'login') { - if ($form->{rpw}) { - $form->{rpw} = crypt $form->{rpw}, "ro"; - } - } +} elsif ($auth->authenticate_root($form->{rpw}, 0) == Auth::OK) { - &check_password; + $auth->create_or_refresh_session() if ($auth->session_tables_present()); - call_sub($subroutine); + 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(); } @@ -97,756 +109,351 @@ password= sub adminlogin { - $form->{title} = - qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); - - $form->header; - - print qq| -
- - -| - . $locale->text('Administration') - . qq| - -
- -Lx-Office | - . $locale->text('website') . qq| - -