X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fadmin.pl;h=eee799958f92a7173a98634dd926e4ffd91b35a6;hb=1e513d1dc428b188ac7acbf06de82d32c5d79f1a;hp=c1fbb7c6c2968ff0c12607294494a04161390340;hpb=9a22f14c16b2ba3ee47bc2ea0c97078260e3c167;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl old mode 100644 new mode 100755 index c1fbb7c6c..eee799958 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -32,797 +32,457 @@ # #====================================================================== -$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::Auth::PasswordPolicy; use SL::Form; +use SL::Iconv; +use SL::Mailer; use SL::User; +use SL::Common; +use SL::Inifile; +use SL::DBUpgrade2; +use SL::DBUtils; -$form = new Form; - -$locale = new Locale $language, "admin"; - -eval { require DBI; }; -$form->error($locale->text('DBI not installed!')) if ($@); - -# customization -if (-f "$form->{path}/custom_$form->{script}") { - eval { require "$form->{path}/custom_$form->{script}"; }; - $form->error($@) if ($@); -} - -$form->{stylesheet} = "lx-office-erp.css"; -$form->{favicon} = "favicon.ico"; +require "bin/mozilla/common.pl"; +require "bin/mozilla/admin_groups.pl"; +require "bin/mozilla/admin_printer.pl"; -if ($form->{action}) { +use strict; - $subroutine = $locale->findsub($form->{action}); +our $cgi; +our $form; +our $locale; +our $auth; - if ($subroutine eq 'login') { - if ($form->{rpw}) { - $form->{rpw} = crypt $form->{rpw}, "ro"; - } - } +sub run { + $::lxdebug->enter_sub; + my $session_result = shift; - &check_password; + $cgi = $::cgi; + $form = $::form; + $locale = $::locale; + $auth = $::auth; - &$subroutine; + $::auth->set_session_value('rpw', $::form->{rpw}) if $session_result == SL::Auth->SESSION_OK; -} else { + $form->{stylesheet} = "lx-office-erp.css"; + $form->{favicon} = "favicon.ico"; - # 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 + if ($form->{action}) { + if ($auth->authenticate_root($form->{rpw}, 0) != $auth->OK()) { + $form->{error_message} = $locale->text('Incorrect Password!'); + adminlogin(); + } else { + if ($auth->session_tables_present()) { + $::auth->set_session_value('rpw', $::form->{rpw}); + $::auth->create_or_refresh_session(); + _apply_dbupgrade_scripts(); + } -[root login] -password= + call_sub($locale->findsub($form->{action})); + } + } else { + # if there are no drivers bail out + $form->error($locale->text('No Database Drivers available!')) + unless (User->dbdrivers); -|; - close FH; + adminlogin(); } - - &adminlogin; - + $::lxdebug->leave_sub; } -1; - -# end - sub adminlogin { + my $form = $main::form; + my $locale = $main::locale; - $form->{title} = - qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); - - $form->header; + $form->{title} = qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); - print qq| -
+ $form->header(); + print $form->parse_html_template('admin/adminlogin'); +} +sub login { + check_auth_db_and_tables(); + list_users(); +} -| - . $locale->text('Administration') - . qq| +sub check_auth_db_and_tables { + my $form = $main::form; + my $locale = $main::locale; -
+ ::end_of_request(); + } -Lx-Office | - . $locale->text('website') . qq| + if (!$main::auth->check_tables()) { + $form->{title} = $locale->text('Authentification tables creation'); + $form->header(); + print $form->parse_html_template('admin/check_auth_tables', \%params); -