aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Christophe BEGUE <[email protected]>2018-08-15 14:08:00 +0200
committerJean-Christophe BEGUE <[email protected]>2018-08-15 14:08:00 +0200
commitd68f57cbba3e1d1c929fbb72b135ffbd88c3732a (patch)
tree29392d0e6fc00cf44b11c2400ef8b716c2fee93a
parent19e0605d30384e04b5bba4a3aa34d40619f61add (diff)
downloadvaultwarden-d68f57cbba3e1d1c929fbb72b135ffbd88c3732a.tar.gz
vaultwarden-d68f57cbba3e1d1c929fbb72b135ffbd88c3732a.zip
Fix password hint showing logic
-rw-r--r--src/api/core/accounts.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/api/core/accounts.rs b/src/api/core/accounts.rs
index bc018f1e..1d6469c2 100644
--- a/src/api/core/accounts.rs
+++ b/src/api/core/accounts.rs
@@ -265,15 +265,16 @@ fn password_hint(data: JsonUpcase<PasswordHintData>, conn: DbConn) -> EmptyResul
}
let user = user.unwrap();
- let hint = user.password_hint.to_owned().unwrap_or("You don't have any...".to_string());
+ let hint = match user.password_hint {
+ Some(hint) => hint,
+ None => return Ok(()),
+ };
if let Some(ref mail_config) = CONFIG.mail {
if let Err(e) = mail::send_password_hint(&user.email, &hint, mail_config) {
err!(format!("There have been a problem sending the email: {}", e));
}
- }
-
- if !CONFIG.show_password_hint {
+ } else if CONFIG.show_password_hint {
err!(format!("Your password hint is: {}", &hint));
}