Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page import="org.springframework.security.context.SecurityContextHolder" %>
<%@ page import="org.springframework.security.context.SecurityContext" %>
<html>
<head>
<title>Login</title>
<style type="text/css">
#login-mask{
position:absolute;
left:0;
top:0;
width:100%;
height:100%;
z-index:20000;
background-color:white;
}
#login{
position:absolute;
left:30%;
top:35%;
padding:2px;
z-index:20001;
height:auto;
}
#login a {
color:#225588;
}
#login .login-indicator{
background:white;
color:#444;
font:bold 13px tahoma,arial,helvetica;
padding:10px;
margin:0;
height:auto;
}
#login-msg {
font: normal 10px arial,tahoma,sans-serif;
}
</style>
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/js/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/js/resources/css/xtheme-gray.css" />
<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/Login.css" />
<script language="Javascript" src="<%= request.getContextPath() %>/js/adapter/ext/ext-base.js"></script>
<script language="Javascript" src="<%= request.getContextPath() %>/js/ext-all.js"></script>
</head>
<body style="overflow: hidden">
<script>
Ext.onReady( function()
{
var login = new Ext.FormPanel(
{
labelWidth :75,
url :'<%= request.getContextPath() %>/j_spring_security_check',
method :'POST',
id :'_loginForm',
standardSubmit :true,
frame :true,
title :'Login',
bodyStyle :'padding:5px 5px 0',
iconCls :'user-suit',
width :350,
keys:
[
{
key: Ext.EventObject.ENTER,
fn: function()
{
var sb = Ext.getCmp('my-status');
sb.showBusy();
document.getElementsByTagName("form")[0].action = "<%= request.getContextPath() %>/j_spring_security_check";
document.getElementsByTagName("form")[0].submit();
}
}
],
defaults :
{
width :230
},
defaultType :'textfield',
items :
[
{
fieldLabel :'Username',
name :'j_username',
id :'j_username',
allowBlank :false
},
{
fieldLabel :'Password',
name :'j_password',
id :'j_password',
allowblank :false,
inputType :'password'
},
{
xtype :'panel',
buttonAlign :'right',
width :340,
buttons :
[
{
text :'Reset',
type :'reset',
minWidth: 75,
handler :function()
{
document.getElementsByTagName("form")[0].reset();
}
},
{
text :'Login',
type :'submit',
minWidth: 75,
handler :function()
{
var sb = Ext.getCmp('my-status');
sb.showBusy();
document.getElementsByTagName("form")[0].action = "<%= request.getContextPath() %>/j_spring_security_check";
document.getElementsByTagName("form")[0].submit();
}
}
]
}
],
bbar: new Ext.StatusBar(
{
id: 'my-status',
// defaults to use when the status is cleared:
defaultText: 'Default status text',
defaultIconCls: 'default-icon',
// values to set initially:
text: 'Ready',
iconCls: 'ready-icon'
<%
if (!(request.getParameter("login_error") == null))
{
%>
,items:
[
{
text: '<div style=\'color: red\'>Username/Password combination invalid.</div>'
}
]
<% } %>
})
});
login.render(document.getElementById('_login'));
});
</script>
<div id="login-mask" style=""></div>
<div id="login">
<div id="_login" class="login-indicator"></div>
</div>
</body>
</html>
Now I'm working on pulling the Authentication request failed: org.springframework.security.BadCredentialsExcepti on message and using that instead of the hardcoded 'User/Pass combo failure' meessage.