source: EDIS/trunk/java/tracking-server-main/src/main/webapp/login/login.jsp@ 1227

Last change on this file since 1227 was 1227, checked in by George Lilly, 13 years ago

initial load of EDIS 1.0

File size: 13.4 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
3<%@ page language="java" session = "false" %>
4
5
6
7<%@ page import="gov.va.med.authentication.kernel.ConfigurationVO,
8
9 gov.va.med.authentication.kernel.LoginController,
10
11 weblogic.servlet.security.ServletAuthentication;"%>
12
13
14
15<%
16
17// Turn off cache so that a user cannot navigate back to the login page after post-login
18
19response.setHeader("Cache-Control","no-store, no-cache, must-revalidate"); //HTTP 1.1
20
21response.setHeader("Pragma","no-cache"); //HTTP 1.0
22
23response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
24
25%>
26
27
28
29
30
31<HTML>
32
33<HEAD>
34
35<!--
36
37 *
38
39 * @author Infrastructure & Security Service
40
41 * @version 1.0.1.002
42
43 * -->
44
45<STYLE type="text/css">
46
47.scrollPane { height:18em; overflow: auto; }
48
49</STYLE>
50
51<TITLE>Login Page</TITLE>
52
53<script type="text/javascript" src="<%= request.getContextPath()%>/login/javascript/login.js"></script>
54
55
56
57
58
59</HEAD>
60
61<BODY onload="javascript:checkHF(document.LoginForm,document.LoginForm.institution,document.LoginForm.sortInstBy,document.LoginForm.disableInstitutionObjHF,document.LoginForm.disableSortByObjHF,document.LoginForm.sortByObjHF);document.LoginForm.access.focus();">
62
63 <a href="#skip" title="Skip to login fields"></a>
64
65
66
67<%
68
69/*
70
71It could be argued that using code within JSP is not a good thing, but for such a small app it's
72
73completely acceptable. If we were working with an HTML designer, the separation would be good. But then
74
75JSTL would be needed and with that we'd introduce some version of that as a dependency, which is preferably
76
77avoided given because we're embedded, we force these dependencies on the containing application as well.
78
79*/
80
81ConfigurationVO kaajeeEnv = ConfigurationVO.getInstance();
82
83
84
85/*
86
87Here if the protocol is 'http', I redirected the user to the same page using 'https' protocol.
88
89*/
90
91 if(request.getParameter("relogin")!=null){
92
93 HttpSession hSess = request.getSession(false);
94
95 if(hSess == null) {
96
97 StringBuffer sbsession = new StringBuffer(request.getContextPath());
98
99 sbsession.append("/login/SessionTimeout.jsp");
100
101 response.sendRedirect(sbsession.toString());
102
103 return;
104
105 }
106
107 }
108
109
110
111HttpSession hSess = request.getSession(true);
112
113
114
115String desiredSchema = "https"; //or http
116
117String usingSchema = request.getScheme();
118
119if(kaajeeEnv.getHTTPSPortLis() != null ) {
120
121if(!desiredSchema.equals(usingSchema)) {
122
123
124
125 StringBuffer sburl = request.getRequestURL();
126
127 java.net.URL url = new java.net.URL(sburl.toString());
128
129 hSess = request.getSession(true);
130
131 Integer portValue = new Integer(url.getPort());
132
133 hSess.setAttribute("portnumber",portValue);
134
135
136
137 String urlString = desiredSchema+"://"+ url.getHost() +":"+kaajeeEnv.getHTTPSPortLis()+url.getPath();
138
139 response.sendRedirect(response.encodeRedirectURL(urlString));
140
141 return;
142
143 }
144
145}
146
147
148
149%>
150
151
152
153<FORM name="LoginForm" method="post" action="<%= request.getContextPath() %>/LoginController" onSubmit="javascript:enableInstitutionObj(document.LoginForm,document.LoginForm.institution,document.LoginForm.sortInstBy,document.LoginForm.disableInstitutionObjHF,document.LoginForm.disableSortByObjHF)">
154
155<table align="center" summary="This table is for formatting purposes only">
156
157 <tr>
158
159 <td>
160
161 <table width="75%" border="0" align="center" cellpadding="4" cellspacing="4" bgcolor="#eeeeee">
162
163 <caption align="left"><strong>System Announcements:</strong></caption>
164
165 <tr><td><div class="scrollPane"><%= kaajeeEnv.getIntroductoryText() %></div></td></tr></table>
166
167
168
169 <table border="0" align="center" cellpadding="3" cellspacing="3" summary="This table is for formatting purposes only">
170
171 <tr align="center">
172
173 <td colspan="2" nowrap><h3>Login: <%= kaajeeEnv.getHostApplicationName() %></h3></td>
174
175 </tr>
176
177 <tr>
178
179 <td><img src="<%= request.getContextPath() %>/login/images/HealtheVetVistaSmallBlue.jpg" alt="Health e Vet Vista logo" width="120" height="60"></td>
180
181 <td><table border="0" align="center" cellpadding="3" cellspacing="3" summary="This table is for formatting purposes only">
182
183 <tr>
184
185 <th align="right" nowrap><a name="skip"></a>Access Code:</th>
186
187 <td><input type="password" name="access" value="" size=16 maxlength=20></td>
188
189 <td>&nbsp;</td>
190
191 </tr>
192
193 <tr>
194
195 <th align="right" nowrap>Verify Code:</th>
196
197 <td><input type="password" name="verify" value="" size=16 maxlength=20></td>
198
199 </tr>
200
201 </table></td></tr>
202
203 <tr>
204
205 <%
206
207 //1. Initialize values
208
209 String kaajeeDefaultInstitutionValue = "";
210
211 String kaajeeDisableInstitutionComponentsValue = "";
212
213 String kaajeeSortStationByValue = "";
214
215 String kaajeeDisableSortStationByValue = "";
216
217 boolean kaajeeDefaultInstitutionParamFound = false;
218
219 boolean kaajeeDisableInstitutionParamFound = false;
220
221 boolean kaajeeSortStationByParamFound = false;
222
223 boolean kaajeeDisableSortStationByParamFound = false;
224
225 //2. Get targetURL and parse out parameters
226
227 String targetURL = ServletAuthentication.getTargetURLForFormAuthentication(request.getSession());
228
229 if (targetURL == null) {
230
231 StringBuffer sbNavErrorPg = new StringBuffer(request.getContextPath());
232
233 sbNavErrorPg.append("/login/navigationerror.jsp");
234
235 response.sendRedirect(sbNavErrorPg.toString());
236
237 return;
238
239 }
240
241 int paramPos = targetURL.indexOf('?');
242
243 String paramList = (paramPos > -1) ? targetURL.substring(paramPos + 1, targetURL.length()) : "";
244
245 String[] paramArray = paramList.split("\u0026"); //split on '&' char
246
247 for (int i=0; i < paramArray.length; i++) {
248
249 String[] tempArray=paramArray[i].split("\u003D"); //split on '=' char
250
251 if (tempArray[0].indexOf("kaajeeDefaultInstitution") != -1) {
252
253 kaajeeDefaultInstitutionValue = tempArray[1];
254
255 kaajeeDefaultInstitutionParamFound = true;
256
257 } else {
258
259 if (tempArray[0].indexOf("kaajeeDisableInstitutionComponents") != -1) {
260
261 kaajeeDisableInstitutionComponentsValue = tempArray[1];
262
263 kaajeeDisableInstitutionParamFound = true;
264
265 } else {
266
267 if (tempArray[0].indexOf("kaajeeSortStationBy") != -1) {
268
269 kaajeeSortStationByValue = tempArray[1];
270
271 kaajeeSortStationByParamFound = true;
272
273 } else {
274
275 if (tempArray[0].indexOf("kaajeeDisableSortStationBy") != -1) {
276
277 kaajeeDisableSortStationByValue = tempArray[1];
278
279 kaajeeDisableSortStationByParamFound = true;
280
281 }
282
283 }
284
285 }
286
287 }
288
289 if ((kaajeeDefaultInstitutionParamFound) && (kaajeeDisableInstitutionParamFound) && (kaajeeSortStationByParamFound) && (kaajeeDisableSortStationByParamFound)) break;
290
291 }
292
293 //
294
295 //3. Get default login institution and sorting preference if any from cookies
296
297 boolean sortCookieFound = false;
298
299 boolean instCookieFound = false;
300
301 String defaultSortInstBy="";
302
303 String defaultInst="";
304
305 String cookieDefaultSortInstitutionByString = LoginController.COOKIE_DEFAULT_SORT_INSTITUTION_BY_STRING;
306
307 String cookieDefaultDivisionString = LoginController.COOKIE_DEFAULT_DIVISION_STRING;
308
309 Cookie[] cookies = request.getCookies();
310
311 if (cookies != null) {
312
313 for (int i=0;i<cookies.length;i++) {
314
315 if (cookies[i].getName().equals(cookieDefaultSortInstitutionByString)) {
316
317 defaultSortInstBy=cookies[i].getValue();
318
319 // store in session for LoginController, post-submit
320
321 hSess.setAttribute(LoginController.SESSION_KEY_COOKIE_DEFAULT_SORT_INSTITUTION_BY, defaultSortInstBy);
322
323 sortCookieFound = true;
324
325 } else {
326
327 if (cookies[i].getName().equals(cookieDefaultDivisionString)) {
328
329 defaultInst=cookies[i].getValue();
330
331 // store in session for LoginController, post-submit
332
333 hSess.setAttribute(LoginController.SESSION_KEY_COOKIE_DEFAULT_DIVISION, defaultInst);
334
335 instCookieFound = true;
336
337 }
338
339 }
340
341 if ((sortCookieFound) && (instCookieFound)) break;
342
343 }
344
345 }
346
347 String radioButton1CheckValue = ((kaajeeSortStationByValue.trim().length() > 0) ?
348
349 (kaajeeSortStationByValue.equals("number") ? "checked" : "") :
350
351 ((defaultSortInstBy.equals("")) ||
352
353 (defaultSortInstBy.equals("number")) ? "checked" : ""));
354
355 String radioButton2CheckValue = ((kaajeeSortStationByValue.trim().length() > 0) ?
356
357 (kaajeeSortStationByValue.equals("name") ? "checked" : "") :
358
359 ((defaultSortInstBy.equals("name")) ? "checked" : ""));
360
361 %>
362
363 <td>
364
365 <input type=radio <%= radioButton1CheckValue %> name=sortInstBy value="number" onclick="reSortSelectOptions(this.form,this.form.institution,'value')">Sort by Station Number *</td>
366
367 <td> <input type=radio <%= radioButton2CheckValue %> name=sortInstBy value="name" onclick="reSortSelectOptions(this.form,this.form.institution,'text')">Sort by Station Name *
368
369 </td>
370
371 </tr>
372
373 <tr> <td > <input type=hidden name="disableInstitutionObjHF" value=<%= kaajeeDisableInstitutionComponentsValue %> ></td></tr>
374
375 <tr> <td > <input type=hidden name="disableSortByObjHF" value=<%= kaajeeDisableSortStationByValue %> ></td></tr>
376
377 <tr> <td > <input type=hidden name="sortByObjHF" value=<%= kaajeeSortStationByValue %> ></td></tr>
378
379 <tr align="center">
380
381 <th colspan="2" nowrap>Institution:
382
383 <select name="institution" size="1">
384
385 <%
386
387 //4. Initialize and Create Option List
388
389 String imOptionList = "";
390
391 if (defaultSortInstBy.equals("name")) {
392
393 imOptionList = kaajeeEnv.getJspDropDownListLoginOptionsByName();
394
395 } else {
396
397 imOptionList = kaajeeEnv.getJspDropDownListLoginOptions();
398
399 }
400
401 // TODO: if string is "", show error message?
402
403
404
405 //5. Set the selected institution in the list based on the cookie value
406
407 if ((defaultInst != null) || ((kaajeeDefaultInstitutionValue != null) && (kaajeeDefaultInstitutionValue.trim().length() > 0))) {
408
409 // int indexDefaultInst = imOptionList.indexOf("value="+defaultInst+">");
410
411 StringBuffer sbInst = new StringBuffer();
412
413 sbInst.append(((kaajeeDefaultInstitutionValue != null) && (kaajeeDefaultInstitutionValue.trim().length() > 0)) ? kaajeeDefaultInstitutionValue : defaultInst);
414
415 int indexDefaultInst = imOptionList.indexOf("value="+ sbInst.toString() +">");
416
417 if (indexDefaultInst > -1) {
418
419 StringBuffer sb = new StringBuffer();
420
421 sb.append(imOptionList.substring(0, indexDefaultInst -1));
422
423 sb.append(" selected ");
424
425 sb.append(imOptionList.substring(indexDefaultInst, imOptionList.length()-1));
426
427 imOptionList = sb.toString();
428
429 }
430
431 }
432
433 %>
434
435 <%= imOptionList %>
436
437 </select>
438
439 * </th>
440
441 <td>&nbsp;</td>
442
443 </tr>
444
445 <tr>
446
447 <td align="right" nowrap>&nbsp;</td>
448
449 <!-- <td><input type="checkbox" name="changeverify" value="yes" /><strong>Change Verify Code (Not yet implemented)</strong></td> -->
450
451 </tr>
452
453 <tr>
454
455 <!-- Relocate Login button here!!! -->
456
457 <td align="right" nowrap>&nbsp;</td>
458
459 <td><input name="submit" type="submit" value="Login"></td>
460
461 </tr>
462
463 <tr align="center">
464
465 <td colspan="2" nowrap>&nbsp;</td>
466
467 <td>&nbsp;</td>
468
469 </tr>
470
471 <tr align="center">
472
473 <td colspan="2" nowrap>* Persistent Cookie Used (<a href="<%= request.getContextPath() %>/login/loginCookieInfo.htm"
474
475 onClick='window.open("<%= request.getContextPath() %>/login/loginCookieInfo.htm","new_win","status=no,scrollbars=yes,toolbar=no,location=no,width=400,height=450,resizable"); return false;'>more
476
477 information</a>).</td>
478
479 <td>&nbsp;</td>
480
481 </tr>
482
483 </table></td>
484
485 </tr>
486
487 <tr>
488
489 <td colspan="2"><div align="center"></div></td>
490
491 </tr>
492
493 </table>
494
495 </FORM>
496
497</BODY>
498
499</HTML>
Note: See TracBrowser for help on using the repository browser.