Skip to content

Conversation

emlun
Copy link
Member

@emlun emlun commented Oct 8, 2023

Purpose

This was an oversight in #8757: the new "Log out" button is always shown in the "Actions" menu, even when authentication is not enabled.

Testing

These manual tests have been done:

  1. With authentication disabled (set username to empty): click the "Actions" menu. Verify that the "Log out" button is not shown.
  2. Set a username and password and log back in. Click the "Actions" menu. Verify that the "Log out" button is shown.
  3. Unset the username and save the config. Click the "Actions" menu. Verify that the "Log out" button is again not shown (do not refresh the page after saving the config).

Screenshots

Before (3d0da5a):

Screenshot before: Log out button shown with auth not configured

After (f032f07):

Screenshot after: Log out button not shown when auth not configured

Documentation

No changes needed.

emlun added 4 commits October 8, 2023 15:14
The frontend config is also updated by "ConfigSaved" events, which do
not include the extra fields added at the `/rest/config` API endpoint,
which results in the no auth warning being shown briefly until the
config reloads. Let's just duplicate the `IsAuthEnabled()` logic on
the front-end side instead.
@tomasz1986
Copy link
Member

While touching this code, can you add a divider before the "Log Out" button? It's not really related in any way to "Advanced" and "Logs".

@emlun
Copy link
Member Author

emlun commented Oct 8, 2023

While touching this code, can you add a divider before the "Log Out" button? It's not really related in any way to "Advanced" and "Logs".

Done.

Or should we perhaps move it to the "Shutdown" and "Restart" group? Like this:

"Log out" grouped with "Shutdown" and "Restart"

One drawback of this is it can take a second before the config loads, in which case "Log out" suddenly appears and pushes the rest down if one already has the menu open. Which could make you click the wrong button if it suddenly changes just as you're about to click.

@emlun emlun requested a review from calmh October 8, 2023 18:05
@bt90
Copy link
Contributor

bt90 commented Oct 8, 2023

Could we move that group to the bottom?

@tomasz1986
Copy link
Member

tomasz1986 commented Oct 8, 2023

Could we move that group to the bottom?

Maybe something like this?

Settings
Show ID
---divider---
Advanced
Logs
Support Bundle
---divider---
Shutdown
Restart
Log Out

@Stolka
Copy link

Stolka commented Oct 14, 2023

I think the Ban icon (fa-ban) should be replaced with Sign Out icon (fa-sign-out).

And perhaps add a divider before the Log Out button? The thing is there is no confirmation dialog when you click Restart or Shutdown, and this change to the menu order would mess with some people's muscle memory, adding a divider before Log Out button should minimize misclicking.

@emlun
Copy link
Member Author

emlun commented Oct 14, 2023

While touching this code, can you add a divider before the "Log Out" button? It's not really related in any way to "Advanced" and "Logs".

Done.

I think the Ban icon (fa-ban) should be replaced with Sign Out icon (fa-sign-out).

Done.

Or should we perhaps move it to the "Shutdown" and "Restart" group? Like this:

Could we move that group to the bottom?

And perhaps add a divider before the Log Out button? The thing is there is no confirmation dialog when you click Restart or Shutdown, and this change to the menu order would mess with some people's muscle memory, adding a divider before Log Out button should minimize misclicking.

This seems to balloon the scope of the PR a bit too much, and I'd prefer to not hold up the original fix with an extended discussion of if and how to move things around in the menu, so I'd prefer to punt that to a separate PR/issue. Whatever change the discussion settles on, its implementation in code will take orders of magnitude less time than the discussion itself (no offense to anyone involved, that's just the reality of this kind of thing where there's no single clearly correct solution).

So, this is what the menu looks like as of commit 558ad4f:

actions

Thoughts on leaving this PR at that, and punting the discussion of moving things around to a separate PR/issue?

@tomasz1986
Copy link
Member

Thoughts on leaving this PR at that, and punting the discussion of moving things around to a separate PR/issue?

It's not a very huge deal but I would suggest moving the button (with its divider) after the Support Bundle then. Otherwise, there will still be jumping when one has debugging enabled and the button pops up later than the rest of the menu entries.

@emlun
Copy link
Member Author

emlun commented Oct 14, 2023

I would suggest moving the button (with its divider) after the Support Bundle then. Otherwise, there will still be jumping when one has debugging enabled

Agreed, done.

actions

@acolomb acolomb merged commit 14569f1 into syncthing:main Oct 15, 2023
@acolomb
Copy link
Member

acolomb commented Oct 15, 2023

This should probably go into the next .rc as well, since it fixes an issue with new code in the upcoming release.

@emlun emlun deleted the no-auth-no-logout branch October 15, 2023 15:44
@calmh calmh added this to the v1.26.0 milestone Oct 24, 2023
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Apr 9, 2025
@syncthing syncthing locked and limited conversation to collaborators Apr 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants