Revision bc3eec3a
Von Sven Schöling vor etwa 15 Jahren hinzugefügt
bin/mozilla/login.pl | ||
---|---|---|
35 | 35 |
require "bin/mozilla/common.pl"; |
36 | 36 |
require "bin/mozilla/todo.pl"; |
37 | 37 |
|
38 |
use strict; |
|
39 |
|
|
38 | 40 |
# This is required because the am.pl in the root directory |
39 | 41 |
# is not scanned by locales.pl: |
40 | 42 |
# $form->parse_html_template('login/password_error') |
41 | 43 |
|
42 |
$form = new Form; |
|
44 |
our $form = new Form;
|
|
43 | 45 |
|
44 | 46 |
if (! -f 'config/authentication.pl') { |
45 | 47 |
show_error('login/authentication_pl_missing'); |
46 | 48 |
} |
47 | 49 |
|
48 |
$locale = new Locale $language, "login";
|
|
50 |
our $locale = new Locale $main::language, "login";
|
|
49 | 51 |
|
50 | 52 |
our $auth = SL::Auth->new(); |
51 | 53 |
if (!$auth->session_tables_present()) { |
52 | 54 |
show_error('login/auth_db_unreachable'); |
53 | 55 |
} |
54 | 56 |
$auth->expire_sessions(); |
55 |
my $session_result = $auth->restore_session(); |
|
57 |
my $session_result = $main::auth->restore_session();
|
|
56 | 58 |
|
57 | 59 |
# customization |
58 | 60 |
if (-f "bin/mozilla/custom_$form->{script}") { |
... | ... | |
103 | 105 |
1; |
104 | 106 |
|
105 | 107 |
sub login_screen { |
106 |
$lxdebug->enter_sub(); |
|
108 |
$main::lxdebug->enter_sub();
|
|
107 | 109 |
my ($msg) = @_; |
108 | 110 |
|
109 | 111 |
if (-f "css/lx-office-erp.css") { |
... | ... | |
115 | 117 |
|
116 | 118 |
print $form->parse_html_template('login/login_screen'); |
117 | 119 |
|
118 |
$lxdebug->leave_sub(); |
|
120 |
$main::lxdebug->leave_sub();
|
|
119 | 121 |
} |
120 | 122 |
|
121 | 123 |
sub login { |
122 |
$lxdebug->enter_sub(); |
|
124 |
$main::lxdebug->enter_sub();
|
|
123 | 125 |
|
124 | 126 |
unless ($form->{login}) { |
125 | 127 |
login_screen($locale->text('You did not enter a name!')); |
126 | 128 |
exit; |
127 | 129 |
} |
128 | 130 |
|
129 |
$user = new User $form->{login}; |
|
131 |
my $user = new User $form->{login};
|
|
130 | 132 |
|
131 | 133 |
# if we get an error back, bale out |
134 |
my $result; |
|
132 | 135 |
if (($result = $user->login($form)) <= -1) { |
133 | 136 |
exit if $result == -2; |
134 | 137 |
login_screen($locale->text('Incorrect username or password!')); |
... | ... | |
146 | 149 |
# made it this far, execute the menu |
147 | 150 |
$form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display', "callback=" . $form->escape($form->{callback})); |
148 | 151 |
|
149 |
$auth->set_cookie_environment_variable(); |
|
152 |
$main::auth->set_cookie_environment_variable();
|
|
150 | 153 |
|
151 | 154 |
$form->redirect(); |
152 | 155 |
|
153 |
$lxdebug->leave_sub(); |
|
156 |
$main::lxdebug->leave_sub();
|
|
154 | 157 |
} |
155 | 158 |
|
156 | 159 |
sub logout { |
157 |
$lxdebug->enter_sub(); |
|
160 |
$main::lxdebug->enter_sub();
|
|
158 | 161 |
|
159 |
$auth->destroy_session(); |
|
162 |
$main::auth->destroy_session();
|
|
160 | 163 |
|
161 | 164 |
# remove the callback to display the message |
162 | 165 |
$form->{callback} = "login.pl?action="; |
163 | 166 |
$form->redirect($locale->text('You are logged out!')); |
164 | 167 |
|
165 |
$lxdebug->leave_sub(); |
|
168 |
$main::lxdebug->leave_sub();
|
|
166 | 169 |
} |
167 | 170 |
|
168 | 171 |
sub company_logo { |
169 |
$lxdebug->enter_sub(); |
|
172 |
$main::lxdebug->enter_sub();
|
|
170 | 173 |
|
171 |
$locale = new Locale $myconfig{countrycode}, "login" if ($language ne $myconfig{countrycode}); |
|
174 |
my %myconfig = %main::myconfig; |
|
175 |
$locale = new Locale $myconfig{countrycode}, "login" if ($main::language ne $myconfig{countrycode}); |
|
172 | 176 |
|
173 | 177 |
$form->{todo_list} = create_todo_list('login_screen' => 1) if (!$form->{no_todo_list}); |
174 | 178 |
|
... | ... | |
180 | 184 |
|
181 | 185 |
print $form->parse_html_template('login/company_logo'); |
182 | 186 |
|
183 |
$lxdebug->leave_sub(); |
|
187 |
$main::lxdebug->leave_sub();
|
|
184 | 188 |
} |
185 | 189 |
|
186 | 190 |
sub show_error { |
187 | 191 |
my $template = shift; |
188 |
$locale = Locale->new($language, 'all'); |
|
189 |
$myconfig{countrycode} = $language; |
|
192 |
my %myconfig = %main::myconfig; |
|
193 |
$locale = Locale->new($main::language, 'all'); |
|
194 |
$myconfig{countrycode} = $main::language; |
|
190 | 195 |
$form->{stylesheet} = 'css/lx-office-erp.css'; |
191 | 196 |
|
192 | 197 |
$form->header(); |
Auch abrufbar als: Unified diff
login strict