Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9294 from fcampo/RemainingPinIntents-settings
[settings] Bug 860660 - PIN&PUK: Show counter of trials remain
  • Loading branch information
Fernando Campo committed Apr 22, 2013
2 parents 77db64f + 097b7f6 commit 4cd2d49
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 22 deletions.
4 changes: 4 additions & 0 deletions apps/settings/index.html
Expand Up @@ -1658,6 +1658,10 @@ <h1></h1>
<span id="messageBody">3 tries left.</span>
</div>
<div id="inputCodeRetriesLeft" data-l10-id="inputCodeRetriesLeft">
3 tries left
</div>
<div id="pinArea" class="sim-code-area">
<div data-l10n-id="simPin">SIM PIN</div>
<div class="input-wrapper">
Expand Down
28 changes: 14 additions & 14 deletions apps/settings/js/simcard_dialog.js
Expand Up @@ -19,6 +19,8 @@ var SimPinDialog = {
newPinInput: null,
confirmPinInput: null,

triesLeftMsg: document.getElementById('triesLeft'),

errorMsg: document.getElementById('errorMsg'),
errorMsgHeader: document.getElementById('messageHeader'),
errorMsgBody: document.getElementById('messageBody'),
Expand Down Expand Up @@ -83,6 +85,15 @@ var SimPinDialog = {

handleCardState: function spl_handleCardState() {
var _ = navigator.mozL10n.get;
var retryCount = this.mobileConnection.retryCount;

if (!retryCount) {
this.triesLeftMsg.hidden = true;
} else {
var l10nArgs = { n: triesLeft };
this.triesLeftMsg.textContent = _('inputCodeRetriesLeft', l10nArgs);
this.triesLeftMsg.hidden = false;
}

var cardState = this.mobileConnection.cardState;
switch (cardState) {
Expand All @@ -95,9 +106,7 @@ var SimPinDialog = {
case 'pukRequired':
this.lockType = 'puk';
this.errorMsgHeader.textContent = _('simCardLockedMsg') || '';
this.errorMsgHeader.dataset.l10nId = 'simCardLockedMsg';
this.errorMsgBody.textContent = _('enterPukMsg') || '';
this.errorMsgBody.dataset.l10nId = 'enterPukMsg';
this.errorMsg.hidden = false;
this.inputFieldControl(false, true, true);
this.pukInput.focus();
Expand All @@ -107,7 +116,6 @@ var SimPinDialog = {
break;
}
this.dialogTitle.textContent = _(this.lockType + 'Title') || '';
this.dialogTitle.dataset.l10nId = this.lockType + 'Title';
},

handleError: function spl_handleLockError(evt) {
Expand All @@ -125,17 +133,13 @@ var SimPinDialog = {

showErrorMsg: function spl_showErrorMsg(retry, type) {
var _ = navigator.mozL10n.get;
var l10nArgs = { n: retry };

this.triesLeftMsg.textContent = _('inputCodeRetriesLeft', l10nArgs);
this.errorMsgHeader.textContent = _(type + 'ErrorMsg');
this.errorMsgHeader.dataset.l10nId = type + 'ErrorMsg';

if (retry !== 1) {
var l10nArgs = { n: retry };
this.errorMsgBody.dataset.l10nId = type + 'AttemptMsg2';
this.errorMsgBody.dataset.l10nArgs = JSON.stringify(l10nArgs);
this.errorMsgBody.textContent = _(type + 'AttemptMsg2', l10nArgs);
this.errorMsgBody.textContent = _(type + 'AttemptMsg3', l10nArgs);
} else {
this.errorMsgBody.dataset.l10nId = type + 'LastChanceMsg';
this.errorMsgBody.textContent = _(type + 'LastChanceMsg');
}

Expand Down Expand Up @@ -163,7 +167,6 @@ var SimPinDialog = {

if (newPin !== confirmPin) {
this.errorMsgHeader.textContent = _('newPinErrorMsg');
this.errorMsgHeader.dataset.l10nId = 'newPinErrorMsg';
this.errorMsgBody.textContent = '';
this.errorMsg.hidden = false;
return;
Expand Down Expand Up @@ -205,7 +208,6 @@ var SimPinDialog = {

if (newPin !== confirmPin) {
this.errorMsgHeader.textContent = _('newPinErrorMsg');
this.errorMsgHeader.dataset.l10nId = 'newPinErrorMsg';
this.errorMsgBody.textContent = '';
this.errorMsg.hidden = false;
return;
Expand Down Expand Up @@ -279,12 +281,10 @@ var SimPinDialog = {
case 'enable':
this.inputFieldControl(true, false, false);
this.dialogTitle.textContent = _('pinTitle') || '';
this.dialogTitle.dataset.l10nId = 'pinTitle';
break;
case 'changePin':
this.inputFieldControl(true, false, true);
this.dialogTitle.textContent = _('newpinTitle') || '';
this.dialogTitle.dataset.l10nId = 'newpinTitle';
break;
}

Expand Down
27 changes: 19 additions & 8 deletions apps/settings/locales/settings.en-US.properties
Expand Up @@ -203,7 +203,7 @@ unpair-title = Unpair a connected device?
unpair-msg = You are currently connected to this device. Unpairing will also disconnect from it.

# Connectivity :: Internet Sharing
SSIDCannotBeEmpty=The SSID cannot be empty
SSIDCannotBeEmpty=The SSID cannot be empty
internetSharing=Internet sharing
internetSharing-usb=USB
internetSharing-usb-desc=Share my phone’s Internet connection with a USB-connected device.
Expand Down Expand Up @@ -389,17 +389,28 @@ pinTitle=Enter SIM PIN
pukTitle=Enter PUK code
newpinTitle=New PIN
pinErrorMsg=The PIN was incorrect.
pinAttemptMsg2={[ plural(n) ]}
pinAttemptMsg2[one] = Last chance.
pinAttemptMsg2[two] = {{n}} tries left.
pinAttemptMsg2[few] = {{n}} tries left.
pinAttemptMsg2[many] = {{n}} tries left.
pinAttemptMsg2[other] = {{n}} tries left.
inputCodeRetriesLeft={[ plural(n) ]}
inputCodeRetriesLeft[one]=last try.
inputCodeRetriesLeft[two]={{n}} tries left.
inputCodeRetriesLeft[few]={{n}} tries left.
inputCodeRetriesLeft[many]={{n}} tries left.
inputCodeRetriesLeft[other]={{n}} tries left.
pinAttemptMsg3={[ plural(n) ]}
pinAttemptMsg3[one]=You have one try left to enter the correct code before locking the SIM card.
pinAttemptMsg3[two]=You have {{n}} tries left to enter the correct code before locking the SIM card.
pinAttemptMsg3[few]=You have {{n}} tries left to enter the correct code before locking the SIM card.
pinAttemptMsg3[many]=You have {{n}} tries left to enter the correct code before locking the SIM card.
pinAttemptMsg3[other]=You have {{n}} tries left to enter the correct code before locking the SIM card.
pinLastChanceMsg=This is your last chance to enter the correct PIN. Otherwise, you must enter the PUK code to use this SIM card.
simCardLockedMsg=The SIM card is locked.
enterPukMsg=You must enter the Personal Unlocking Key (PUK) code for the SIM card. Refer to your SIM card documentation or contact your carrier for more information.
pukErrorMsg=The PUK code is incorrect.
pukAttemptMsg2=You have {{n}} tries left to enter the correct code before this SIM card will be permanently unusable. Refer to your SIM card documentation or contact your carrier for more information.
pukAttemptMsg3={[ plural(n) ]}
pukAttemptMsg3[one]=You have one try left to enter the correct code before this SIM card will be permanently unusable. Refer to your SIM card documentation or contact your carrier for more information.
pukAttemptMsg3[two]=You have {{n}} tries left to enter the correct code before this SIM card will be permanently unusable. Refer to your SIM card documentation or contact your carrier for more information.
pukAttemptMsg3[few]=You have {{n}} tries left to enter the correct code before this SIM card will be permanently unusable. Refer to your SIM card documentation or contact your carrier for more information.
pukAttemptMsg3[many]=You have {{n}} tries left to enter the correct code before this SIM card will be permanently unusable. Refer to your SIM card documentation or contact your carrier for more information.
pukAttemptMsg3[other]=You have {{n}} tries left to enter the correct code before this SIM card will be permanently unusable. Refer to your SIM card documentation or contact your carrier for more information.
pukLastChanceMsg=Last chance to enter the correct PUK code. Your SIM card will be permanently unusable if you enter in the wrong PUK code. Refer to your SIM card documentation or contact your carrier for more information.
newSimPinMsg=Create PIN (must contain 4 to 8 digits)
confirmNewSimPinMsg=Confirm new PIN
Expand Down

0 comments on commit 4cd2d49

Please sign in to comment.