X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Flogin.pl;h=94905e4edca453fe6b70bb23a838977df31d344c;hb=0a612d2fe7ec14c9ed3f7d0d036e1c63d3027f4f;hp=622db697dbdba1121371e9dd2c3b1f9b3fdac23c;hpb=b2945bf61775161f9ce9be9bdbd106ad44247a14;p=kivitendo-erp.git diff --git a/bin/mozilla/login.pl b/bin/mozilla/login.pl index 622db697d..94905e4ed 100644 --- a/bin/mozilla/login.pl +++ b/bin/mozilla/login.pl @@ -39,7 +39,6 @@ use strict; our $cgi; our $form; -our $locale; our $auth; sub run { @@ -48,14 +47,13 @@ sub run { $cgi = $::cgi; $form = $::form; - $locale = $::locale; $auth = $::auth; $form->{stylesheet} = "lx-office-erp.css"; $form->{favicon} = "favicon.ico"; if (SL::Auth::SESSION_EXPIRED == $session_result) { - $form->{error_message} = $locale->text('The session is invalid or has expired.'); + $form->{error_message} = $::locale->text('The session is invalid or has expired.'); login_screen(); ::end_of_request(); } @@ -64,17 +62,19 @@ sub run { $action = 'login'; } if ($action) { - our %myconfig = $auth->read_user($form->{login}) if ($form->{login}); + %::myconfig = $auth->read_user($form->{login}) if ($form->{login}); + $::locale = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode}; - if (!$myconfig{login} || (SL::Auth::OK != $auth->authenticate($form->{login}, $form->{password}, 0))) { - $form->{error_message} = $locale->text('Incorrect Password!'); + if (SL::Auth::OK != $auth->authenticate($::myconfig{login}, $form->{password})) { + $form->{error_message} = $::locale->text('Incorrect username or password!'); login_screen(); } else { - $auth->set_session_value('login', $form->{login}, 'password', $form->{password}); + $auth->store_credentials_in_session(login => $form->{login}, password => $form->{password}); $auth->create_or_refresh_session(); + delete $form->{password}; - $form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}"; - call_sub($locale->findsub($action)); + $form->{titlebar} .= " - $::myconfig{name} - $::myconfig{dbname}"; + call_sub($::locale->findsub($action)); } } else { login_screen(); @@ -103,7 +103,7 @@ sub login { $main::lxdebug->enter_sub(); unless ($form->{login}) { - login_screen($locale->text('You did not enter a name!')); + login_screen($::locale->text('You did not enter a name!')); ::end_of_request(); } @@ -112,8 +112,14 @@ sub login { # if we get an error back, bale out my $result; if (($result = $user->login($form)) <= -1) { + if ($result == -3) { + show_error('login/auth_db_needs_update'); + $::auth->destroy_session; + ::end_of_request(); + } + ::end_of_request() if $result == -2; - login_screen($locale->text('Incorrect username or password!')); + login_screen($::locale->text('Incorrect username or password!')); ::end_of_request(); } @@ -151,7 +157,7 @@ sub logout { # remove the callback to display the message $form->{callback} = "login.pl?action="; - $form->redirect($locale->text('You are logged out!')); + $form->redirect($::locale->text('You are logged out!')); $main::lxdebug->leave_sub(); } @@ -160,12 +166,11 @@ sub company_logo { $main::lxdebug->enter_sub(); my %myconfig = %main::myconfig; - $locale = new Locale $myconfig{countrycode}, "login" if ($main::language ne $myconfig{countrycode}); - $form->{todo_list} = create_todo_list('login_screen' => 1) if (!$form->{no_todo_list}); $form->{stylesheet} = $myconfig{stylesheet}; - $form->{title} = $locale->text('About'); + $form->{title} = $::locale->text('Lx-Office'); + $form->{interface} = $::dispatcher->interface_type; # create the logo screen $form->header() unless $form->{noheader}; @@ -177,15 +182,15 @@ sub company_logo { sub show_error { my $template = shift; - my %myconfig = %main::myconfig; - $locale = Locale->new($main::language, 'all'); - $myconfig{countrycode} = $main::language; + my %myconfig = %main::myconfig; + $myconfig{countrycode} = $::lx_office_conf{system}->{language}; $form->{stylesheet} = 'css/lx-office-erp.css'; $form->header(); print $form->parse_html_template($template); # $form->parse_html_template('login/auth_db_unreachable'); + # $form->parse_html_template('login/auth_db_needs_update'); # $form->parse_html_template('login/authentication_pl_missing'); ::end_of_request();