aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/auth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/auth.rs')
-rw-r--r--src/api/auth.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/api/auth.rs b/src/api/auth.rs
index a5a987c..ac70b82 100644
--- a/src/api/auth.rs
+++ b/src/api/auth.rs
@@ -154,6 +154,13 @@ impl Range {
}
impl AuthState {
+ /// Whether `user` has a password on this node (`--htpasswd`): it logs in by it.
+ pub(crate) fn has_password(&self, user: &str) -> bool {
+ self.users
+ .as_ref()
+ .is_some_and(|users| users.contains_key(user))
+ }
+
/// From the options; None if there is neither an htpasswd file nor a user header
/// (no users: no HTTP API, for a relay).
pub(crate) fn from_settings(