User-Login auf Controller umgestellt
[kivitendo-erp.git] / bin / mozilla / login.pl
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__