Fix invalid token error if token has trailing characters

This commit is contained in:
xenia 2023-04-26 05:37:58 +00:00 committed by Bilal Elmoussaoui
parent 2967718975
commit d7ee4a0c86

View file

@ -308,6 +308,7 @@ impl AccountAddDialog {
if let Some(ref provider) = *imp.selected_provider.borrow() {
let username = imp.username_entry.text();
let token = imp.token_entry.text();
let token = token.trim_end_matches('=');
if !OTP::is_valid(&token) {
imp.error_revealer.popup(&gettext("Invalid Token"));
anyhow::bail!("Token {} is not a valid Base32 secret", &token);