Add period to URL if value is not default
This commit is contained in:
parent
aa719c5d67
commit
d866af6b06
|
@ -634,6 +634,9 @@ impl TOTP {
|
||||||
} else {
|
} else {
|
||||||
account_name
|
account_name
|
||||||
};
|
};
|
||||||
|
if self.step != 30 {
|
||||||
|
params.push(format!("period={}", self.step));
|
||||||
|
}
|
||||||
|
|
||||||
format!("otpauth://{}/{}?{}", host, label, params.join("&"))
|
format!("otpauth://{}/{}?{}", host, label, params.join("&"))
|
||||||
}
|
}
|
||||||
|
@ -1173,7 +1176,7 @@ mod tests {
|
||||||
Algorithm::SHA1,
|
Algorithm::SHA1,
|
||||||
6,
|
6,
|
||||||
1,
|
1,
|
||||||
1,
|
30,
|
||||||
"TestSecretSuperSecret".as_bytes().to_vec(),
|
"TestSecretSuperSecret".as_bytes().to_vec(),
|
||||||
Some("Github".to_string()),
|
Some("Github".to_string()),
|
||||||
"constantoine".to_string(),
|
"constantoine".to_string(),
|
||||||
|
@ -1192,7 +1195,7 @@ mod tests {
|
||||||
Algorithm::SHA1,
|
Algorithm::SHA1,
|
||||||
6,
|
6,
|
||||||
1,
|
1,
|
||||||
1,
|
30,
|
||||||
"TestSecretSuperSecret".as_bytes().to_vec(),
|
"TestSecretSuperSecret".as_bytes().to_vec(),
|
||||||
Some("Github".to_string()),
|
Some("Github".to_string()),
|
||||||
"constantoine".to_string(),
|
"constantoine".to_string(),
|
||||||
|
|
Loading…
Reference in New Issue