Allow last attempted username to be displayed in views.
This commit is contained in:
parent
8d4244c1b6
commit
6c1e2f23b2
|
@ -50,6 +50,7 @@ public class AuthenticationProcessingFilter extends AbstractProcessingFilter {
|
||||||
|
|
||||||
public static final String ACEGI_SECURITY_FORM_USERNAME_KEY = "j_username";
|
public static final String ACEGI_SECURITY_FORM_USERNAME_KEY = "j_username";
|
||||||
public static final String ACEGI_SECURITY_FORM_PASSWORD_KEY = "j_password";
|
public static final String ACEGI_SECURITY_FORM_PASSWORD_KEY = "j_password";
|
||||||
|
public static final String ACEGI_SECURITY_LAST_USERNAME_KEY = "ACEGI_SECURITY_LAST_USERNAME";
|
||||||
|
|
||||||
//~ Methods ================================================================
|
//~ Methods ================================================================
|
||||||
|
|
||||||
|
@ -81,6 +82,10 @@ public class AuthenticationProcessingFilter extends AbstractProcessingFilter {
|
||||||
// Allow subclasses to set the "details" property
|
// Allow subclasses to set the "details" property
|
||||||
setDetails(request, authRequest);
|
setDetails(request, authRequest);
|
||||||
|
|
||||||
|
// Place the last username attempted into HttpSession for views
|
||||||
|
request.getSession().setAttribute(ACEGI_SECURITY_LAST_USERNAME_KEY,
|
||||||
|
username);
|
||||||
|
|
||||||
return this.getAuthenticationManager().authenticate(authRequest);
|
return this.getAuthenticationManager().authenticate(authRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %>
|
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %>
|
||||||
<%@ page import="net.sf.acegisecurity.ui.AbstractProcessingFilter" %>
|
<%@ page import="net.sf.acegisecurity.ui.AbstractProcessingFilter" %>
|
||||||
|
<%@ page import="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilter" %>
|
||||||
<%@ page import="net.sf.acegisecurity.AuthenticationException" %>
|
<%@ page import="net.sf.acegisecurity.AuthenticationException" %>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
|
@ -30,7 +31,7 @@
|
||||||
|
|
||||||
<form action="<c:url value='j_acegi_security_check'/>" method="POST">
|
<form action="<c:url value='j_acegi_security_check'/>" method="POST">
|
||||||
<table>
|
<table>
|
||||||
<tr><td>User:</td><td><input type='text' name='j_username'></td></tr>
|
<tr><td>User:</td><td><input type='text' name='j_username' <c:if test="${not empty param.login_error}">value='<%= session.getAttribute(AuthenticationProcessingFilter.ACEGI_SECURITY_LAST_USERNAME_KEY) %>'</c:if>></td></tr>
|
||||||
<tr><td>Password:</td><td><input type='password' name='j_password'></td></tr>
|
<tr><td>Password:</td><td><input type='password' name='j_password'></td></tr>
|
||||||
|
|
||||||
<tr><td colspan='2'><input name="submit" type="submit"></td></tr>
|
<tr><td colspan='2'><input name="submit" type="submit"></td></tr>
|
||||||
|
|
Loading…
Reference in New Issue