X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Flogin.pl;h=43ef952248f8d3a7724f32159b9b3755702909ea;hb=1e0d413084100ccd892e8c5be95703be5d965de7;hp=39890982d56b9c5501814ab7e1a48b8cb6f6b778;hpb=d629acd82a27e980899a044ca8b0f4becc8e94bb;p=kivitendo-erp.git diff --git a/bin/mozilla/login.pl b/bin/mozilla/login.pl index 39890982d..43ef95224 100644 --- a/bin/mozilla/login.pl +++ b/bin/mozilla/login.pl @@ -28,218 +28,166 @@ ####################################################################### use DBI; +use SL::Auth; use SL::User; use SL::Form; require "bin/mozilla/common.pl"; +require "bin/mozilla/todo.pl"; -$form = new Form; +use strict; -$locale = new Locale $language, "login"; +our $cgi; +our $form; +our $auth; -# customization -if (-f "bin/mozilla/custom_$form->{script}") { - eval { require "bin/mozilla/custom_$form->{script}"; }; - $form->error($@) if ($@); -} +sub run { + $::lxdebug->enter_sub; + my $session_result = shift; -# per login customization -if (-f "bin/mozilla/$form->{login}_$form->{script}") { - eval { require "bin/mozilla/$form->{login}_$form->{script}"; }; - $form->error($@) if ($@); -} + $cgi = $::cgi; + $form = $::form; + $auth = $::auth; -# window title bar, user info -$form->{titlebar} = - "Lx-Office " . $locale->text('Version') . " $form->{version}"; + $form->{stylesheet} = "lx-office-erp.css"; + $form->{favicon} = "favicon.ico"; -if ($form->{action}) { - $form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}"; - call_sub($locale->findsub($form->{action})); -} else { - &login_screen; -} + 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) { + %::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))) { + $form->{error_message} = $::locale->text('Incorrect username or password!'); + login_screen(); + } else { + $auth->set_session_value('login', $form->{login}, 'password', $form->{password}); + $auth->create_or_refresh_session(); + + $form->{titlebar} .= " - $::myconfig{name} - $::myconfig{dbname}"; + call_sub($::locale->findsub($action)); + } + } else { + login_screen(); + } -1; + $::lxdebug->leave_sub; +} sub login_screen { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + my ($msg) = @_; if (-f "css/lx-office-erp.css") { $form->{stylesheet} = "lx-office-erp.css"; } - $form->{fokus} = "loginscreen.login"; - $form->header; - - print qq| + $form->{msg} = $msg; + $form->header(); + print $form->parse_html_template('login/login_screen'); -
- -+ $main::lxdebug->leave_sub(); +} -+sub login { + $main::lxdebug->enter_sub(); -