Skip to content

Commit 351e2ef

Browse files
korbinmkj
authored andcommitted
make matches_username return a bool
1 parent b3f74c1 commit 351e2ef

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/event.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,11 @@ impl<'g, 'a> ServPasswordAuth<'g, 'a> {
367367
pub fn matches_username(
368368
&self,
369369
username: impl core::convert::AsRef<str>,
370-
) -> Result<bool> {
371-
Ok(self.username()?.as_bytes().ct_eq(username.as_ref().as_bytes()).into())
370+
) -> bool {
371+
match self.username() {
372+
Ok(u) => u.as_bytes().ct_eq(username.as_ref().as_bytes()).into(),
373+
_ => false,
374+
}
372375
}
373376

374377
/// Retrieve the password presented by the user.
@@ -567,8 +570,11 @@ impl<'g, 'a> ServFirstAuth<'g, 'a> {
567570
pub fn matches_username(
568571
&self,
569572
username: impl core::convert::AsRef<str>,
570-
) -> Result<bool> {
571-
Ok(self.username()?.as_bytes().ct_eq(username.as_ref().as_bytes()).into())
573+
) -> bool {
574+
match self.username() {
575+
Ok(u) => u.as_bytes().ct_eq(username.as_ref().as_bytes()).into(),
576+
_ => false,
577+
}
572578
}
573579

574580
/// Allow the user to log in.

0 commit comments

Comments
 (0)