-
Notifications
You must be signed in to change notification settings - Fork 153
Description
Describe the bug
At present on main, with the default config and if the user is not logged in, then the below error is displayed in the header:
Using the login link in the user menu (top-right_ results in the following being displayed instead of the login page:
If you manually enter the login page URL it does load, and once you login the errors disappear. Returning when you log out. This may have been an unexpected side-effect of #1293 @jescalada as it changed the response codes, which need to handle 401 differently in various places.
Further, the error message appears to assume that jwtAuth is enabled (it is not by default), I believe thats due to:
git-proxy/src/ui/services/auth.ts
Lines 51 to 55 in ecd6161
| if (jwtAuthEnabled && !localStorage.getItem('ui_jwt_token')) { | |
| msg += 'Set your JWT token in the settings page or disable JWT auth in your app configuration.'; | |
| } else { | |
| msg += 'Check your JWT token or disable JWT auth in your app configuration.'; | |
| } |
The error messages in both branches of that if statement assume jwtAuth is enabled, but thats not the case in the default config where its turned off. You first need to check whether jwtAuth is enabled before appending content about it to the message...
To Reproduce
Steps to reproduce the behavior:
- Checkout main
- run
npm install; npm run start - Visit the admin UI URL, e.g. http://localhost:3000/dashboard/repo
- observe the error message displayed top right
- Attempt to login via the link in the user menu (top-right)
- observe content displayed instead of the login page.
Expected behaviour
401 response codes from the auth API calls are correctly handled.