1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-25 16:59:17 +01:00

[PM-739] Using a space at the beginning of otpauth:// generate a wrong OTP (#11204)

* Trimmed tariling whitespace from totp field

* Trimmed tariling whitespace from totp field

* Fix failing test
This commit is contained in:
SmithThe4th 2024-09-23 16:45:53 -04:00 committed by GitHub
parent 073fd29206
commit 0db179e974
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -329,6 +329,11 @@ export class AddEditComponent implements OnInit, OnDestroy {
this.cipher.card.expYear = normalizeExpiryYearFormat(this.cipher.card.expYear);
}
// trim whitespace from the TOTP field
if (this.cipher.type === this.cipherType.Login && this.cipher.login.totp) {
this.cipher.login.totp = this.cipher.login.totp.trim();
}
if (this.cipher.name == null || this.cipher.name === "") {
this.platformUtilsService.showToast(
"error",

View File

@ -125,7 +125,7 @@ export class LoginDetailsSectionComponent implements OnInit {
Object.assign(cipher.login, {
username: value.username,
password: value.password,
totp: value.totp,
totp: value.totp?.trim(),
} as LoginView);
return cipher;