X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fadmin.pl;h=3a5e810c25a9e713b24f37633cff355295f06112;hb=a3f90d6fa23d0a8d026682511e7624bd847d532f;hp=f100267291de78c205789bf446cbb95ba51d56e3;hpb=33fd3fa62717f07004f7533679d95f5084caf728;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl old mode 100644 new mode 100755 index f10026729..3a5e810c2 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -32,806 +32,454 @@ # #====================================================================== -$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; -$form = new Form; -$form->{"root"} = "root login"; - -$locale = new Locale $language, "admin"; +require "bin/mozilla/common.pl"; +require "bin/mozilla/admin_groups.pl"; +require "bin/mozilla/admin_printer.pl"; -eval { require DBI; }; -$form->error($locale->text('DBI not installed!')) if ($@); +use strict; -# customization -if (-f "$form->{path}/custom_$form->{script}") { - eval { require "$form->{path}/custom_$form->{script}"; }; - $form->error($@) if ($@); -} +our $cgi; +our $form; +our $locale; +our $auth; -$form->{stylesheet} = "lx-office-erp.css"; -$form->{favicon} = "favicon.ico"; +sub run { + $::lxdebug->enter_sub; + my $session_result = shift; -if ($form->{action}) { + $cgi = $::cgi; + $form = $::form; + $locale = $::locale; + $auth = $::auth; + $::auth->set_session_value('rpw', $::form->{rpw}) if $session_result == SL::Auth->SESSION_OK; - $subroutine = $locale->findsub($form->{action}); + $form->{stylesheet} = "lx-office-erp.css"; + $form->{favicon} = "favicon.ico"; - if ($subroutine eq 'login') { - if ($form->{rpw}) { - $form->{rpw} = crypt $form->{rpw}, "ro"; + 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(); + } + 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); + } elsif ($auth->authenticate_root($form->{rpw}, 0) == $auth->OK()) { - # create memberfile - if (!-f $memberfile) { - open(FH, ">$memberfile") or $form->error("$memberfile : $!"); - print FH qq|# SQL-Ledger Accounting members + $auth->create_or_refresh_session() if ($auth->session_tables_present()); -[root login] -password= + login(); + } 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); -