generic translations strict
[kivitendo-erp.git] / bin / mozilla / login.pl
index 7a4df5c..92fa25d 100644 (file)
@@ -52,7 +52,7 @@ if (!$auth->session_tables_present()) {
   show_error('login/auth_db_unreachable');
 }
 $auth->expire_sessions();
-$auth->restore_session();
+my $session_result = $auth->restore_session();
 
 # customization
 if (-f "bin/mozilla/custom_$form->{script}") {
@@ -69,6 +69,12 @@ if (-f "bin/mozilla/$form->{login}_$form->{script}") {
 # window title bar, user info
 $form->{titlebar} = "Lx-Office " . $locale->text('Version') . " $form->{version}";
 
+if (SL::Auth::SESSION_EXPIRED == $session_result) {
+  $form->{error_message} = $locale->text('The session is invalid or has expired.');
+  login_screen();
+  exit;
+}
+
 my $action = $form->{action};
 
 if (!$action && $auth->{SESSION}->{login}) {
@@ -104,9 +110,8 @@ sub login_screen {
     $form->{stylesheet} = "lx-office-erp.css";
   }
 
-  $form->{msg}   = $msg;
-  $form->{fokus} = "loginscreen.login";
-  $form->header;
+  $form->{msg} = $msg;
+  $form->header();
 
   print $form->parse_html_template('login/login_screen');
 
@@ -132,13 +137,14 @@ sub login {
 
   my %style_to_script_map = ( 'v3'  => 'v3',
                               'neu' => 'new',
+                              'v4' => 'v4',
                               'xml' => 'XML',
     );
 
   my $menu_script = $style_to_script_map{$user->{menustyle}} || '';
 
   # made it this far, execute the menu
-  $form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display');
+  $form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display', "callback=" . $form->escape($form->{callback}));
 
   $auth->set_cookie_environment_variable();