Rename SecondFactor => TwoFactor
This commit is contained in:
@@ -9,21 +9,21 @@ pub type UserID = String;
|
||||
pub struct FactorID(pub String);
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub enum SecondFactorType {
|
||||
pub enum TwoFactorType {
|
||||
TOTP(TotpKey)
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
||||
pub struct SecondFactor {
|
||||
pub struct TwoFactor {
|
||||
pub id: FactorID,
|
||||
pub name: String,
|
||||
pub kind: SecondFactorType,
|
||||
pub kind: TwoFactorType,
|
||||
}
|
||||
|
||||
impl SecondFactor {
|
||||
impl TwoFactor {
|
||||
pub fn type_str(&self) -> &'static str {
|
||||
match self.kind {
|
||||
SecondFactorType::TOTP(_) => "Authenticator app"
|
||||
TwoFactorType::TOTP(_) => "Authenticator app"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ pub struct User {
|
||||
|
||||
/// 2FA
|
||||
#[serde(default)]
|
||||
pub two_factor: Vec<SecondFactor>,
|
||||
pub two_factor: Vec<TwoFactor>,
|
||||
|
||||
/// None = all services
|
||||
/// Some([]) = no service
|
||||
@@ -69,7 +69,7 @@ impl User {
|
||||
!self.two_factor.is_empty()
|
||||
}
|
||||
|
||||
pub fn add_factor(&mut self, factor: SecondFactor) {
|
||||
pub fn add_factor(&mut self, factor: TwoFactor) {
|
||||
self.two_factor.push(factor);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user