X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/4dbb09950c9f5596646537c12d991c99086fe7c1..d1e4ee7951b4ea788fcfd6bf882865f1b2724966:/bin/mozilla/login.pl diff --git a/bin/mozilla/login.pl b/bin/mozilla/login.pl index 765e4d334..b9a29c3ed 100644 --- a/bin/mozilla/login.pl +++ b/bin/mozilla/login.pl @@ -27,108 +27,56 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ####################################################################### - use DBI; use SL::User; use SL::Form; +require "bin/mozilla/common.pl"; $form = new Form; $locale = new Locale $language, "login"; # customization -if (-f "$form->{path}/custom_$form->{script}") { - eval { require "$form->{path}/custom_$form->{script}"; }; +if (-f "bin/mozilla/custom_$form->{script}") { + eval { require "bin/mozilla/custom_$form->{script}"; }; $form->error($@) if ($@); } # per login customization -if (-f "$form->{path}/$form->{login}_$form->{script}") { - eval { require "$form->{path}/$form->{login}_$form->{script}"; }; +if (-f "bin/mozilla/$form->{login}_$form->{script}") { + eval { require "bin/mozilla/$form->{login}_$form->{script}"; }; $form->error($@) if ($@); } # window title bar, user info -$form->{titlebar} = "Lx-Office ".$locale->text('Version'). " $form->{version}"; +$form->{titlebar} = "Lx-Office " . $locale->text('Version') . " $form->{version}"; if ($form->{action}) { $form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}"; - &{ $locale->findsub($form->{action}) }; + call_sub($locale->findsub($form->{action})); + } else { - &login_screen; + login_screen(); } - 1; - sub login_screen { $lxdebug->enter_sub(); - + if (-f "css/lx-office-erp.css") { $form->{stylesheet} = "lx-office-erp.css"; } - + $form->{fokus} = "loginscreen.login"; $form->header; - print qq| - - - - -
-
-
- -
- - - - -
- - - -|; + print $form->parse_html_template('login/login_screen'); $lxdebug->leave_sub(); } - sub login { $lxdebug->enter_sub(); @@ -137,108 +85,55 @@ sub login { $user = new User $memberfile, $form->{login}; # if we get an error back, bale out - if (($errno = $user->login(\%$form, $userspath)) <= -1) { - $errno *= -1; - $err[1] = $err[3] = $locale->text('Incorrect username or password!'); - - if ($errno == 2) { - # upgraded dataset, login again - $form->redirect("{login}&password=$form->{password}&path=$form->{path}&action=display>Continue"); + if (($result = $user->login(\%$form, $userspath)) <= -1) { + if ($result == -2) { exit; } - - $form->error($err[$errno]); + + $form->error($locale->text('Incorrect username or password!')); } - + + my %style_to_script_map = ( 'v3' => 'v3', + 'neu' => 'new', + 'xml' => 'XML', + ); + + my $menu_script = $style_to_script_map{$user->{menustyle}} || ''; + # made it this far, execute the menu - $form->{callback} = "menu.pl?login=$form->{login}&password=$form->{password}&path=$form->{path}&action=display"; + $form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display'); + + $form->redirect(); - $form->redirect; - $lxdebug->leave_sub(); } - - sub logout { $lxdebug->enter_sub(); unlink "$userspath/$form->{login}.conf"; - + # remove the callback to display the message - $form->{callback} = "login.pl?path=$form->{path}&action=&login="; + $form->{callback} = "login.pl?action=&login="; $form->redirect($locale->text('You are logged out!')); $lxdebug->leave_sub(); } - - sub company_logo { $lxdebug->enter_sub(); - + require "$userspath/$form->{login}.conf"; - $locale = new Locale $myconfig{countrycode}, "login" unless ($language eq $myconfig{countrycode}); - $myconfig{address} =~ s/\\n/
/g; - $myconfig{dbhost} = $locale->text('localhost') unless $myconfig{dbhost}; + $locale = new Locale $myconfig{countrycode}, "login" if ($language ne $myconfig{countrycode}); + + $form->{stylesheet} = $myconfig{stylesheet}; + $form->{title} = $locale->text('About'); - map { $form->{$_} = $myconfig{$_} } qw(charset stylesheet); - - $form->{title} = $locale->text('About'); - - # create the logo screen - $form->header unless $form->{noheader}; - - print qq| - -
- - - -|.$locale->text('Licensed to').qq| -

- -$myconfig{company} -
$myconfig{address} -
- - -
- - - - - - - - - - - - - - - - - - - - - - - -
|.$locale->text('User').qq|$myconfig{name}
|.$locale->text('Dataset').qq|$myconfig{dbname}
|.$locale->text('Database Host').qq|$myconfig{dbhost}
http://lx-office.org
info@lx-office.org
- -

- - - -|; + $form->header() unless $form->{noheader}; + + print $form->parse_html_template('login/company_logo'); $lxdebug->leave_sub(); } - - -