X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Flogin.pl;h=b04adc21eae721c913a460641e450aab890f8062;hb=2508bbb1ab2056ec40635f4dda1c7023a5f3254f;hp=e6dd8e7a25648d5940e6cd90df698207451c9f06;hpb=d319704a66e9be64da837ccea10af6774c2b0838;p=kivitendo-erp.git diff --git a/bin/mozilla/login.pl b/bin/mozilla/login.pl index e6dd8e7a2..b04adc21e 100644 --- a/bin/mozilla/login.pl +++ b/bin/mozilla/login.pl @@ -28,214 +28,164 @@ ####################################################################### use DBI; +use SL::Auth; use SL::User; use SL::Form; -$form = new Form; +require "bin/mozilla/common.pl"; +require "bin/mozilla/todo.pl"; -$locale = new Locale $language, "login"; +use strict; -# customization -if (-f "$form->{path}/custom_$form->{script}") { - eval { require "$form->{path}/custom_$form->{script}"; }; - $form->error($@) if ($@); -} +our $cgi; +our $form; +our $auth; -# per login customization -if (-f "$form->{path}/$form->{login}_$form->{script}") { - eval { require "$form->{path}/$form->{login}_$form->{script}"; }; - $form->error($@) if ($@); -} +sub run { + $::lxdebug->enter_sub; + my $session_result = shift; -# window title bar, user info -$form->{titlebar} = - "Lx-Office " . $locale->text('Version') . " $form->{version}"; + $cgi = $::cgi; + $form = $::form; + $auth = $::auth; -if ($form->{action}) { - $form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}"; - &{ $locale->findsub($form->{action}) }; -} else { - &login_screen; -} + $form->{stylesheet} = "lx-office-erp.css"; + $form->{favicon} = "favicon.ico"; -1; + 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) { + 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(); + } 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(); + } + + $::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; + $form->{msg} = $msg; + $form->header(); - print qq| + 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 = new User $form->{login}; -