X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fadmin.pl;h=42efda84250977e5d44ec8f1b9d147a9a161e007;hb=dbd0ae115bd9a6ba0ede24f9655a29df6bf7dc3b;hp=9856c29550de158ee6ae7626107498ea81e35101;hpb=4dbb09950c9f5596646537c12d991c99086fe7c1;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl old mode 100644 new mode 100755 index 9856c2955..42efda842 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -32,840 +32,494 @@ # #====================================================================== -$menufile = "menu.ini"; - +my $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"; -$form = new Form; +use strict; -$locale = new Locale $language, "admin"; - -eval { require DBI; }; -$form->error($locale->text('DBI not installed!')) if ($@); +our $cgi = new CGI(''); +our $form = new Form; +our $locale = new Locale $main::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 "$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 ($@); } - $form->{stylesheet} = "lx-office-erp.css"; -$form->{favicon} = "favicon.ico"; +$form->{favicon} = "favicon.ico"; if ($form->{action}) { - - $subroutine = $locale->findsub($form->{action}); - - if ($subroutine eq 'login') { - if ($form->{rpw}) { - $form->{rpw} = crypt $form->{rpw}, "ro"; - } + if ($auth->authenticate_root($form->{rpw}, 0) != $auth->OK()) { + $form->{error_message} = $locale->text('Incorrect Password!'); + adminlogin(); + exit; } - - &check_password; - - &$subroutine; - -} else { - # if there are no drivers bail out - $form->error($locale->text('No Database Drivers available!')) unless (User->dbdrivers); + $auth->create_or_refresh_session() if ($auth->session_tables_present()); - # create memberfile - if (! -f $memberfile) { - open(FH, ">$memberfile") or $form->error("$memberfile : $!"); - print FH qq|# SQL-Ledger Accounting members + call_sub($locale->findsub($form->{action})); -[root login] -password= +} elsif ($auth->authenticate_root($form->{rpw}, 0) == $auth->OK()) { -|; - close FH; - } + $auth->create_or_refresh_session() if ($auth->session_tables_present()); + + login(); + +} else { + # if there are no drivers bail out + $form->error($locale->text('No Database Drivers available!')) + unless (User->dbdrivers); - &adminlogin; + adminlogin(); } 1; -# end +# end sub adminlogin { + my $form = $main::form; + my $locale = $main::locale; + + $form->{title} = qq|Lx-Office ERP $form->{version} | . $locale->text('Administration'); - $form->{title} = qq|Lx-Office ERP $form->{version} |.$locale->text('Administration'); + $form->header(); + print $form->parse_html_template('admin/adminlogin'); +} - $form->header; - - print qq| -
+sub login { + check_auth_db_and_tables(); + list_users(); +} +sub logout { + $main::auth->destroy_session(); + adminlogin(); +} -|.$locale->text('Administration').qq| + my %params; -
+ if (!$main::auth->check_tables()) { + $form->{title} = $locale->text('Authentification tables creation'); + $form->header(); + print $form->parse_html_template('admin/check_auth_tables', \%params); -Lx-Office |.$locale->text('website').qq| + exit 0; + } -