Merge branch 'master' of lx-office.linet-services.de:lx-office-erp
[kivitendo-erp.git] / bin / mozilla / login.pl
index 43ef952..94905e4 100644 (file)
@@ -65,12 +65,13 @@ sub run {
     %::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))) {
+    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));
@@ -111,6 +112,12 @@ 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!'));
     ::end_of_request();
@@ -183,6 +190,7 @@ sub show_error {
   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();