Browse Source
if empty use email instead of name for webauhn
pull/6733/head
stefan0xC
7 days ago
No known key found for this signature in database
GPG Key ID: 817020C608FE9C09
2 changed files with
10 additions and
1 deletions
-
src/api/core/two_factor/webauthn.rs
-
src/db/models/user.rs
|
|
|
@ -144,7 +144,7 @@ async fn generate_webauthn_challenge(data: Json<PasswordOrOtpData>, headers: Hea |
|
|
|
let (mut challenge, state) = WEBAUTHN.start_passkey_registration( |
|
|
|
Uuid::from_str(&user.uuid).expect("Failed to parse UUID"), // Should never fail
|
|
|
|
&user.email, |
|
|
|
&user.name, |
|
|
|
user.display_name(), |
|
|
|
Some(registrations), |
|
|
|
)?; |
|
|
|
|
|
|
|
|
|
|
|
@ -231,6 +231,15 @@ impl User { |
|
|
|
pub fn reset_stamp_exception(&mut self) { |
|
|
|
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
|
|
|
|
|