Created
April 24, 2014 17:33
-
-
Save raj-rajaratnam/11262847 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Hoovam eBanking Portal</title> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<div id="wrapper"> | |
<h1>Hoovam Bank eBanking Portal</h1> | |
<% if(!session.get("info")) { %> | |
<div id="loginDiv"> | |
<form id="login" name="login"> | |
<fieldset> | |
<legend>Please Log In</legend> | |
<br /> | |
<p> | |
User Name: <input type="text" id="username" name="username" /> | |
Password: <input type="password" id="password" name="password" /> | |
</p> | |
<% if(session.get("loginFailed")) { %> | |
<div id="error" align="center"><br /><br /><p style="color:red">Incorrect username/password. Try admin/admin or samisa/samisa</p></div> | |
<% } %> | |
<input type="button" id="loginbtn" value="Login" style="background-color:lightgreen"/> | |
</fieldset> | |
</form> | |
</div> | |
<% } %> | |
<% if(session.get("info")) { %> | |
<div id="logoutDiv"> | |
<% var account = application.get('account')[session.get("info").username]; %> | |
<div id ="welcome"align="right" style="margin-right: 28pt;" ><h1> <% print(account.name); %> </h1> </div> | |
<form id="logout" name="logout"> | |
<fieldset> | |
<legend>Account Details</legend> | |
<div style="margin-left: 30pt;"> | |
<br /> | |
<p> | |
Name : <% print(account.name); %> | |
</p> | |
<br /> | |
<p> | |
Account Number : <% print(account.accountNumber); %> | |
</p> | |
<br /> | |
<p> | |
Account Type : <% print(account.accountType); %> | |
</p> | |
<br /> | |
<p> | |
Balance : <% print(account.balance); %> | |
</p> | |
<br /> | |
<p> | |
Hold : <% print(account.hold); %> | |
</p> | |
<input type="button" id="logoutbtn" value="Logout" style="background-color:lightgreen"/> | |
</div> | |
</fieldset> | |
<br /><br /> | |
<fieldset> | |
<legend>Account History</legend><br /> | |
<fieldset> | |
<legend>Current Access Details</legend> | |
<div style="margin-left: 30pt;"> | |
<br /> | |
<p> | |
Protocol : <% print(request.getProtocol()); %> | |
</p> | |
<br /> | |
<p> | |
User Agent : <% print(request.getHeader("User-Agent")); %> | |
</p> | |
<br /> | |
<p> | |
Secured Connection? : <% print(request.isSecure()); %> | |
</p> | |
<br /> | |
<p> | |
Client IP : <% print(request.getRemoteAddr()); %> | |
</p> | |
<br /> | |
<p> | |
Logged In Time : <% print(session.get("info").loginTime); %> | |
</p> | |
</div> | |
</fieldset> | |
<br /> <br /> | |
<fieldset> | |
<% var history = application.get('history')[session.get("info").username]; %> | |
<legend>Last Access Details</legend> | |
<div style="margin-left: 30pt;"> | |
<br /> | |
<p> | |
Protocol : <% print(history.protocol); %> | |
</p> | |
<br /> | |
<p> | |
User Agent : <% print(history.userAgent); %> | |
</p> | |
<br /> | |
<p> | |
Secured Connection? : <% print(history.securedConnection); %> | |
</p> | |
<br /> | |
<p> | |
Client IP : <% print(history.clientIP); %> | |
</p> | |
<br /> | |
<p> | |
Logged In Time : <% print(history.loggedInTime); %> | |
</p> | |
</div> | |
</fieldset> | |
</fieldset> | |
</form> | |
</ div> | |
<% } %> | |
</div><!--/wrapper --> | |
<!-- here comes the javascript --> | |
<!-- Grab Google CDN's jQuery. fall back to local if necessary --> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script type='text/javascript'> | |
window.jQuery || document.write('<script src="js/jquery.min.js">\x3C/script>') | |
</script> | |
<script type="text/javascript"> | |
function getTime() { | |
var d = new Date().toString(); | |
var dateStr = d.substring(0, d.indexOf(":",20)); | |
return dateStr; | |
} | |
$("#loginbtn").click(function() { | |
if (document.login.username.value == "") { | |
alert("User Name cannot be blank"); | |
document.login.username.focus(); | |
exit(0); | |
} | |
if (document.login.password.value == "") { | |
alert("Password cannot be blank"); | |
document.login.password.focus(); | |
exit(0); | |
} | |
var curtime = getTime(); | |
var username = encodeURI(document.login.username.value); | |
var password = encodeURI(document.login.password.value); | |
$.get("ebank.jag", { username: username, password: password, time: curtime, action: "login"}, | |
function(data){ | |
location.reload(); | |
}); | |
}); | |
$("#logoutbtn").click(function() { | |
$.get("ebank.jag", {action: "logout"}, | |
function(data){ | |
location.reload(); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment