DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3839>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3839

Problem bookmarking login page





------- Additional Comments From [EMAIL PROTECTED]  2003-08-28 17:54 -------

There is a dirty hack way of solving this in TC4. I should probably be flogged in 
public for posting 
such a filthy hack, but anyway... I suspect it is not very portable.

In web.xml define an error page for 400 such as 'error400.jsp':
In that page do something along the lines of:

<%
String requestURI = (String)request.getAttribute( "javax.servlet.error.request_uri" );
boolean isLogin = requestURI.indexOf( "j_security_check" ) >= 0;

if ( isLogin ) {
    String username = request.getParameter( "j_username" );
    String password = request.getParameter( "j_password" );

    session.setAttribute( "j_username", username );
    session.setAttribute( "j_password", password );    

    response.sendRedirect( "/some/protected/resource" );
    return;
}
%>
// display error message.




In the form based login page do something like:

<%
  // j_username and j_password may be set in the error400.jsp page on a 
  // direct reference to the j_security_check page.
  String username = (String)session.getAttribute( "j_username" );
  String password = (String)session.getAttribute( "j_password" );

  boolean autoLogin = username != null && password != null;

  if ( autoLogin ) {
    session.removeAttribute( "j_username" );
    session.removeAttribute( "j_password" );
%>

  <form name="login" method="POST" action="j_security_check">
    <input type="hidden" name="j_username" value="<%=username%>"/>
    <input type="hidden" name="j_password" value="<%=password%>"/>
  </form>

  <script language="JavaScript">
    document.login.submit();
  </script>

%>
    // now let the browser auto submit the login.
    return
  }
%>

//  Display your normal  login page.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to