-
-
Notifications
You must be signed in to change notification settings - Fork 815
Store Hex username
in credentials file and improve key revocation error message
#4446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
username
in credentials file and improve key revocation error message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, thank you. Left some notes inline
println!( | ||
" | ||
Your previous Hex API key was created with username `{}` which is different from the username | ||
used to create the new Hex API key. You have to delete the key `{}` manually at https://hex.pm", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wrap before 80 columns! Could you call the wrap
function on this please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
.is_err() | ||
{ | ||
println!( | ||
"There was an error deleting key `{}` from Hex. You have to delete the key manually at https://hex.pm", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this also please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
compiler-cli/src/hex/auth.rs
Outdated
|
||
let encrypted_key = EncryptedApiKey::load(&path); | ||
|
||
if let Ok(encrypted_key) = encrypted_key { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This silently discards file system errors!
Let's move all of this loading logic into the load function, and have it read once, return an error if the file isn't readable, and also if the file is in neither format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, than you for your feedback.
I moved the logic to a separate function as suggested, it does also read better.
3be7579
to
b6eb449
Compare
b6eb449
to
03e37c6
Compare
resolves #4319
Only try to revoke token if new and previous usernames match, otherwise hint the user to delete the token manually.
Summary of changes:
username
in credentials file.before:
after: