Conversation
Codecov Report
@@ Coverage Diff @@
## main #298 +/- ##
==========================================
+ Coverage 64.81% 67.47% +2.66%
==========================================
Files 67 140 +73
Lines 756 7407 +6651
Branches 74 77 +3
==========================================
+ Hits 490 4998 +4508
- Misses 251 1899 +1648
- Partials 15 510 +495
Continue to review full report at Codecov.
|
kylecarbs
left a comment
There was a problem hiding this comment.
Minor nits. Overall, wonderful change!
cli/login.go
Outdated
| } | ||
| } | ||
|
|
||
| func saveSessionToken(cmd *cobra.Command, client *codersdk.Client, sessionToken string, serverURL *url.URL) error { |
There was a problem hiding this comment.
I'm hesitant to rip this into a distinct function. We already validate the "me" user request above, so feels like that should be reused.
There was a problem hiding this comment.
The alternative is to duplicate the persistence code both in the 'create initial user' and 'login' flows - inlined this function in 13696a7
Another thing we could consider is bringing the "me" check above (since it's only required for initial login), and factor out the common save-session-token-and-url logic into this function. Happy with whichever you prefer.
…307) Fixes #304 Unblocks #298 After logging in, the login flow should redirect to a whatever path is specified by the `?redirect` query parameter. This is important for cases like #298 - where we need to set `?redirect=%2Fcli_auth`, but also really any case where the user is linked and might have to go back to the login screen. The fix is simple - just check if the `redirect` query parameter is set, and if it is, use that as the path to redirect to on success. Also adds a test case - we had one checking that we redirect to the default (root `/`) url, but not one of the `?redirect` param
Fixes #210 - this isPR implements
coder loginin the case where the default user is already created.This change adds:
openURLandisWSLfunctions to support opening the browser/api/v2/api-keysendpoint that can bePOST'd to in order to request a new api key for a usercli-authroute + page that shows the generated api keyThe
/cli-authroute, like in v1, is very minimal:And the terminal UX looks like this:
TODO:
http(s)://some-server/cli-authPOSTto the Api keys route400cli.OpenURLdata race: https://github.com/coder/coder/runs/5239455795?check_suite_focus=true#step:7:165