X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=am.pl;h=a70e4523304a44c464ac10077cf5546bcfd59ec2;hb=e66d4dda8ce261100c6a4c36671a1323caed9c11;hp=5b3d66622853706857ecbace0ef2d93fb1274d22;hpb=8c7e44938a661e035f62840e1e177353240ace5d;p=kivitendo-erp.git diff --git a/am.pl b/am.pl index 5b3d66622..a70e45233 100755 --- a/am.pl +++ b/am.pl @@ -30,22 +30,24 @@ # ####################################################################### +use strict; + BEGIN { unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML). push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version. } # setup defaults, DO NOT CHANGE -$userspath = "users"; -$templates = "templates"; -$memberfile = "users/members"; -$sendmail = "| /usr/sbin/sendmail -t"; +$main::userspath = "users"; +$main::templates = "templates"; +$main::memberfile = "users/members"; +$main::sendmail = "| /usr/sbin/sendmail -t"; ########## end ########################################### $| = 1; use SL::LXDebug; -$lxdebug = LXDebug->new(); +$main::lxdebug = LXDebug->new(); use CGI qw( -no_xhtml); use SL::Auth; @@ -63,13 +65,13 @@ if (!$auth->session_tables_present()) { _show_error('login/auth_db_unreachable'); } $auth->expire_sessions(); -$auth->restore_session(); +my $session_result = $auth->restore_session(); require "bin/mozilla/common.pl"; -if (defined($latex) && !defined($latex_templates)) { - $latex_templates = $latex; - undef($latex); +if (defined($main::latex) && !defined($main::latex_templates)) { + $main::latex_templates = $main::latex; + undef($main::latex); } # this prevents most of the tabindexes being created by CGI. @@ -79,8 +81,8 @@ local $CGI::TABINDEX = 0; # name of this script $0 =~ tr/\\/\//; -$pos = rindex $0, '/'; -$script = substr($0, $pos + 1); +my $pos = rindex $0, '/'; +my $script = substr($0, $pos + 1); # we use $script for the language module $form->{script} = $script; @@ -92,26 +94,32 @@ $script =~ s/\.pl//; use DBI; # locale messages -$locale = new Locale($language, "$script"); +$main::locale = new Locale($main::language, "$script"); +my $locale = $main::locale; # did sysadmin lock us out -if (-e "$userspath/nologin") { +if (-e "$main::userspath/nologin") { $form->error($locale->text('System currently down for maintenance!')); } +if (SL::Auth::SESSION_EXPIRED == $session_result) { + _show_error('login/password_error', 'session'); +} + $form->{login} =~ s|.*/||; -%myconfig = $auth->read_user($form->{login}); +%main::myconfig = $auth->read_user($form->{login}); +my %myconfig = %main::myconfig; if (!$myconfig{login}) { - _show_error('login/password_error'); + _show_error('login/password_error', 'password'); } # locale messages $locale = new Locale "$myconfig{countrycode}", "$script"; if (SL::Auth::OK != $auth->authenticate($form->{login}, $form->{password}, 0)) { - _show_error('login/password_error'); + _show_error('login/password_error', 'password'); } $auth->set_session_value('login', $form->{login}, 'password', $form->{password}); @@ -152,8 +160,11 @@ if ($form->{action}) { sub _show_error { my $template = shift; - $locale = Locale->new($language, 'all'); - $myconfig{countrycode} = $language; + my $error_type = shift; + my $locale = Locale->new($main::language, 'all'); + $form->{error} = $locale->text('The session is invalid or has expired.') if ($error_type eq 'session'); + $form->{error} = $locale->text('Incorrect password!.') if ($error_type eq 'password'); + $myconfig{countrycode} = $main::language; $form->{stylesheet} = 'css/lx-office-erp.css'; $form->header();