Revision d1e4ee79
Von Moritz Bunkus vor etwa 17 Jahren hinzugefügt
bin/mozilla/login.pl | ||
---|---|---|
50 | 50 |
} |
51 | 51 |
|
52 | 52 |
# window title bar, user info |
53 |
$form->{titlebar} = |
|
54 |
"Lx-Office " . $locale->text('Version') . " $form->{version}"; |
|
53 |
$form->{titlebar} = "Lx-Office " . $locale->text('Version') . " $form->{version}"; |
|
55 | 54 |
|
56 | 55 |
if ($form->{action}) { |
57 | 56 |
$form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}"; |
58 | 57 |
call_sub($locale->findsub($form->{action})); |
58 |
|
|
59 | 59 |
} else { |
60 |
&login_screen;
|
|
60 |
login_screen();
|
|
61 | 61 |
} |
62 | 62 |
|
63 | 63 |
1; |
... | ... | |
72 | 72 |
$form->{fokus} = "loginscreen.login"; |
73 | 73 |
$form->header; |
74 | 74 |
|
75 |
print qq| |
|
76 |
|
|
77 |
|
|
78 |
<body class=login onLoad="fokus()"> |
|
79 |
|
|
80 |
<pre> |
|
81 |
|
|
82 |
</pre> |
|
83 |
|
|
84 |
<center> |
|
85 |
<table class=login border=3 cellpadding=20> |
|
86 |
<tr> |
|
87 |
<td class=login align=center><a href="http://www.lx-office.org" target=_top><img src="image/lx-office-erp.png" border=0></a> |
|
88 |
<h1 class=login align=center>| |
|
89 |
. $locale->text('Version') . qq| $form->{version} |
|
90 |
</h1> |
|
91 |
|
|
92 |
<p> |
|
93 |
|
|
94 |
<form method=post name=loginscreen action=$form->{script}> |
|
95 |
|
|
96 |
<input type="hidden" name="show_dbupdate_warning" value="1"> |
|
97 |
|
|
98 |
<table width=100%> |
|
99 |
<tr> |
|
100 |
<td align=center> |
|
101 |
<table> |
|
102 |
<tr> |
|
103 |
<th align=right>| . $locale->text('Login Name') . qq|</th> |
|
104 |
<td><input class=login name=login size=30 tabindex="1"></td> |
|
105 |
</tr> |
|
106 |
<tr> |
|
107 |
<th align=right>| . $locale->text('Password') . qq|</th> |
|
108 |
<td><input class=login type=password name=password size=30 tabindex="2"></td> |
|
109 |
</tr> |
|
110 |
</table> |
|
111 |
|
|
112 |
<br> |
|
113 |
<input type=submit name=action value="| . $locale->text('Login') . qq|" tabindex="3"> |
|
114 |
|
|
115 |
</td> |
|
116 |
</tr> |
|
117 |
</table> |
|
118 |
|
|
119 |
</form> |
|
120 |
|
|
121 |
</td> |
|
122 |
</tr> |
|
123 |
</table> |
|
124 |
|
|
125 |
</body> |
|
126 |
</html> |
|
127 |
|; |
|
75 |
print $form->parse_html_template('login/login_screen'); |
|
128 | 76 |
|
129 | 77 |
$lxdebug->leave_sub(); |
130 | 78 |
} |
... | ... | |
132 | 80 |
sub login { |
133 | 81 |
$lxdebug->enter_sub(); |
134 | 82 |
|
135 |
$form->error($locale->text('You did not enter a name!')) |
|
136 |
unless ($form->{login}); |
|
83 |
$form->error($locale->text('You did not enter a name!')) unless ($form->{login}); |
|
137 | 84 |
|
138 | 85 |
$user = new User $memberfile, $form->{login}; |
139 | 86 |
|
140 | 87 |
# if we get an error back, bale out |
141 |
if (($errno = $user->login(\%$form, $userspath)) <= -1) { |
|
142 |
$errno *= -1; |
|
143 |
$err[1] = $err[3] = $locale->text('Incorrect username or password!'); |
|
144 |
|
|
145 |
if ($errno == 2) { |
|
88 |
if (($result = $user->login(\%$form, $userspath)) <= -1) { |
|
89 |
if ($result == -2) { |
|
146 | 90 |
exit; |
147 | 91 |
} |
148 | 92 |
|
149 |
$form->error($err[$errno]);
|
|
93 |
$form->error($locale->text('Incorrect username or password!'));
|
|
150 | 94 |
} |
151 | 95 |
|
96 |
my %style_to_script_map = ( 'v3' => 'v3', |
|
97 |
'neu' => 'new', |
|
98 |
'xml' => 'XML', |
|
99 |
); |
|
100 |
|
|
101 |
my $menu_script = $style_to_script_map{$user->{menustyle}} || ''; |
|
102 |
|
|
152 | 103 |
# made it this far, execute the menu |
153 |
if ($user->{menustyle} eq "v3") { |
|
154 |
$form->{callback} = |
|
155 |
"menuv3.pl?login=$form->{login}&password=$form->{password}&action=display"; |
|
156 |
} elsif ($user->{menustyle} eq "neu") { |
|
157 |
$form->{callback} = |
|
158 |
"menunew.pl?login=$form->{login}&password=$form->{password}&action=display"; |
|
159 |
} elsif ($user->{menustyle} eq "xml") { |
|
160 |
$form->{callback} = |
|
161 |
"menuXML.pl?login=$form->{login}&password=$form->{password}&action=display"; |
|
162 |
} else { |
|
163 |
$form->{callback} = |
|
164 |
"menu.pl?login=$form->{login}&password=$form->{password}&action=display"; |
|
165 |
} |
|
104 |
$form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display'); |
|
166 | 105 |
|
167 |
$form->redirect; |
|
106 |
$form->redirect();
|
|
168 | 107 |
|
169 | 108 |
$lxdebug->leave_sub(); |
170 | 109 |
} |
... | ... | |
185 | 124 |
$lxdebug->enter_sub(); |
186 | 125 |
|
187 | 126 |
require "$userspath/$form->{login}.conf"; |
188 |
$locale = new Locale $myconfig{countrycode}, "login" |
|
189 |
unless ($language eq $myconfig{countrycode}); |
|
190 | 127 |
|
191 |
$myconfig{address} =~ s/\\n/<br>/g; |
|
192 |
$myconfig{dbhost} = $locale->text('localhost') unless $myconfig{dbhost}; |
|
128 |
$locale = new Locale $myconfig{countrycode}, "login" if ($language ne $myconfig{countrycode}); |
|
193 | 129 |
|
194 |
$form->{stylesheet} = $myconfig{stylesheet}; |
|
195 |
|
|
196 |
$form->{title} = $locale->text('About'); |
|
130 |
$form->{stylesheet} = $myconfig{stylesheet}; |
|
131 |
$form->{title} = $locale->text('About'); |
|
197 | 132 |
|
198 | 133 |
# create the logo screen |
199 |
$form->header unless $form->{noheader}; |
|
200 |
|
|
201 |
print qq| |
|
202 |
<body> |
|
203 |
<center> |
|
204 |
<a href="http://www.lx-office.org" target=_top><img src="image/lx-office-erp.png" border=0></a> |
|
205 |
<h2 class=login>| . $locale->text('Version') . qq| $form->{version}</h2> |
|
206 |
|
|
207 |
| . $locale->text('Licensed to') . qq| |
|
208 |
<p> |
|
209 |
<b> |
|
210 |
$myconfig{company} |
|
211 |
<br>$myconfig{address} |
|
212 |
</b> |
|
213 |
|
|
214 |
|
|
215 |
<br> |
|
216 |
<table border=0> |
|
217 |
<tr> |
|
218 |
<th align=left>| . $locale->text('User') . qq|</th> |
|
219 |
<td>$myconfig{name}</td> |
|
220 |
</tr> |
|
221 |
<tr> |
|
222 |
<th align=left>| . $locale->text('Dataset') . qq|</th> |
|
223 |
<td>$myconfig{dbname}</td> |
|
224 |
</tr> |
|
225 |
<tr> |
|
226 |
<th align=left>| . $locale->text('Database Host') . qq|</th> |
|
227 |
<td>$myconfig{dbhost}</td> |
|
228 |
</tr> |
|
229 |
<tr> |
|
230 |
</tr> |
|
231 |
<tr> |
|
232 |
</tr> |
|
233 |
<tr> |
|
234 |
<th colspan="2" align="center"><a href="http://lx-office.org" target="blank">http://lx-office.org</a></th> |
|
235 |
</tr> |
|
236 |
<tr> |
|
237 |
<th colspan="2" align="center"><a href="mailto:info@lx-office.org" target="blank">info@lx-office.org</a></th> |
|
238 |
</tr> |
|
239 |
</table> |
|
240 |
|
|
241 |
</center> |
|
242 |
|
|
243 |
</body> |
|
244 |
</html> |
|
245 |
|; |
|
134 |
$form->header() unless $form->{noheader}; |
|
135 |
|
|
136 |
print $form->parse_html_template('login/company_logo'); |
|
246 | 137 |
|
247 | 138 |
$lxdebug->leave_sub(); |
248 | 139 |
} |
Auch abrufbar als: Unified diff
Auslagern des HTML-Codes aus login.pl in HTML-Vorlagen.