diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-03-25 15:18:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-25 15:18:30 -0500 |
commit | 2f9bd4eb45c57ce8e8d3011d7660223c05b50f98 (patch) | |
tree | c1de5822c8010191d1c327112fba7a3a2033d41e /src/api.rs | |
parent | 0509f3070dd66f5e770dd970f7def6878a57ddd8 (diff) | |
parent | a1105320acfc8e48c707f2870ad2ba9ea7480bf4 (diff) | |
download | rbw-2f9bd4eb45c57ce8e8d3011d7660223c05b50f98.tar.gz rbw-2f9bd4eb45c57ce8e8d3011d7660223c05b50f98.zip |
Merge pull request #111 from Necoro/2fa_email
Add support for 2FA-method 'Email'.
Diffstat (limited to 'src/api.rs')
-rw-r--r-- | src/api.rs | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -57,6 +57,31 @@ pub enum TwoFactorProviderType { WebAuthn = 7, } +impl TwoFactorProviderType { + pub fn message(&self) -> &str { + match *self { + TwoFactorProviderType::Authenticator => "Enter the 6 digit verification code from your authenticator app.", + TwoFactorProviderType::Email => "Enter the PIN you received via email.", + _ => "Enter the code." + } + } + + pub fn header(&self) -> &str { + match *self { + TwoFactorProviderType::Authenticator => "Authenticator App", + TwoFactorProviderType::Email => "Email Code", + _ => "Two Factor Authentication" + } + } + + pub fn grab(&self) -> bool { + match *self { + TwoFactorProviderType::Email => false, + _ => true + } + } +} + impl<'de> serde::Deserialize<'de> for TwoFactorProviderType { fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error> where |