feat: add feature to show warning to user if they are already logged in#14219
feat: add feature to show warning to user if they are already logged in#14219BRAVO68WEB wants to merge 5 commits into
Conversation
|
closes #11004 |
mafredri
left a comment
There was a problem hiding this comment.
Thanks for the PR, could you fix the issues and also make sure the tests pass?
|
@mafredri Can you crosscheck now? |
|
|
||
| // IF r.token and r.clientUR, exists then print warning "You are already logged in to $" | ||
| if r.token != "" && r.clientURL.String() != "" { | ||
| _, _ = fmt.Fprintf(inv.Stdout, Caret+"%s!\n", pretty.Sprint(cliui.DefaultStyles.Warn, "You are already logged in to "+r.clientURL.String())) |
There was a problem hiding this comment.
I'm thinking about what we want to achieve with this warning. As it stands I imagine it will be slightly annoying to see the warning but not be able to do an action based on it.
Also, the token could be expired so then we're kind of lying to the user as they're not really logged in.
Should we move this from middleware and prompt the user for what to do instead (+ verify token is valid)? WDYT @matifali?
There was a problem hiding this comment.
Yes I agree 💯. Checking token for validity should be a must and if expired should instruct the user to relogin.
There was a problem hiding this comment.
Guys, give me a final rundown about what should I implement?
There was a problem hiding this comment.
I think for merge this should call the coder API to see what the current user is and print the username as well. If the request fails, any message should be suppressed.
This should also print to stderr rather than stdout.
|
Hi @BRAVO68WEB , thank you for your contributions! Do you still plan to complete this PR? Looking forward to your updates. |
|
Sorry, was busy busy with work. Pushing my changes...... |
|
i am not about fetch current logged in user. |

Uh oh!
There was an error while loading. Please reload this page.