diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-04-11 20:17:22 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-04-11 20:17:22 -0400 |
commit | ff76de77056d8d0688fa86564599be96b1ee81c0 (patch) | |
tree | 087425091b74316cc17099be3f77cc9e0c64d20a /src | |
parent | 05ace77ed76984138c18b4261fd129cc76ea3fd3 (diff) | |
download | rbw-ff76de77056d8d0688fa86564599be96b1ee81c0.tar.gz rbw-ff76de77056d8d0688fa86564599be96b1ee81c0.zip |
better pinentry messages
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/rbw-agent/actions.rs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/bin/rbw-agent/actions.rs b/src/bin/rbw-agent/actions.rs index 84e11bc..374a0c3 100644 --- a/src/bin/rbw-agent/actions.rs +++ b/src/bin/rbw-agent/actions.rs @@ -10,8 +10,15 @@ pub async fn login( .unwrap_or_else(|_| rbw::db::Db::new()); if db.needs_login() { - let password = - rbw::pinentry::getpin("prompt", "desc", tty).await.unwrap(); + let url = config_base_url().await; + let url = reqwest::Url::parse(&url).unwrap(); + let password = rbw::pinentry::getpin( + "Master Password", + &format!("Log in to {}", url.host_str().unwrap()), + tty, + ) + .await + .unwrap(); let (access_token, refresh_token, iterations, protected_key, keys) = rbw::actions::login(&email, &password).await.unwrap(); @@ -36,8 +43,13 @@ pub async fn unlock( if state.needs_unlock() { let email = config_email().await; - let password = - rbw::pinentry::getpin("prompt", "desc", tty).await.unwrap(); + let password = rbw::pinentry::getpin( + "Master Password", + "Unlock the local database", + tty, + ) + .await + .unwrap(); let db = rbw::db::Db::load_async(&email) .await @@ -114,3 +126,8 @@ async fn config_email() -> String { let config = rbw::config::Config::load_async().await.unwrap(); config.email.unwrap() } + +async fn config_base_url() -> String { + let config = rbw::config::Config::load_async().await.unwrap(); + config.base_url() +} |