Edgewall Software

Opened 18 years ago

Closed 17 years ago

Last modified 16 years ago

#3808 closed enhancement (fixed)

redirecting to a custom page after logout — at Version 4

Reported by: anonymous Owned by: anonymous
Priority: low Milestone: 0.11
Component: general Version: 0.10.3
Severity: normal Keywords: custom logout navigation
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

i would like to redirect my users to a custom page after logout as of now when a user logs out the page on which the user clicks the logout link is reloaded

Change History (4)

comment:1 by eric@…, 17 years ago

Keywords: custom logout added
Owner: changed from Jonas Borgström to anonymous
Priority: normallow
Version: 0.9.60.10.3

to redirict to a special url after logout and to prevent ugly logout errormessages change web/auth.py

 def _do_logout(self, req):
        """Log the user out.

        Simply deletes the corresponding record from the auth_cookie table.
        """
        if req.authname == 'anonymous':
            # Not logged in
            return

        # While deleting this cookie we also take the opportunity to delete
        # cookies older than 10 days
        db = self.env.get_db_cnx()
        cursor = db.cursor()
        cursor.execute("DELETE FROM auth_cookie WHERE name=%s OR time < %s",
                       (req.authname, int(time.time()) - 86400 * 10))
        db.commit()
<<<<<<<<<<<<<<<<<<<<<<<<<<< add this line >>>>>>>>>>>>>>>>>>>>>
        req.redirect( "/" ) #  put your logout url here 
<<<<<<<<<<<<<<<<<<<<<<<<<<< add end >>>>>>>>>>>>>>>>>>>>>>>>>>>
        self._expire_cookie(req)

or hope that someone will add a better configfile driven solution

comment:2 by Christian Boos, 17 years ago

Keywords: navigation added
Milestone: 0.11
Summary: redirecting to a cutom page after logoutredirecting to a custom page after logout

This could be part of the changes for making the navigation more easily customizable.

in reply to:  2 comment:3 by Emmanuel Blot, 17 years ago

Replying to cboos:

This could be part of the changes for making the navigation more easily customizable.

I do not remember the ticket reference, but it has been decided not to allow customization of wiki page names for "special" pages (WikiStart, RecentChanges, …).
I think that this decision should be applied for this enhancement as well: Trac could redirect to a predefined page name, but this page name could be "hardcoded".

comment:4 by Christian Boos, 17 years ago

Description: modified (diff)
Milestone: 0.11
Resolution: duplicate
Status: newclosed

You're referring to #4422 I believe. The difference here is that the logout link is in the general Trac navigation (metanav in this case), so we can't assume that the Wiki component will always be available. We therefore can't redirect to "LogOut" or something. But it should be possible to do this with a simple configuration setting, if wanted.

The idea of being able to configure the default location of the navigation entries is a follow-up of the "Discussing two changesets" trac-dev thread. So I'd like to come up with a consistent solution, and I even found a pre-existing ticket for that, see #2060.

Note: See TracTickets for help on using tickets.