on Sun Feb 18 2007, David Abrahams <dave-UB3wUj7V41K5azolltMz9laTQe2KTcn/-AT-public.gmane.org> wrote:
> David Abrahams > <[EMAIL PROTECTED]> writes: > >> John Hampton <[EMAIL PROTECTED]> >> writes: >> >>> David Abrahams wrote: >>>> I'm using the new AccountManager, one of whose benefits is that the >>>> login screen is a real HTML form. IIUC, if I do what you're >>>> suggesting, I'll end up with an HTTP auth dialog box instead. >>> >>> You'll have to patch trac proper, but the attached patch will redirect >>> an anonymous user to /login if they get a permission error >>> >>> -John >>> >>> >>> > >>> diff -urN trac-0.10.3/trac/web/main.py >>> trac-0.10.3-loginredir/trac/web/main.py >>> --- trac-0.10.3/trac/web/main.py 2006-12-12 18:44:08.000000000 +0000 >>> +++ trac-0.10.3-loginredir/trac/web/main.py 2007-01-19 00:00:31.556000250 >>> +0000 >>> @@ -402,6 +402,8 @@ >>> 'message': e.message >>> } >>> try: >>> + if (req.authname == 'anonymous') and (e.reason == 'Forbidden'): >>> + req.redirect(env.href('login', >>> {'referer':req.href(req.path_info)})) >>> req.send_error(sys.exc_info(), status=e.code) >>> except RequestDone: >>> return [] >> >> This is fantastic; it works perfectly. Is there any chance the powers >> that be would accept it? > > I take it back; it doesn't quite work perfectly. When trying to access > > https://mysite/trac/mytrac/ticket/19#comment:3 > > After logging in, I am redirected to > > https://mysite/trac/mytrac#comment:3 > > got a fix for this one? I think I've now fixed it; see http://trac.edgewall.org/ticket/5340 for an updated patch. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Trac Users" group. To post to this group, send email to trac-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/trac-users?hl=en -~----------~----~----~----~------~----~------~--~---