perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John ORourke <john-modp...@o-rourke.org>
Subject Re: Generating login forms from authen handler?
Date Thu, 08 Mar 2007 10:37:37 GMT
Hadmut Danisch wrote:
> how would I generate a web page (i.e. a login form) from a authen
> handler in the case that the user is not authenticated yet ?
>
> Can the authen handler generate HTML code and pass it back to the
> client as an immediate reply?
>   

The authen handler can simply return the right status code - eg. login 
failed, OK, declined etc

The response phase can then do something special with it - I have sites 
on which the front page ( / ) has the login form, and in httpd.conf I do:

<VirtualHost>
    ErrorDocument 401 /
</VirtualHost>

this means if my authen handler returns failed, the ErrorDocument 
directive will do an internal redirect to the page / which contains the 
login form.  The status code returned to the browser is still 401, which 
is great because it tells the browser that the user/pass was invalid and 
therefore not to remember it.  For added karma, the login page detects 
wether it's a 401 and if so, displays the 'login failed' message.

cheers
John



Mime
View raw message