Added has_password to RegisteredUser

This commit is contained in:
Emi Tatsuo 2020-11-22 00:33:57 -05:00
parent abe3c00fbf
commit 3c7d3457ef
Signed by: Emi
GPG Key ID: 68FAB2E2E6DFC98B
1 changed files with 11 additions and 0 deletions

View File

@ -350,6 +350,17 @@ impl<UserData: Serialize + DeserializeOwned> RegisteredUser<UserData> {
Ok(())
}
/// Check if the user has a password set
///
/// Since authentication is done using client certificates, users aren't required to
/// set a password up front. In some cases, it may be useful to know if a user has or
/// has not set a password yet.
///
/// This returns `true` if the user has a password set, or `false` otherwise
pub fn has_password(&self) -> bool {
self.inner.pass_hash.is_some()
}
}
impl<UserData: Serialize + DeserializeOwned> std::ops::Drop for RegisteredUser<UserData> {