Bug 1142730 - Show client cert in WebIDE auth dialog. r=past
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 12 Mar 2015 17:37:17 -0500
changeset 233606 eb0a4ef7d8b9
parent 233605 e939387694c1
child 233607 697c416f8dc6
push id28419
push userryanvm@gmail.com
push date2015-03-13 20:10 +0000
treeherdermozilla-central@38154607d807 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs1142730
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1142730 - Show client cert in WebIDE auth dialog. r=past
browser/devtools/webide/content/wifi-auth.js
browser/devtools/webide/content/wifi-auth.xhtml
browser/locales/en-US/chrome/browser/devtools/webide.properties
--- a/browser/devtools/webide/content/wifi-auth.js
+++ b/browser/devtools/webide/content/wifi-auth.js
@@ -4,16 +4,18 @@
 
 "use strict";
 
 const Cu = Components.utils;
 const { Services } = Cu.import("resource://gre/modules/Services.jsm");
 const { require } =
   Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
 const QR = require("devtools/toolkit/qrcode/index");
+const PROPERTIES = "chrome://browser/locale/devtools/webide.properties";
+const Strings = Services.strings.createBundle(PROPERTIES);
 
 window.addEventListener("load", function onLoad() {
   window.removeEventListener("load", onLoad);
   document.getElementById("close").onclick = () => window.close();
   document.getElementById("no-scanner").onclick = showToken;
   document.getElementById("yes-scanner").onclick = hideToken;
   buildUI();
 });
@@ -26,16 +28,20 @@ function buildUI() {
 
 function createQR(oob) {
   let oobData = JSON.stringify(oob);
   let imgData = QR.encodeToDataURI(oobData, "L" /* low quality */);
   document.querySelector("#qr-code img").src = imgData.src;
 }
 
 function createToken(oob) {
+  let spacedCert = oob.sha256.replace(/:/g, " ").toLowerCase();
+  let certText = Strings.formatStringFromName("wifi_auth_cert",
+                                              [spacedCert], 1);
+  document.querySelector("#cert").textContent = certText;
   let token = oob.sha256.replace(/:/g, "").toLowerCase() + oob.k;
   document.querySelector("#token pre").textContent = token;
 }
 
 function showToken() {
   document.querySelector("body").setAttribute("token", "true");
 }
 
--- a/browser/devtools/webide/content/wifi-auth.xhtml
+++ b/browser/devtools/webide/content/wifi-auth.xhtml
@@ -19,16 +19,17 @@
   <body>
 
     <div id="controls">
       <a id="close">&deck_close;</a>
     </div>
 
     <h3 id="header">&wifi_auth_header;</h3>
     <div id="scan-request">&wifi_auth_scan_request;</div>
+    <div id="cert"></div>
 
     <div id="qr-code">
       <div id="qr-code-wrapper">
         <img/>
       </div>
       <a id="no-scanner" class="toggle-scanner">&wifi_auth_no_scanner;</a>
     </div>
 
--- a/browser/locales/en-US/chrome/browser/devtools/webide.properties
+++ b/browser/locales/en-US/chrome/browser/devtools/webide.properties
@@ -72,8 +72,14 @@ runtimedetails_notUSBDevice=Not a USB de
 status_tooltip=Validation status: %1$S
 status_valid=VALID
 status_warning=WARNINGS
 status_error=ERRORS
 status_unknown=UNKNOWN
 
 # Device preferences and settings
 device_reset_default=Reset to default
+
+# WiFi Auth
+# LOCALIZATION NOTE (wifi_auth_cert): Part of the dialog that instructs the
+# user to transfer an authentication token to the server.
+# %1$S: The client's cert fingerprint
+wifi_auth_cert=My Cert: %1$S