Special messages when user has no password hint

This commit is contained in:
Jean-Christophe BEGUE
2018-09-11 13:04:34 +02:00
parent e2ab2f7306
commit 1c641d7635
2 changed files with 19 additions and 15 deletions

View File

@@ -273,17 +273,16 @@ fn password_hint(data: JsonUpcase<PasswordHintData>, conn: DbConn) -> EmptyResul
}
let user = user.unwrap();
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) {
if let Err(e) = mail::send_password_hint(&user.email, user.password_hint, mail_config) {
err!(format!("There have been a problem sending the email: {}", e));
}
} else if CONFIG.show_password_hint {
err!(format!("Your password hint is: {}", &hint));
if let Some(hint) = user.password_hint {
err!(format!("Your password hint is: {}", &hint));
} else {
err!(format!("Sorry, you have no password hint..."));
}
}
Ok(())