+$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}) {
+ $action = 'login';
+}
+
+if ($action) {
+ our %myconfig = $auth->read_user($form->{login}) if ($form->{login});
+
+ if (!$myconfig{login} || (SL::Auth::OK != $auth->authenticate($form->{login}, $form->{password}, 0))) {
+ $form->{error_message} = $locale->text('Incorrect Password!');
+ login_screen();
+ exit;
+ }
+
+ $auth->set_session_value('login', $form->{login}, 'password', $form->{password});
+ $auth->create_or_refresh_session();