Trim TOTP key input of whitespace prior to processing

* Fixes #6599
This commit is contained in:
Jonathan White 2021-06-08 19:03:07 -04:00
parent 6a8b070b0a
commit 7cb2991a13
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01

View File

@ -46,7 +46,7 @@ void TotpSetupDialog::saveSettings()
{
// Secret key sanity check
// Convert user input to all uppercase and remove '='
auto key = m_ui->seedEdit->text().toUpper().remove(" ").remove("=").toLatin1();
auto key = m_ui->seedEdit->text().toUpper().remove(" ").remove("=").trimmed().toLatin1();
auto sanitizedKey = Base32::sanitizeInput(key);
// Use startsWith to ignore added '=' for padding at the end
if (!sanitizedKey.startsWith(key)) {