X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fadmin.pl;h=42efda84250977e5d44ec8f1b9d147a9a161e007;hb=dbd0ae115bd9a6ba0ede24f9655a29df6bf7dc3b;hp=b2f7576af91e9a49473d9782a05e5973ccde7f80;hpb=7c15cba2557382a9f99134873026217f036b00b1;p=kivitendo-erp.git diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl old mode 100644 new mode 100755 index b2f7576af..42efda842 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -32,22 +32,45 @@ # #====================================================================== -$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; -$form->{"root"} = "root login"; +use strict; -$locale = new Locale $language, "admin"; +our $cgi = new CGI(''); +our $form = new Form; +our $locale = new Locale $main::language, "admin"; +our $auth = SL::Auth->new(); -eval { require DBI; }; -$form->error($locale->text('DBI not installed!')) if ($@); +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 ($@); } @@ -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()); - &$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(); } @@ -96,747 +108,390 @@ password= # 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; -
+ exit 0; + } -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); -