Skip to content

Commit

Permalink
Add error message for no secure pin code
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunMinChang committed Jul 25, 2016
1 parent f91486f commit 2e32cff
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
5 changes: 4 additions & 1 deletion bootstrap.js
Expand Up @@ -553,7 +553,10 @@ var RemoteControlManager = (function() {
// Show error message if aReason is:
// pin-expired : PIN code is expired
// wrong-pin : PIN entered is wrong
if (aPairInfo.error == 'pin-expired' || aPairInfo.error == 'wrong-pin') {
// no-pin : No secure random PIN to use
if (aPairInfo.error == 'pin-expired' ||
aPairInfo.error == 'wrong-pin' ||
aPairInfo.error == 'no-pin') {
// If the page is pin code page, then show error message on it.
let window = GetRecentWindow();
let tab = window.BrowserApp.getTabForId(aPairInfo.tabId);
Expand Down
15 changes: 13 additions & 2 deletions content/authSocket.js
Expand Up @@ -178,9 +178,20 @@ var AuthSocket = function() {
}

// Error handling
if (aMsg.error && aMsg.error == 'PIN expire') {
if (aMsg.error) {
_debug('!!!! Error: ' + aMsg.error);
_afterAuthenticatingCallback(false, null, 'pin-expired');

let error;
switch(aMsg.error) {
case 'PIN expire':
error = 'pin-expired';
case 'No secure PIN':
error = 'no-pin';
default:
_afterAuthenticatingCallback(false, null, error);
break;
}

return;
}

Expand Down
8 changes: 7 additions & 1 deletion content/remote-control-client/js/pairing.js
Expand Up @@ -60,6 +60,12 @@
// Let user choose to reconnect or not
chooseReconnect();
break;
case 'no-pin':
type = 'no-pin';
document.l10n.formatValue(type).then(showError);
// Let user choose to reconnect or not
chooseReconnect();
break;
default:
document.l10n.formatValue('connect-error', { status: String(reason) })
.then(showError);
Expand All @@ -71,7 +77,7 @@
var onsuccess = function() {
document.l10n.formatValue('connect-success').then(function(value) {
pinCodeInput.empty();

// Show successful message to users
showMessage(value);
// re-direct url to remote-controller page
Expand Down
Expand Up @@ -15,3 +15,4 @@ connect-success=Connected successfully!
connect-error=ERROR: {{status}}!
connect-error-invalid-response=ERROR: Invalid response!
wrong-pin=Wrong PIN code. Please try again.
no-pin=Can't generate secure PIN. Please try again.

0 comments on commit 2e32cff

Please sign in to comment.