mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-02-05 08:39:46 +03:00
use email instead of empty name for webauhn (#6733)
* if empty use email instead of name for webauhn * use email as display name if name is empty
This commit is contained in:
@@ -3207,7 +3207,7 @@ async fn put_reset_password(
|
|||||||
|
|
||||||
// Sending email before resetting password to ensure working email configuration and the resulting
|
// Sending email before resetting password to ensure working email configuration and the resulting
|
||||||
// user notification. Also this might add some protection against security flaws and misuse
|
// user notification. Also this might add some protection against security flaws and misuse
|
||||||
if let Err(e) = mail::send_admin_reset_password(&user.email, &user.name, &org.name).await {
|
if let Err(e) = mail::send_admin_reset_password(&user.email, user.display_name(), &org.name).await {
|
||||||
err!(format!("Error sending user reset password email: {e:#?}"));
|
err!(format!("Error sending user reset password email: {e:#?}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ async fn generate_webauthn_challenge(data: Json<PasswordOrOtpData>, headers: Hea
|
|||||||
let (mut challenge, state) = WEBAUTHN.start_passkey_registration(
|
let (mut challenge, state) = WEBAUTHN.start_passkey_registration(
|
||||||
Uuid::from_str(&user.uuid).expect("Failed to parse UUID"), // Should never fail
|
Uuid::from_str(&user.uuid).expect("Failed to parse UUID"), // Should never fail
|
||||||
&user.email,
|
&user.email,
|
||||||
&user.name,
|
user.display_name(),
|
||||||
Some(registrations),
|
Some(registrations),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ async fn _sso_login(
|
|||||||
Some((user, _)) if !user.enabled => {
|
Some((user, _)) if !user.enabled => {
|
||||||
err!(
|
err!(
|
||||||
"This user has been disabled",
|
"This user has been disabled",
|
||||||
format!("IP: {}. Username: {}.", ip.ip, user.name),
|
format!("IP: {}. Username: {}.", ip.ip, user.display_name()),
|
||||||
ErrorEvent {
|
ErrorEvent {
|
||||||
event: EventType::UserFailedLogIn
|
event: EventType::UserFailedLogIn
|
||||||
}
|
}
|
||||||
@@ -521,7 +521,7 @@ async fn authenticated_response(
|
|||||||
result["TwoFactorToken"] = Value::String(token);
|
result["TwoFactorToken"] = Value::String(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("User {} logged in successfully. IP: {}", &user.name, ip.ip);
|
info!("User {} logged in successfully. IP: {}", user.display_name(), ip.ip);
|
||||||
Ok(Json(result))
|
Ok(Json(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -231,6 +231,15 @@ impl User {
|
|||||||
pub fn reset_stamp_exception(&mut self) {
|
pub fn reset_stamp_exception(&mut self) {
|
||||||
self.stamp_exception = None;
|
self.stamp_exception = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn display_name(&self) -> &str {
|
||||||
|
// default to email if name is empty
|
||||||
|
if !&self.name.is_empty() {
|
||||||
|
&self.name
|
||||||
|
} else {
|
||||||
|
&self.email
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Database methods
|
/// Database methods
|
||||||
|
|||||||
Reference in New Issue
Block a user