forked from proxmox-mirrors/proxmox
tfa: add functions to unlock totp and tfa
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
a3448feb1a
commit
39017fa334
@ -143,7 +143,30 @@ fn check_webauthn<'a, 'config: 'a, 'origin: 'a>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl TfaConfig {
|
impl TfaConfig {
|
||||||
// Get a u2f registration challenge.
|
/// Unlock a user's 2nd factor authentication (including TOTP).
|
||||||
|
pub fn unlock_tfa(&mut self, userid: &str) -> Result<(), Error> {
|
||||||
|
match self.users.get_mut(userid) {
|
||||||
|
Some(user) => {
|
||||||
|
user.totp_locked = false;
|
||||||
|
user.tfa_locked_until = None;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
None => bail!("no such challenge"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Unlock a user's TOTP challenges.
|
||||||
|
pub fn unlock_totp(&mut self, userid: &str) -> Result<(), Error> {
|
||||||
|
match self.users.get_mut(userid) {
|
||||||
|
Some(user) => {
|
||||||
|
user.totp_locked = false;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
None => bail!("no such challenge"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get a u2f registration challenge.
|
||||||
pub fn u2f_registration_challenge<A: ?Sized + OpenUserChallengeData>(
|
pub fn u2f_registration_challenge<A: ?Sized + OpenUserChallengeData>(
|
||||||
&mut self,
|
&mut self,
|
||||||
access: &A,
|
access: &A,
|
||||||
|
Loading…
Reference in New Issue
Block a user