Nonexistent login pages always fail
|Reported by:||Owned by:||Noah Kantrowitz|
If the login_path (specified in [authform] in trac.ini using the patch from #125) path does not exist, authform will get a 404 error trying to retrieve that page on successful login. This causes urllib2.urlopen() (and therefore _try_http_auth) to throw an exception, making authform think that authentication failed. So, if /login does not exist on a site, and the user authenticated successfully, a 404 error will cause the login page to say that the login failed anyway.
The attached patch catches a urllib2.HTTPError instead of an IOError, and detects for and accepts a 404 error if it occurs. Otherwise, it indicates a failed login like normal.