Commit 8b761c0a authored by John Schanck's avatar John Schanck
Browse files

Bug 1831394 - omit the retries left counter from the invalid PIN prompt when...

Bug 1831394 - omit the retries left counter from the invalid PIN prompt when it is large. r=keeler,fluent-reviewers,flod

The PIN for a user's security key will be temporarily blocked after three
failed PIN entry attempts, but the "retries left" counter in the invalid PIN
prompt is the (typically larger) number of attempts left before the PIN is
permanently blocked. This patch makes it so that the retries left counter is
only shown when it is equal to 1, 2, or 3.

Differential Revision: https://phabricator.services.mozilla.com/D177294
parent 6e0c7eda
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -7638,12 +7638,23 @@ var WebAuthnPromptHelper = {

  prompt_for_password(origin, wasInvalid, retriesLeft, aPassword) {
    let dialogText;
    if (wasInvalid) {
      dialogText = this._l10n.formatValueSync("webauthn-pin-invalid-prompt", {
        retriesLeft,
      });
    } else {
    if (!wasInvalid) {
      dialogText = this._l10n.formatValueSync("webauthn-pin-required-prompt");
    } else if (retriesLeft < 0 || retriesLeft > 3) {
      // The token will need to be power cycled after three incorrect attempts,
      // so we show a short error message that does not include retriesLeft. It
      // would be confusing to display retriesLeft at this point, as the user
      // will feel that they only get three attempts.
      dialogText = this._l10n.formatValueSync(
        "webauthn-pin-invalid-short-prompt"
      );
    } else {
      // The user is close to having their PIN permanently blocked. Show a more
      // severe warning that includes the retriesLeft counter.
      dialogText = this._l10n.formatValueSync(
        "webauthn-pin-invalid-long-prompt",
        { retriesLeft }
      );
    }

    let res = Services.prompt.promptPasswordBC(
+4 −4
Original line number Diff line number Diff line
@@ -4,10 +4,10 @@

# Variables:
#  $retriesLeft (Number): number of tries left
webauthn-pin-invalid-prompt =
webauthn-pin-invalid-long-prompt =
    { $retriesLeft ->
        [0] Wrong PIN! Please enter the correct PIN for your device.
        [one] Wrong PIN! Please enter the correct PIN for your device. You have { $retriesLeft } attempt left.
       *[other] Wrong PIN! Please enter the correct PIN for your device. You have { $retriesLeft } attempts left.
        [one] Incorrect PIN. You have { $retriesLeft } attempt left before you permanently lose access to the credentials on this device.
       *[other] Incorrect PIN. You have { $retriesLeft } attempts left before you permanently lose access to the credentials on this device.
    }
webauthn-pin-invalid-short-prompt = Incorrect PIN. Try again.
webauthn-pin-required-prompt = Please enter the PIN for your device.