1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 ######################################################################
8 # SQL-Ledger Accounting
9 # Copyright (c) 1998-2002
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write to the Free Software
27 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #######################################################################
34 require "bin/mozilla/common.pl";
38 $locale = new Locale $language, "login";
41 if (-f "bin/mozilla/custom_$form->{script}") {
42 eval { require "bin/mozilla/custom_$form->{script}"; };
43 $form->error($@) if ($@);
46 # per login customization
47 if (-f "bin/mozilla/$form->{login}_$form->{script}") {
48 eval { require "bin/mozilla/$form->{login}_$form->{script}"; };
49 $form->error($@) if ($@);
52 # window title bar, user info
53 $form->{titlebar} = "Lx-Office " . $locale->text('Version') . " $form->{version}";
55 if ($form->{action}) {
56 $form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}";
57 call_sub($locale->findsub($form->{action}));
66 $lxdebug->enter_sub();
69 if (-f "css/lx-office-erp.css") {
70 $form->{stylesheet} = "lx-office-erp.css";
74 $form->{fokus} = "loginscreen.login";
77 print $form->parse_html_template('login/login_screen');
79 $lxdebug->leave_sub();
83 $lxdebug->enter_sub();
85 unless ($form->{login}) {
86 login_screen($locale->text('You did not enter a name!'));
90 $user = new User $memberfile, $form->{login};
92 # if we get an error back, bale out
93 if (($result = $user->login(\%$form, $userspath)) <= -1) {
94 exit if $result == -2;
95 login_screen($locale->text('Incorrect username or password!'));
99 my %style_to_script_map = ( 'v3' => 'v3',
104 my $menu_script = $style_to_script_map{$user->{menustyle}} || '';
106 # made it this far, execute the menu
107 $form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display');
111 $lxdebug->leave_sub();
115 $lxdebug->enter_sub();
117 unlink "$userspath/$form->{login}.conf";
119 # remove the callback to display the message
120 $form->{callback} = "login.pl?action=&login=";
121 $form->redirect($locale->text('You are logged out!'));
123 $lxdebug->leave_sub();
127 $lxdebug->enter_sub();
129 require "$userspath/$form->{login}.conf";
131 $locale = new Locale $myconfig{countrycode}, "login" if ($language ne $myconfig{countrycode});
133 $form->{stylesheet} = $myconfig{stylesheet};
134 $form->{title} = $locale->text('About');
136 # create the logo screen
137 $form->header() unless $form->{noheader};
139 print $form->parse_html_template('login/company_logo');
141 $lxdebug->leave_sub();