Trim the entered 2FA token before sending it to the backend #99

This commit is contained in:
Artem Chepurnoy 2024-01-21 18:33:44 +02:00
parent 41d19c46b4
commit 3de0e3734e
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 6 additions and 1 deletions

View File

@ -122,8 +122,13 @@ private suspend fun internalLogin(
val providerId = json val providerId = json
.encodeToString(providerEntity) .encodeToString(providerEntity)
.removeSurrounding("\"") .removeSurrounding("\"")
// None of the 2FA methods should use the leading / trailing
// whitespaces, so it's safe to trim them.
//
// https://github.com/AChep/keyguard-app/issues/99
val token = twoFactorToken.token.trim()
append("twoFactorProvider", providerId) append("twoFactorProvider", providerId)
append("twoFactorToken", twoFactorToken.token) append("twoFactorToken", token)
append("twoFactorRemember", twoFactorToken.remember.int.toString()) append("twoFactorRemember", twoFactorToken.remember.int.toString())
} }
}, },