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();
68 if (-f "css/lx-office-erp.css") {
69 $form->{stylesheet} = "lx-office-erp.css";
72 $form->{fokus} = "loginscreen.login";
75 print $form->parse_html_template('login/login_screen');
77 $lxdebug->leave_sub();
81 $lxdebug->enter_sub();
83 $form->error($locale->text('You did not enter a name!')) unless ($form->{login});
85 $user = new User $memberfile, $form->{login};
87 # if we get an error back, bale out
88 if (($result = $user->login(\%$form, $userspath)) <= -1) {
93 $form->error($locale->text('Incorrect username or password!'));
96 my %style_to_script_map = ( 'v3' => 'v3',
101 my $menu_script = $style_to_script_map{$user->{menustyle}} || '';
103 # made it this far, execute the menu
104 $form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display');
108 $lxdebug->leave_sub();
112 $lxdebug->enter_sub();
114 unlink "$userspath/$form->{login}.conf";
116 # remove the callback to display the message
117 $form->{callback} = "login.pl?action=&login=";
118 $form->redirect($locale->text('You are logged out!'));
120 $lxdebug->leave_sub();
124 $lxdebug->enter_sub();
126 require "$userspath/$form->{login}.conf";
128 $locale = new Locale $myconfig{countrycode}, "login" if ($language ne $myconfig{countrycode});
130 $form->{stylesheet} = $myconfig{stylesheet};
131 $form->{title} = $locale->text('About');
133 # create the logo screen
134 $form->header() unless $form->{noheader};
136 print $form->parse_html_template('login/company_logo');
138 $lxdebug->leave_sub();