Can I add any other Log Out button somewhere?

Continuing the discussion from Logging out dismisses notification count:

Once again we had a complaint that someone can’t log out without dismissing notification count. This really stinks.

This is also a problem when impersonating a user, because you can’t stop the impersonation session without dismissing their notifications without their permission.

Question: How can we add a log out link in a place that won’t be so disruptive? :frowning:

1 Like

As a workaround I usually:

  • open a Chrome Incognito window
  • login as myself
  • impersonate
  • just close Incognito window to logout.

This specifically avoids executing the “logout” which would log users out of all sessions on all devices.


EDIT:

Alternatively if the Discourse instance uses SSO against another authentication provider then you can just visit '/session/sso` and that will log you back in as yourself.

2 Likes

Log out is usually a bad fit for finishing impersonation. It will log the user out everywhere.

Instead either use incognito as @DeanMarkTaylor said or delete cookies

Thanks to the disabled log out strict site setting we don’t participate in such default nonsense. :slight_smile:

That said, anyone with ideas to my original question about how to add a Log Out link somewhere else in the UI other than the notification list?

You could probably use a site customization to add to hamburger, but seems like a poor fit conceptually

Really? Isn’t that where it used to be? :wink:

EDIT: I went back and looked and yes, it was always under the user icon, but the notifications had their own menu and weren’t there to get in the way of account actions back in the day.

1 Like

I thought we had discussed a keyboard shortcut for this?

1 Like

It is a poor fit - but here is how it could be done - but I don’t like it - way to accessible for the average user to shoot themselves in the foot:

Added to </head> customisation:

<script type='text/x-handlebars' data-template-name='/connectors/site-map-links-last/log-out'>
{{#if currentUser}}
<li>{{d-link action="logout" class="logout" icon="sign-out" label="user.log_out"}}</li>
{{/if}}
</script>
<script type="text/discourse-plugin" version="0.1">
var HamburgerMenuComponent = require('discourse/components/hamburger-menu').default;

HamburgerMenuComponent.reopen({
    actions: {
        logout: function() {
            this.container.lookup('controller:application').send('logout')
        }
    }
});
</script>

EDIT: Actually this doesn’t quite work clicking the logout, just reloads the page for me
EDIT: Got it working with additional script block

4 Likes

It’s shift+z shift+z

4 Likes

This works, but why so cryptic and not just a single Shift+Z (and be placed on the keyboard shortcut help menu?)

Some of the comments here make it sound like logging out is some kind of horrible action… :confused:

It is on the keyboard shortcut menu :wink:

2 Likes

A UX answer: What else would you do with Z? If it were a single Z then it would be too easy to do it by mistake.

The real answer: Because vi.

1 Like

Meh, I use :wq. (Old-school.)

1 Like

Me too, in spite of the two extra keystrokes.

Most Discourse users, though, are more familiar with vi than ed. I suggested ^X^C, but it was a non-starter.

2 Likes

Also another workaround…

If the Discourse instance uses SSO against another authentication provider…

Then you can just visit /session/sso and that will log you back in as yourself.

3 Likes