mirror of
https://gitlab.gnome.org/World/Authenticator.git
synced 2025-03-04 00:34:40 +01:00
it's actually totp not otp
This commit is contained in:
parent
068a96aa34
commit
4845bcb3ea
3 changed files with 9 additions and 9 deletions
|
@ -6,5 +6,5 @@ CREATE TABLE "providers" (
|
|||
"help_url" VARCHAR NULL,
|
||||
"image_uri" VARCHAR NULL,
|
||||
"period" INTEGER NULL DEFAULT 30,
|
||||
"algorithm" VARCHAR DEFAULT "OTP"
|
||||
"algorithm" VARCHAR DEFAULT "TOTP"
|
||||
);
|
||||
|
|
|
@ -6,8 +6,8 @@ use std::string::ToString;
|
|||
#[repr(u32)]
|
||||
#[genum(type_name = "ProviderAlgorithm")]
|
||||
pub enum Algorithm {
|
||||
#[genum(name = "OTP")]
|
||||
OTP = 0,
|
||||
#[genum(name = "TOTP")]
|
||||
TOTP = 0,
|
||||
#[genum(name = "HOTP")]
|
||||
HOTP = 1,
|
||||
Steam = 2,
|
||||
|
@ -16,8 +16,8 @@ pub enum Algorithm {
|
|||
impl Algorithm {
|
||||
pub fn to_locale_string(&self) -> String {
|
||||
match *self {
|
||||
Algorithm::HOTP => gettext("HOTP"),
|
||||
Algorithm::OTP => gettext("One-Time-Password"),
|
||||
Algorithm::HOTP => gettext("HMAC-based One-time Password"),
|
||||
Algorithm::TOTP => gettext("Time-based One-Time-Password"),
|
||||
Algorithm::Steam => gettext("Steam"),
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ impl FromStr for Algorithm {
|
|||
type Err = anyhow::Error;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s.to_lowercase().as_ref() {
|
||||
"otp" => Ok(Self::OTP),
|
||||
"totp" | "otp" => Ok(Self::TOTP),
|
||||
"hotp" => Ok(Self::HOTP),
|
||||
"steam" => Ok(Self::Steam),
|
||||
_ => anyhow::bail!("Unsupported algorithm"),
|
||||
|
@ -38,7 +38,7 @@ impl FromStr for Algorithm {
|
|||
impl ToString for Algorithm {
|
||||
fn to_string(&self) -> String {
|
||||
match *self {
|
||||
Algorithm::OTP => "otp",
|
||||
Algorithm::TOTP => "totp",
|
||||
Algorithm::HOTP => "hotp",
|
||||
Algorithm::Steam => "steam",
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ static PROPERTIES: [subclass::Property; 8] = [
|
|||
name,
|
||||
"algorithm",
|
||||
"Algorithm",
|
||||
Some(&Algorithm::OTP.to_string()),
|
||||
Some(&Algorithm::TOTP.to_string()),
|
||||
glib::ParamFlags::READWRITE,
|
||||
)
|
||||
}),
|
||||
|
@ -144,7 +144,7 @@ impl ObjectSubclass for ProviderPriv {
|
|||
website: RefCell::new(None),
|
||||
help_url: RefCell::new(None),
|
||||
image_uri: RefCell::new(None),
|
||||
algorithm: RefCell::new(Algorithm::OTP.to_string()),
|
||||
algorithm: RefCell::new(Algorithm::TOTP.to_string()),
|
||||
period: Cell::new(30),
|
||||
filter_model: gtk::FilterListModel::new(Some(&model), gtk::NONE_FILTER),
|
||||
accounts: model,
|
||||
|
|
Loading…
Add table
Reference in a new issue