fix(server): improve confusing login errors #13372
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #7921, Fixes #12070, Fixes #12168
Motivation
token not valid
errors are very confusing for non-operator end users. they also appear before you've even logged in or after you just logged out.Modifications
fix(ui): don't show auth error when no cookie
per the in-line comment, this generally means you haven't logged in yet
if it's coming from a failed login, instead of saying "Failed to load version/info", say "Login Failed", which is a lot more concrete and understandable at a glance (that doesn't require any knowledge of API endpoints or the code)
also refactor some code
getCookie
func from the previously unusedcookie
util filelogin
page to use thesetCookie
func as well, which effectively duplicated the logic previouslylogin
func assetUser
, which is a lot less confusing thanuser
fix(server): be more specific about validation errors
"token not valid" is not the most helpful thing, we can say exactly what's wrong with it
NOTE: this technically removes the fallback to
server
auth when using it in conjunction with another oneserver
with anything, so that can often be a misconfigurationserver
for the UI (previously we hadoauth2-proxy
in front)server
whenclient
had failedVerification