X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fadmin.pl;h=b89487c7ef42d61af4a2fa10126ab624e664383d;hb=1e0d413084100ccd892e8c5be95703be5d965de7;hp=3b37dab5ea5800b456fd19e9c63ee8542fc5f3dc;hpb=98fca2dc32e5603558ac019cf47df2656ec69214;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl old mode 100644 new mode 100755 index 3b37dab5e..b89487c7e --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -32,826 +32,461 @@ # #====================================================================== -$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; -$form->{"root"} = "root login"; +require "bin/mozilla/common.pl"; +require "bin/mozilla/admin_groups.pl"; +require "bin/mozilla/admin_printer.pl"; -$locale = new Locale $language, "admin"; +use strict; -eval { require DBI; }; -$form->error($locale->text('DBI not installed!')) if ($@); +our $cgi; +our $form; +our $locale; +our $auth; -# customization -if (-f "$form->{path}/custom_$form->{script}") { - eval { require "$form->{path}/custom_$form->{script}"; }; - $form->error($@) if ($@); -} +sub run { + $::lxdebug->enter_sub; + my $session_result = shift; -$form->{stylesheet} = "lx-office-erp.css"; -$form->{favicon} = "favicon.ico"; + $cgi = $::cgi; + $form = $::form; + $locale = $::locale; + $auth = $::auth; -if ($form->{action}) { + $::auth->set_session_value('rpw', $::form->{rpw}) if $session_result == SL::Auth->SESSION_OK; + $form->{stylesheet} = "lx-office-erp.css"; + $form->{favicon} = "favicon.ico"; - $subroutine = $locale->findsub($form->{action}); + 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(); + } - if ($subroutine eq 'login') { - if ($form->{rpw}) { - $form->{rpw} = crypt $form->{rpw}, "ro"; + call_sub($locale->findsub($form->{action})); } - } - - &check_password; - - &$subroutine; - -} 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= + } 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; +sub adminlogin { + my $form = $main::form; + my $locale = $main::locale; -# end + $form->{title} = qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); -sub adminlogin { + $form->header(); + print $form->parse_html_template('admin/adminlogin'); +} - $form->{title} = - qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); +sub login { + check_auth_db_and_tables(); + list_users(); +} - $form->header; +sub logout { + $main::auth->destroy_session(); + adminlogin(); +} - print qq| -
+sub check_auth_db_and_tables { + my $form = $main::form; + my $locale = $main::locale; + my %params; -| - . $locale->text('Administration') - . qq| + if (!$main::auth->check_database()) { + $form->{title} = $locale->text('Authentification database creation'); + $form->header(); + print $form->parse_html_template('admin/check_auth_database', \%params); -
+ my $memberfile = $::lx_office_conf{paths}->{memberfile}; + if (-f $memberfile) { + my $memberdir = ""; -Lx-Office | - . $locale->text('website') . qq| + if ($memberfile =~ m|^.*/|) { + $memberdir = $&; + } -