User-Login auf Controller umgestellt
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 17 Aug 2012 12:23:52 +0000 (14:23 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 17 Aug 2012 15:46:33 +0000 (17:46 +0200)
32 files changed:
SL/Auth.pm
SL/Controller/Base.pm
SL/Controller/LoginScreen.pm [new file with mode: 0644]
SL/Dispatcher.pm
SL/Dispatcher/AuthHandler.pm
SL/Dispatcher/AuthHandler/Admin.pm
SL/Dispatcher/AuthHandler/None.pm [new file with mode: 0644]
SL/Dispatcher/AuthHandler/User.pm
bin/mozilla/admin.pl
bin/mozilla/login.pl
bin/mozilla/menujs.pl
index.html
locale/de/all
locale/de_DE/all
menu.ini
templates/webpages/admin/adminlogin.html
templates/webpages/admin/list_users.html
templates/webpages/dbupgrade/warning.html
templates/webpages/login/auth_db_needs_update.html [deleted file]
templates/webpages/login/auth_db_unreachable.html [deleted file]
templates/webpages/login/authentication_pl_missing.html [deleted file]
templates/webpages/login/login_screen.html [deleted file]
templates/webpages/login/old_configuration_files.html [deleted file]
templates/webpages/login/password_error.html [deleted file]
templates/webpages/login_screen/auth_db_needs_update.html [new file with mode: 0644]
templates/webpages/login_screen/auth_db_unreachable.html [new file with mode: 0644]
templates/webpages/login_screen/old_configuration_files.html [new file with mode: 0644]
templates/webpages/login_screen/user_login.html [new file with mode: 0644]
templates/webpages/menu/header.html
templates/webpages/menu/menunew.html
templates/webpages/menu/menuv3.html
templates/webpages/menu/menuv4.html

index 4c50ddf..ed5c845 100644 (file)
@@ -149,7 +149,7 @@ sub authenticate_root {
 
   my ($self, $password) = @_;
 
-  my $session_root_auth = $self->get_session_value(SESSION_KEY_ROOT_AUTH);
+  my $session_root_auth = $self->get_session_value(SESSION_KEY_ROOT_AUTH());
   if (defined $session_root_auth && $session_root_auth == OK) {
     $::lxdebug->leave_sub;
     return OK;
@@ -164,9 +164,7 @@ sub authenticate_root {
   my $admin_password    = SL::Auth::Password->hash_if_unhashed(login => 'root', password => $self->{admin_password}->());
 
   my $result = $password eq $admin_password ? OK : ERR_PASSWORD;
-  $self->set_session_value(SESSION_KEY_ROOT_AUTH ,=> $result);
-
-  sleep 5 if $result != OK;
+  $self->set_session_value(SESSION_KEY_ROOT_AUTH() => $result);
 
   $::lxdebug->leave_sub;
   return $result;
@@ -177,7 +175,7 @@ sub authenticate {
 
   my ($self, $login, $password) = @_;
 
-  my $session_auth = $self->get_session_value(SESSION_KEY_USER_AUTH);
+  my $session_auth = $self->get_session_value(SESSION_KEY_USER_AUTH());
   if (defined $session_auth && $session_auth == OK) {
     $::lxdebug->leave_sub;
     return OK;
@@ -189,14 +187,16 @@ sub authenticate {
   }
 
   my $result = $login ? $self->{authenticator}->authenticate($login, $password) : ERR_USER;
-  $self->set_session_value(SESSION_KEY_USER_AUTH ,=> $result, login => $login);
-
-  sleep 5 if $result != OK;
+  $self->set_session_value(SESSION_KEY_USER_AUTH() => $result, login => $login);
 
   $::lxdebug->leave_sub;
   return $result;
 }
 
+sub punish_wrong_login {
+  sleep 5;
+}
+
 sub get_stored_password {
   my ($self, $login) = @_;
 
index 29289ff..f99b1e7 100644 (file)
@@ -21,11 +21,20 @@ sub url_for {
 
   my %params      = ref($_[0]) eq 'HASH' ? %{ $_[0] } : @_;
   my $controller  = delete($params{controller}) || $self->_controller_name;
-  my $action      = delete($params{action})     || 'dispatch';
-  $params{action} = "${controller}/${action}";
+  my $action      = $params{action}             || 'dispatch';
+
+  my $script;
+  if ($controller =~ m/\.pl$/) {
+    # Old-style controller
+    $script = $controller;
+  } else {
+    $params{action} = "${controller}/${action}";
+    $script         = "controller.pl";
+  }
+
   my $query       = join '&', map { uri_encode($_->[0]) . '=' . uri_encode($_->[1]) } @{ flatten(\%params) };
 
-  return "controller.pl?${query}";
+  return "${script}?${query}";
 }
 
 sub redirect_to {
@@ -172,6 +181,10 @@ sub get_auth_level {
   return 'user';
 }
 
+sub keep_auth_vars_in_form {
+  return 0;
+}
+
 #
 # private functions -- for use in Base only
 #
@@ -517,6 +530,13 @@ C<user> (authentication as a normal user suffices) with a possible
 future value C<none> (which would require no authentication but is not
 yet implemented).
 
+=item C<keep_auth_vars_in_form>
+
+May be overridden by a controller. If falsish (the default) all form
+variables whose name starts with C<{AUTH}> are removed before the
+request is routed. Only controllers that handle login requests
+themselves should return trueish for this function.
+
 =back
 
 =head2 PRIVATE FUNCTIONS
diff --git a/SL/Controller/LoginScreen.pm b/SL/Controller/LoginScreen.pm
new file mode 100644 (file)
index 0000000..f561a39
--- /dev/null
@@ -0,0 +1,82 @@
+package SL::Controller::LoginScreen;
+
+use strict;
+
+use parent qw(SL::Controller::Base);
+
+use SL::Dispatcher::AuthHandler::User;
+use SL::User;
+
+#
+# actions
+#
+
+sub action_user_login {
+  my ($self) = @_;
+
+  $self->render('login_screen/user_login');
+}
+
+sub action_logout {
+  my ($self) = @_;
+
+  $::auth->destroy_session;
+  $::auth->create_or_refresh_session;
+  $self->render('login_screen/user_login', error => $::locale->text('You are logged out!'));
+}
+
+sub action_login {
+  my ($self) = @_;
+
+  %::myconfig      = $::form->{'{AUTH}login'} ? $::auth->read_user(login => $::form->{'{AUTH}login'}) : ();
+  %::myconfig      = SL::Dispatcher::AuthHandler::User->new->handle(countrycode => $::myconfig{countrycode});
+  $::form->{login} = $::myconfig{login};
+  $::locale        = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode};
+  my $user         = User->new(login => $::myconfig{login});
+
+  # if we get an error back, bale out
+  my $result = $user->login($::form);
+
+  # Database update available?
+  ::end_of_request() if -2 == $result;
+
+  # Auth DB needs update? If so log the user out forcefully.
+  if (-3 == $result) {
+    $::auth->destroy_session;
+    return $self->render('login_screen/auth_db_needs_update');
+  }
+
+  # Other login errors.
+  if (0 > $result) {
+    $::auth->punish_wrong_login;
+    return $self->render('login_screen/user_login', error => $::locale->text('Incorrect username or password!'));
+  }
+
+  # Everything is fine.
+  $::auth->set_cookie_environment_variable();
+
+  return $self->redirect_to($::form->{callback}) if $::form->{callback};
+
+  my %style_to_script_map = (
+    v3  => 'v3',
+    neu => 'new',
+    v4  => 'v4',
+  );
+
+  my $menu_script = $style_to_script_map{$user->{menustyle}} || '';
+
+  $self->redirect_to(controller => "menu${menu_script}.pl", action => 'display');
+}
+
+#
+# settings
+#
+sub get_auth_level {
+  return 'none';
+}
+
+sub keep_auth_vars_in_form {
+  return 1;
+}
+
+1;
index 747da04..f6c9f60 100644 (file)
@@ -56,7 +56,7 @@ sub pre_request_checks {
       ::run();
       ::end_of_request();
     } else {
-      show_error('login/auth_db_unreachable');
+      show_error('login_screen/auth_db_unreachable');
     }
   }
 }
@@ -67,10 +67,10 @@ sub show_error {
   my $error_type           = shift || '';
   my %params               = @_;
 
-  $::locale                = Locale->new($::lx_office_conf{system}->{language});
+  $::myconfig{countrycode} = delete($params{countrycode}) || $::lx_office_conf{system}->{language};
+  $::locale                = Locale->new($::myconfig{countrycode});
   $::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} = $::lx_office_conf{system}->{language};
+  $::form->{error}         = $::locale->text('Incorrect password!')                    if ($error_type eq 'password');
 
   $::form->header;
   print $::form->parse_html_template($template, \%params);
@@ -200,24 +200,29 @@ sub handle_request {
 
     $::form->error($::locale->text('System currently down for maintenance!')) if -e ($::lx_office_conf{paths}->{userspath} . "/nologin") && $script ne 'admin';
 
-    if ($script eq 'login' or $script eq 'admin') {
-      $::form->{titlebar} = "Lx-Office " . $::locale->text('Version') . " $::form->{version}";
+    ($routing_type, $script, $script_name, $action) = qw(controller controller LoginScreen login) if ($script eq 'login') && ($action eq 'login');
+
+    if (($script eq 'login') && !$action) {
+      print $::request->{cgi}->redirect('controller.pl?action=LoginScreen/user_login');
+
+    } elsif ($script eq 'admin') {
+      $::form->{titlebar} = "kivitendo " . $::locale->text('Version') . " $::form->{version}";
       ::run($session_result);
 
     } else {
-      show_error('login/password_error', 'session') if SL::Auth::SESSION_EXPIRED == $session_result;
+      show_error('login_screen/user_login', 'session') if SL::Auth::SESSION_EXPIRED == $session_result;
 
-      my $auth_level = $self->{auth_handler}->handle(
+      my %auth_result = $self->{auth_handler}->handle(
         routing_type => $routing_type,
         script       => $script,
         controller   => $script_name,
         action       => $action,
       );
 
-      delete @{ $::form }{ grep { m/^\{AUTH\}/ } keys %{ $::form } };
+      delete @{ $::form }{ grep { m/^\{AUTH\}/ } keys %{ $::form } } unless $auth_result{keep_auth_vars};
 
       if ($action) {
-        $::instance_conf->init if $auth_level eq 'user';
+        $::instance_conf->init if $auth_result{auth_level} eq 'user';
 
         map { $::form->{$_} = $::myconfig{$_} } qw(charset)
           unless $action eq 'save' && $::form->{type} eq 'preferences';
@@ -371,9 +376,9 @@ sub _check_for_old_config_files {
   my @old_files = grep { -f "config/${_}" } qw(authentication.pl console.conf lx-erp.conf lx-erp-local.conf);
   return unless @old_files;
 
-  $::form->{title}      = $::locale->text('Old configuration files');
+  $::form->{title} = $::locale->text('Old configuration files');
   $::form->header;
-  print $::form->parse_html_template('login/old_configuration_files', { FILES => \@old_files });
+  print $::form->parse_html_template('login_screen/old_configuration_files', { FILES => \@old_files });
 
   ::end_of_request();
 }
index 60dc637..22b2be4 100644 (file)
@@ -5,8 +5,11 @@ use strict;
 use parent qw(Rose::Object);
 
 use SL::Dispatcher::AuthHandler::Admin;
+use SL::Dispatcher::AuthHandler::None;
 use SL::Dispatcher::AuthHandler::User;
 
+my %valid_auth_levels = map { ($_ => 1) } qw(user admin none);
+
 sub handle {
   my ($self, %param) = @_;
 
@@ -16,7 +19,10 @@ sub handle {
   $self->{handlers}->{$handler_name} ||= $handler_name->new;
   $self->{handlers}->{$handler_name}->handle;
 
-  return $auth_level;
+  return (
+    auth_level     => $auth_level,
+    keep_auth_vars => $self->get_keep_auth_vars(%param),
+  );
 }
 
 sub get_auth_level {
@@ -26,7 +32,13 @@ sub get_auth_level {
                  : $param{routing_type} eq 'controller' ? "SL::Controller::$param{controller}"->get_auth_level($param{action})
                  :                                        'user';
 
-  return $auth_level eq 'user' ? 'user' : 'admin';
+  return $valid_auth_levels{$auth_level} ? $auth_level : 'user';
+}
+
+sub get_keep_auth_vars {
+  my ($self, %param) = @_;
+
+  return $param{routing_type} eq 'controller' ? "SL::Controller::$param{controller}"->keep_auth_vars_in_form : 0;
 }
 
 1;
index 07778b6..77202e8 100644 (file)
@@ -10,8 +10,9 @@ sub handle {
   return if  $::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::form->{'{AUTH}admin_password'})            == $::auth->OK());
   return if !$::form->{'{AUTH}admin_password'} && ($::auth->authenticate_root($::auth->get_session_value('admin_password')) == $::auth->OK());
 
+  $::auth->punish_wrong_login;
   $::auth->delete_session_value('admin_password');
-  SL::Dispatcher::show_error('login/password_error', 'password', is_admin => 1);
+  SL::Dispatcher::show_error('admin/adminlogin', 'password');
 }
 
 1;
diff --git a/SL/Dispatcher/AuthHandler/None.pm b/SL/Dispatcher/AuthHandler/None.pm
new file mode 100644 (file)
index 0000000..0ce88a6
--- /dev/null
@@ -0,0 +1,11 @@
+package SL::Dispatcher::AuthHandler::None;
+
+use strict;
+
+use parent qw(Rose::Object);
+
+sub handle {
+  %::myconfig = ();
+}
+
+1;
index 56dbf9a..150245c 100644 (file)
@@ -5,22 +5,33 @@ use strict;
 use parent qw(Rose::Object);
 
 sub handle {
+  my ($self, %param) = @_;
+
   my $login = $::form->{'{AUTH}login'} || $::auth->get_session_value('login');
-  SL::Dispatcher::show_error('login/password_error', 'password') if not defined $login;
+  $self->_error(%param) if !defined $login;
 
   %::myconfig = $::auth->read_user(login => $login);
 
-  SL::Dispatcher::show_error('login/password_error', 'password') unless $::myconfig{login};
+  $self->_error(%param) unless $::myconfig{login};
 
   $::locale = Locale->new($::myconfig{countrycode});
 
-  my $ok   =  $::form->{'{AUTH}login'} && (SL::Auth::OK == $::auth->authenticate($login, $::form->{'{AUTH}password'}));
-  $ok    ||= !$::form->{'{AUTH}login'} && (SL::Auth::OK == $::auth->authenticate($login, undef));
+  my $ok   =  $::form->{'{AUTH}login'} && (SL::Auth::OK() == $::auth->authenticate($::myconfig{login}, $::form->{'{AUTH}password'}));
+  $ok    ||= !$::form->{'{AUTH}login'} && (SL::Auth::OK() == $::auth->authenticate($::myconfig{login}, undef));
 
-  SL::Dispatcher::show_error('login/password_error', 'password') if !$ok;
+  $self->_error(%param) if !$ok;
 
   $::auth->create_or_refresh_session;
   $::auth->delete_session_value('FLASH');
+
+  return %::myconfig;
+}
+
+sub _error {
+  my $self = shift;
+
+  $::auth->punish_wrong_login;
+  SL::Dispatcher::show_error('login_screen/user_login', 'password', @_);
 }
 
 1;
index 42971fa..4409505 100755 (executable)
@@ -96,6 +96,7 @@ sub run {
 
   if ($form->{action}) {
     if ($auth->authenticate_root($form->{'{AUTH}admin_password'}) != $auth->OK()) {
+      $auth->punish_wrong_login;
       $form->{error_message} = $locale->text('Incorrect Password!');
       $auth->delete_session_value('admin_password');
       adminlogin();
index a3184b5..e79b6af 100644 (file)
@@ -41,127 +41,6 @@ our $cgi;
 our $form;
 our $auth;
 
-sub run {
-  $::lxdebug->enter_sub;
-  my $session_result = shift;
-
-  $form   = $::form;
-  $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.');
-    login_screen();
-    ::end_of_request();
-  }
-  my $action = $form->{action};
-  if (!$action && $auth->{SESSION}->{login}) {
-    $action = 'login';
-  }
-  if ($action) {
-    $form->{login} = $form->{'{AUTH}login'} || $form->{login};
-    %::myconfig    = $auth->read_user(login => $form->{login}) if $form->{login};
-
-    $::locale   = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode};
-
-    if (SL::Auth::OK != $auth->authenticate($::myconfig{login}, $form->{'{AUTH}password'})) {
-      $form->{error_message} = $::locale->text('Incorrect username or password!');
-      login_screen();
-    } else {
-      $auth->create_or_refresh_session();
-      delete $form->{'{AUTH}password'};
-
-      $form->{titlebar} .= " - $::myconfig{name} - $::myconfig{dbname}";
-      call_sub($::locale->findsub($action));
-    }
-  } else {
-    login_screen();
-  }
-
-  $::lxdebug->leave_sub;
-}
-
-sub login_screen {
-  $main::lxdebug->enter_sub();
-  my ($msg) = @_;
-
-  if (-f "css/lx-office-erp.css") {
-    $form->{stylesheet} = "lx-office-erp.css";
-  }
-
-  $form->{msg} = $msg;
-  $form->header();
-
-  print $form->parse_html_template('login/login_screen');
-
-  $main::lxdebug->leave_sub();
-}
-
-sub login {
-  $main::lxdebug->enter_sub();
-
-  unless ($form->{login}) {
-    login_screen($::locale->text('You did not enter a name!'));
-    ::end_of_request();
-  }
-
-  my $user = User->new(login => $form->{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();
-  }
-
-  my %style_to_script_map = (
-    v3  => 'v3',
-    neu => 'new',
-    v4  => 'v4',
-  );
-
-  my $menu_script = $style_to_script_map{$user->{menustyle}} || '';
-
-  # made it this far, execute the menu
-  # standard redirect does not seem to work for this invocation, (infinite loops?)
-  # do a manual invocation instead
-#  $form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display', "callback=" . $form->escape($form->{callback}));
-
-  $main::auth->set_cookie_environment_variable();
-
-  $::form->{script}   = "menu${menu_script}.pl";
-  $::form->{action}   = 'display';
-  $::form->{callback} = $::form->escape($::form->{callback});
-
-  require "bin/mozilla/$::form->{script}";
-  display();
-
-#  $form->redirect();
-
-  $main::lxdebug->leave_sub();
-}
-
-sub logout {
-  $main::lxdebug->enter_sub();
-
-  $main::auth->destroy_session();
-
-  # remove the callback to display the message
-  $form->{callback} = "login.pl?action=";
-  $form->redirect($::locale->text('You are logged out!'));
-
-  $main::lxdebug->leave_sub();
-}
-
 sub company_logo {
   $main::lxdebug->enter_sub();
 
@@ -180,22 +59,6 @@ sub company_logo {
   $main::lxdebug->leave_sub();
 }
 
-sub show_error {
-  my $template           = shift;
-  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();
-}
-
 1;
 
 __END__
index 5463721..202f75c 100644 (file)
@@ -79,7 +79,7 @@ sub clock_line {
 
   my $login = "[Nutzer "
     . $form->{login}
-    . " - <a href=\"login.pl?action=logout\" target=\"_top\">"
+    . " - <a href=\"controller.pl?action=LoginScreen/logout\" target=\"_top\">"
     . $::locale->text('Logout')
     . "</a>] ";
   my ($Sekunden, $Minuten,   $Stunden,   $Monatstag, $Monat,
index 27b0f6a..d785dd2 100644 (file)
@@ -1,8 +1,8 @@
 <html>
  <head>
-  <meta http-equiv="refresh" content="0;URL=login.pl">
+  <meta http-equiv="refresh" content="0;URL=controller.pl?action=LoginScreen/user_login">
  </head>
  <body>
-  <a href="login.pl">Lx-Office-Login</a>
+  <a href="controller.pl?action=LoginScreen/user_login">kivitendo-Login</a>
  </body>
 </html>
index c0b4838..394de32 100644 (file)
@@ -969,7 +969,6 @@ $self->{texts} = {
   'Incoming Payments'           => 'Zahlungseingänge',
   'Incoming invoice number'     => 'Eingangsrechnungsnummer',
   'Incorrect Password!'         => 'Ungültiges Passwort!',
-  'Incorrect password!.'        => 'Ungültiges Passwort!.',
   'Incorrect username or password!' => 'Ungültiger Benutzername oder falsches Passwort!',
   'Increase'                    => 'Erhöhen',
   'Individual Items'            => 'Einzelteile',
index 8d090b8..eb83e18 100644 (file)
@@ -954,7 +954,6 @@ $self->{texts} = {
   'Incoming Payments'           => 'Zahlungseingänge',
   'Incoming invoice number'     => 'Eingangsrechnungsnummer',
   'Incorrect Password!'         => 'Passwort falsch!',
-  'Incorrect password!.'        => 'Ungültiges Passwort!.',
   'Incorrect username or password!' => 'Ungültiger Benutzername oder falsches Passwort!',
   'Increase'                    => 'Erhöhen',
   'Individual Items'            => 'Einzelteile',
index ac8f9b9..587376b 100644 (file)
--- a/menu.ini
+++ b/menu.ini
@@ -823,6 +823,6 @@ action=company_logo
 no_todo_list=1
 
 [Program--Logout]
-module=login.pl
-action=logout
+module=controller.pl
+action=LoginScreen/logout
 target=_top
index 42583f3..876cb4e 100644 (file)
@@ -10,8 +10,8 @@
 
   <h2>[% 'Administration' | $T8 %]</h2>
 
-  [% IF error_message %]
-  <p><span class="message_error_login">[% error_message %]</span></p>
+  [% IF error %]
+  <p><span class="message_error_login">[% error %]</span></p>
   [% END %]
 
   <form method="post" action="admin.pl">
@@ -29,7 +29,7 @@
 
   <p>[% 'kivitendo Homepage' | $T8 %]: <a href="http://kivitendo.de" target="_blank" title="[% 'kivitendo Homepage' | $T8 %]">http://kivitendo.de</a></p>
 
-  <p><a href="login.pl" target="_top">[%- LxERP.t8('Back to the login page') %]</a></p>
+  <p><a href="controller.pl?action=LoginScreen/user_login" target="_top">[%- LxERP.t8('Back to the login page') %]</a></p>
 
  </div>
 
index 95d0f8f..39883d1 100644 (file)
@@ -62,7 +62,8 @@
   </div>
  </form>
 
- <form method="post" action="login.pl">
+ <form method="post" action="controller.pl">
+  <input type="hidden" name="action" value="LoginScreen/login">
 
   <div class="listheading">[% 'User Login' | $T8 %]</div>
 
@@ -75,7 +76,7 @@
    <tr>
     <th align="right">[% 'Password' | $T8 %]</th>
     <td><input class="login" type="password" name="{AUTH}password"></td>
-    <td><input type="submit" name="action" value="[% 'Login' | $T8 %]"></td>
+    <td><input type="submit" value="[% 'Login' | $T8 %]"></td>
    </tr>
   </table>
 
index 9de5e9e..3a4ea59 100644 (file)
@@ -1,9 +1,9 @@
 [%- USE T8 %]
 [%- USE HTML %]
 [%- USE LxERP %]
-<form name="Form" method="post" action="login.pl">
+<form name="Form" method="post" action="controller.pl">
 
- <input type="hidden" name="action" value="login">
+ <input type="hidden" name="action" value="LoginScreen/login">
  <p><input type="button" class="submit" onclick="history.back()" value="[% 'Back' | $T8 %]"></p>
  <p class="message_hint">
   [% LxERP.t8('kivitendo is about to update the database [ #1 ].', dbname) | html %]
diff --git a/templates/webpages/login/auth_db_needs_update.html b/templates/webpages/login/auth_db_needs_update.html
deleted file mode 100644 (file)
index fb01cbf..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-[%- USE LxERP %]
-<body>
-
- <p><b>[% LxERP.t8('Error!') %]</b></p>
-
- <p>
-  [% LxERP.t8('Kivitendo needs to update the authentication database before you can proceed.') %]
-  [% LxERP.t8('Please log in to the administration panel.') %]
-  [% LxERP.t8('Kivitendo will then update the database automatically.') %]
- </p>
-
- <hr>
- <p>
-  [% LxERP.t8('For further information read this: ') %] <a href="doc/html/index.html" target="_blank">Kivitendo Installation</a><br>
-  [% LxERP.t8('Or download the whole Installation Documentation as PDF (350kB) for off-line study (currently in German Language): ') %] <a href="doc/Kivitendo-Dokumentation.pdf" target="_blank">Kivitendo-Dokumentation.pdf</a>
- </p>
-
- <hr>
-
- <p>
-  <a href="login.pl" target="_top">[% LxERP.t8('Login') %]</a> |
-  <a href="admin.pl" target="_top">[% LxERP.t8('Administration') %]</a>
- </p>
-
-</body>
-</html>
diff --git a/templates/webpages/login/auth_db_unreachable.html b/templates/webpages/login/auth_db_unreachable.html
deleted file mode 100644 (file)
index 5ca592b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-[%- USE T8 %]
-<body>
-
- <p><b>[% 'Error!' | $T8 %]</b></p>
-
- <p>[%- 'The authentication database is not reachable at the moment. Either it hasn\'t been set up yet or the database server might be down. Please contact your administrator.' | $T8 %]</p>
-
- <p>[% 'If you want to set up the authentication database yourself then log in to the administration panel. kivitendo will then create the database and tables for you.' | $T8 %]</p>
- <hr>
- <p>[% 'For further information read this: ' | $T8 %] <a href="doc/html/index.html" target="_blank">kivitendo Installation</a><br>
- [% 'Or download the whole Installation Documentation as PDF (350kB) for off-line study (currently in German Language): ' | $T8 %] <a href="doc/Kivitendo-Dokumentation.pdf" target="_blank">Kivitendo-Dokumentation.pdf</a></p>
-
- <hr>
-
- <p>
-  <a href="login.pl" target="_top">[% 'Login' | $T8 %]</a> |
-  <a href="admin.pl" target="_top">[% 'Administration' | $T8 %]</a>
- </p>
-
-</body>
-</html>
diff --git a/templates/webpages/login/authentication_pl_missing.html b/templates/webpages/login/authentication_pl_missing.html
deleted file mode 100644 (file)
index 8f158cf..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-[%- USE T8 %]
-<body>
-
- <p><b>[% 'Error!' | $T8 %]</b></p>
-
- <p>[% 'The authentication configuration file &quot;config/lx_office.conf&quot; does not exist. This kivitendo installation has probably not been updated correctly yet. Please contact your administrator.' | $T8 %]</p>
-
- <p>[% 'If you yourself want to upgrade the installation then please read the file &quot;doc/UPGRADE&quot; and follow the steps outlined in this file.' | $T8 %]</p>
-
- <p>
-  <a href="login.pl" target="_top">[% 'Login' | $T8 %]</a> |
-  <a href="admin.pl" target="_top">[% 'Administration' | $T8 %]</a>
- </p>
-
-</body>
-</html>
diff --git a/templates/webpages/login/login_screen.html b/templates/webpages/login/login_screen.html
deleted file mode 100644 (file)
index f34f901..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-[%- USE T8 %]
-[% USE HTML %]<body class="login" onLoad="document.loginscreen.login.focus()">
-
- <center>
-  <table class="login" border="3" cellpadding="20">
-   <tr>
-    <td class="login" align="center">
-     <a href="http://www.kivitendo.de" target="_top"><img src="image/kivitendo.png" border="0"></a>
-     <h3 class="login" align="center">[% 'kivitendo' | $T8 %] [% version %]</h3>
-
-     [% IF error_message %]
-     <p><span class="message_error_login">[% error_message %]</span></p>
-     [% END %]
-
-     <p>
-
-      <form method="post" name="loginscreen" action="login.pl" target="_top">
-
-       <input type="hidden" name="show_dbupdate_warning" value="1">
-
-       <table width="100%">
-        <tr>
-         <td align="center">
-          <table>
-           <tr>
-            <th align="right">[% 'Login Name' | $T8 %]</th>
-            <td><input class="login" name="{AUTH}login" size="30" tabindex="1"></td>
-           </tr>
-           <tr>
-            <th align="right">[% 'Password' | $T8 %]</th>
-            <td><input class="login" type="password" name="{AUTH}password" size="30" tabindex="2"></td>
-           </tr>
-          </table>
-
-          <br>
-          <input type="hidden" name="action" value="login">
-          <input type="submit" value="[% 'Login' | $T8 %]" tabindex="3">
-
-         </td>
-        </tr>
-       </table>
-
-      </form>
-
-    </td>
-   </tr>
-  </table>
-
-</body>
-</html>
diff --git a/templates/webpages/login/old_configuration_files.html b/templates/webpages/login/old_configuration_files.html
deleted file mode 100644 (file)
index a7f80a4..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-[% USE LxERP %][% USE HTML %]
-<body>
- <div class="listtop">[% title %]</div>
-
- <p>
-  [%- LxERP.t8('Starting with version 2.6.3 the configuration files in "config" have been consolidated.') %]
-  [%- LxERP.t8('The following old files whose settings have to be merged manually into the new configuration file "config/lx_office.conf" still exist:') %]
- </p>
-
- <ul>
-  [%- FOREACH file = FILES %]
-   <li><code>config/[%- HTML.escape(file) %]</code></li>
-  [%- END %]
- </ul>
-
- <p>
-  [%- LxERP.t8('Due to security concerns these files have to be deleted or moved after the migration before you can continue using kivitendo.') %]
- </p>
-
- <p>
-  [%- LxERP.t8('You can find information on the migration in the upgrade chapter of the documentation.') %]
- </p>
-  <p>
-
-  [%- LxERP.t8('Which is located at doc/Kivitendo-Dokumentation.pdf. Click here: ') %] <a href ="doc/Kivitendo-Dokumentation.pdf">doc/Kivitendo-Dokumentation.pdf</a>
-</p>
-
- <p>
-  <a href="login.pl">[%- LxERP.t8('Back to login') %]</a>
- </p>
-</body>
-</html>
diff --git a/templates/webpages/login/password_error.html b/templates/webpages/login/password_error.html
deleted file mode 100644 (file)
index 1ee8ec8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-[%- USE T8 %]
-<body>
-
- <p><b>[% 'Error!' | $T8 %]</b></p>
-
- <p>[% error %]</p>
-
- <p><a href="[% IF is_admin %]admin.pl[% ELSE %]login.pl[% END %]" target="_top">[% 'Login' | $T8 %]</a></p>
-
-</body>
-</html>
diff --git a/templates/webpages/login_screen/auth_db_needs_update.html b/templates/webpages/login_screen/auth_db_needs_update.html
new file mode 100644 (file)
index 0000000..a15da6b
--- /dev/null
@@ -0,0 +1,26 @@
+[%- USE LxERP %]
+<body>
+
+ <p><b>[% LxERP.t8('Error!') %]</b></p>
+
+ <p>
+  [% LxERP.t8('Kivitendo needs to update the authentication database before you can proceed.') %]
+  [% LxERP.t8('Please log in to the administration panel.') %]
+  [% LxERP.t8('Kivitendo will then update the database automatically.') %]
+ </p>
+
+ <hr>
+ <p>
+  [% LxERP.t8('For further information read this: ') %] <a href="doc/html/index.html" target="_blank">Kivitendo Installation</a><br>
+  [% LxERP.t8('Or download the whole Installation Documentation as PDF (350kB) for off-line study (currently in German Language): ') %] <a href="doc/Kivitendo-Dokumentation.pdf" target="_blank">Kivitendo-Dokumentation.pdf</a>
+ </p>
+
+ <hr>
+
+ <p>
+  <a href="controller.pl?action=show" target="_top">[% LxERP.t8('Login') %]</a> |
+  <a href="admin.pl" target="_top">[% LxERP.t8('Administration') %]</a>
+ </p>
+
+</body>
+</html>
diff --git a/templates/webpages/login_screen/auth_db_unreachable.html b/templates/webpages/login_screen/auth_db_unreachable.html
new file mode 100644 (file)
index 0000000..c756e5c
--- /dev/null
@@ -0,0 +1,21 @@
+[%- USE T8 %]
+<body>
+
+ <p><b>[% 'Error!' | $T8 %]</b></p>
+
+ <p>[%- 'The authentication database is not reachable at the moment. Either it hasn\'t been set up yet or the database server might be down. Please contact your administrator.' | $T8 %]</p>
+
+ <p>[% 'If you want to set up the authentication database yourself then log in to the administration panel. kivitendo will then create the database and tables for you.' | $T8 %]</p>
+ <hr>
+ <p>[% 'For further information read this: ' | $T8 %] <a href="doc/html/index.html" target="_blank">kivitendo Installation</a><br>
+ [% 'Or download the whole Installation Documentation as PDF (350kB) for off-line study (currently in German Language): ' | $T8 %] <a href="doc/Kivitendo-Dokumentation.pdf" target="_blank">Kivitendo-Dokumentation.pdf</a></p>
+
+ <hr>
+
+ <p>
+  <a href="controller.pl?action=LoginScreen/user_login" target="_top">[% 'Login' | $T8 %]</a> |
+  <a href="admin.pl" target="_top">[% 'Administration' | $T8 %]</a>
+ </p>
+
+</body>
+</html>
diff --git a/templates/webpages/login_screen/old_configuration_files.html b/templates/webpages/login_screen/old_configuration_files.html
new file mode 100644 (file)
index 0000000..e477a42
--- /dev/null
@@ -0,0 +1,32 @@
+[% USE LxERP %][% USE HTML %]
+<body>
+ <div class="listtop">[% title %]</div>
+
+ <p>
+  [%- LxERP.t8('Starting with version 2.6.3 the configuration files in "config" have been consolidated.') %]
+  [%- LxERP.t8('The following old files whose settings have to be merged manually into the new configuration file "config/lx_office.conf" still exist:') %]
+ </p>
+
+ <ul>
+  [%- FOREACH file = FILES %]
+   <li><code>config/[%- HTML.escape(file) %]</code></li>
+  [%- END %]
+ </ul>
+
+ <p>
+  [%- LxERP.t8('Due to security concerns these files have to be deleted or moved after the migration before you can continue using kivitendo.') %]
+ </p>
+
+ <p>
+  [%- LxERP.t8('You can find information on the migration in the upgrade chapter of the documentation.') %]
+ </p>
+  <p>
+
+  [%- LxERP.t8('Which is located at doc/Kivitendo-Dokumentation.pdf. Click here: ') %] <a href ="doc/Kivitendo-Dokumentation.pdf">doc/Kivitendo-Dokumentation.pdf</a>
+</p>
+
+ <p>
+  <a href="controller.pl?action=LoginScreen/user_login">[%- LxERP.t8('Back to login') %]</a>
+ </p>
+</body>
+</html>
diff --git a/templates/webpages/login_screen/user_login.html b/templates/webpages/login_screen/user_login.html
new file mode 100644 (file)
index 0000000..877cc18
--- /dev/null
@@ -0,0 +1,50 @@
+[%- USE T8 %]
+[% USE HTML %]<body class="login" onLoad="document.loginscreen.login.focus()">
+
+ <center>
+  <table class="login" border="3" cellpadding="20">
+   <tr>
+    <td class="login" align="center">
+     <a href="http://www.kivitendo.de" target="_top"><img src="image/kivitendo.png" border="0"></a>
+     <h3 class="login" align="center">[% 'kivitendo' | $T8 %] [% version %]</h3>
+
+     [% IF error %]
+     <p><span class="message_error_login">[% error %]</span></p>
+     [% END %]
+
+     <p>
+
+      <form method="post" name="loginscreen" action="controller.pl" target="_top">
+
+       <input type="hidden" name="show_dbupdate_warning" value="1">
+
+       <table width="100%">
+        <tr>
+         <td align="center">
+          <table>
+           <tr>
+            <th align="right">[% 'Login Name' | $T8 %]</th>
+            <td><input class="login" name="{AUTH}login" size="30" tabindex="1"></td>
+           </tr>
+           <tr>
+            <th align="right">[% 'Password' | $T8 %]</th>
+            <td><input class="login" type="password" name="{AUTH}password" size="30" tabindex="2"></td>
+           </tr>
+          </table>
+
+          <br>
+          <input type="hidden" name="action" value="LoginScreen/login">
+          <input type="submit" value="[% 'Login' | $T8 %]" tabindex="3">
+
+         </td>
+        </tr>
+       </table>
+
+      </form>
+
+    </td>
+   </tr>
+  </table>
+
+</body>
+</html>
index 1fb3c5e..b1a2daf 100644 (file)
@@ -4,7 +4,7 @@
 [% UNLESS is_links %]
  <span class="frame-header-element frame-header-left">
     [<a href="JavaScript:Switch_Menu();" title="[% 'Switch Menu on / off' | $T8 %]">[% 'Menu' | $T8 %]</a>]
-    [<a HREF="login.pl" target="_blank" title="[% 'Open a further kivitendo Window or Tab' | $T8 %]">[% 'New Win/Tab' | $T8 %]</a>]
+    [<a href="controller.pl?action=LoginScreen/user_login" target="_blank" title="[% 'Open a further kivitendo Window or Tab' | $T8 %]">[% 'New Win/Tab' | $T8 %]</a>]
     [<a href="JavaScript:top.main_window.print();" title="[% 'Hardcopy' | $T8 %]">[% 'Print' | $T8 %]</a>]
     [<a href="Javascript:top.main_window.history.back();" title="[% 'Go one step back' | $T8 %]">[% 'Back' | $T8 %]</a>]
     [<a href="Javascript:top.main_window.history.forward();" title="[% 'Go one step forward' | $T8 %]">[% 'Fwd' | $T8 %]</a>]
@@ -23,7 +23,7 @@
  <span class="frame-header-element frame-header-right">
   [% 'User' | $T8 %]:
   [% MYCONFIG.login %]
-  [<a href="login.pl?action=logout" target="_top" title="[% 'Logout now' | $T8 %]">[% 'Logout' | $T8 %]</a>]
+  [<a href="controller.pl?action=LoginScreen/logout" target="_top" title="[% 'Logout now' | $T8 %]">[% 'Logout' | $T8 %]</a>]
   [% now.to_lxoffice %] -
   [% now.hms %]
  </span>
index 452c43a..d552675 100644 (file)
@@ -26,7 +26,7 @@ window.onload=clockon
    </td>
    <td align="right" nowrap>
     [[% 'User' | $T8 %]: [% HTML.escape(login) %] -
-    <a href="login.pl?action=logout" target="_top">[% 'logout' | $T8 %]</a>]
+    <a href="controller.pl?action=LoginScreen/logout" target="_top">[% 'logout' | $T8 %]</a>]
     [% date %] <span id='clock_id' style='position:relative'></span>&nbsp;
    </td>
   </tr>
index 6faa762..cfe50a3 100644 (file)
@@ -51,7 +51,7 @@ window.onload=clockon
    </td>
    <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>
     [[% 'User' | $T8 %]: [% HTML.escape(login) %] -
-    <a href="login.pl?action=logout" target="_top">[% 'logout' | $T8 %]</a>]
+    <a href="controller.pl?action=LoginScreen/logout" target="_top">[% 'logout' | $T8 %]</a>]
     [% date %] <span id='clock_id' style='position:relative'></span>&nbsp;
    </td>
   </tr>
index 0a11fe4..b0b72f4 100644 (file)
@@ -8,7 +8,7 @@
   </span>
   <span class="frame-header-element frame-header-right">
    [[% 'User' | $T8 %]: [% HTML.escape(login) %] -
-   <a href="login.pl?action=logout" target="_top">[% 'logout' | $T8 %]</a>]
+   <a href="controller.pl?action=LoginScreen/logout" target="_top">[% 'logout' | $T8 %]</a>]
    [% date %] <span id='clock_id' style='position:relative'></span>&nbsp;
   </span>
  </div>