mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fix validator issue on hotp count
This commit is contained in:
parent
9225cbaba3
commit
ba45fc2685
2 changed files with 14 additions and 1 deletions
|
|
@ -239,6 +239,12 @@
|
||||||
"zh": "请输入 1-128 之间的数字",
|
"zh": "请输入 1-128 之间的数字",
|
||||||
"en-tts": "Please enter a number from 1-128"
|
"en-tts": "Please enter a number from 1-128"
|
||||||
},
|
},
|
||||||
|
"vault.illegal_count": {
|
||||||
|
"en": "Please enter an integer number",
|
||||||
|
"ja": "整数を入力してください。",
|
||||||
|
"zh": "请输入一个整数。",
|
||||||
|
"en-tts": "Please enter an integer number"
|
||||||
|
},
|
||||||
"vault.illegal_totp": {
|
"vault.illegal_totp": {
|
||||||
"en": "Shared secret is not valid Base32",
|
"en": "Shared secret is not valid Base32",
|
||||||
"ja": "共有秘密は無効ですBase32",
|
"ja": "共有秘密は無効ですBase32",
|
||||||
|
|
|
||||||
|
|
@ -396,7 +396,7 @@ impl ActionManager {
|
||||||
self.tt.sleep_ms(SWAP_DELAY_MS).unwrap();
|
self.tt.sleep_ms(SWAP_DELAY_MS).unwrap();
|
||||||
match self.modals
|
match self.modals
|
||||||
.alert_builder(t!("vault.hotp.count", xous::LANG))
|
.alert_builder(t!("vault.hotp.count", xous::LANG))
|
||||||
.field(Some("0".to_string()), Some(length_validator))
|
.field(Some("0".to_string()), Some(count_validator))
|
||||||
.build()
|
.build()
|
||||||
{
|
{
|
||||||
Ok(entry) => entry.content()[0].content.as_str().unwrap().parse::<u64>().unwrap(),
|
Ok(entry) => entry.content()[0].content.as_str().unwrap().parse::<u64>().unwrap(),
|
||||||
|
|
@ -1209,3 +1209,10 @@ fn length_validator(input: TextEntryPayload) -> Option<xous_ipc::String<256>> {
|
||||||
_ => Some(xous_ipc::String::<256>::from_str(t!("vault.illegal_number", xous::LANG))),
|
_ => Some(xous_ipc::String::<256>::from_str(t!("vault.illegal_number", xous::LANG))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fn count_validator(input: TextEntryPayload) -> Option<xous_ipc::String<256>> {
|
||||||
|
let text_str = input.as_str();
|
||||||
|
match text_str.parse::<u64>() {
|
||||||
|
Ok(_input_int) => None,
|
||||||
|
_ => Some(xous_ipc::String::<256>::from_str(t!("vault.illegal_count", xous::LANG))),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue