bug 964: Show an explicit error message for non-connected crypto devices
authorMichael Tänzer <neo@nhng.de>
Tue, 7 Aug 2012 22:16:42 +0000 (00:16 +0200)
committerMichael Tänzer <neo@nhng.de>
Tue, 7 Aug 2012 22:30:33 +0000 (00:30 +0200)
Signed-off-by: Michael Tänzer <neo@nhng.de>
includes/keygen.php
www/keygenIE.js

index b489640..bf8bc5a 100644 (file)
@@ -100,6 +100,10 @@ if (array_key_exists('HTTP_USER_AGENT',$_SERVER) &&
                <?=_('Could not generate certificate request. Please confirm the '.
                                'dialogue if you are asked if you want to generate the key.')?>
        </p>
+       <p id="createRequestErrorConnectDevice" style="display:none">
+               <?=_('Could not generate certificate request. Please make sure the '.
+                               'cryptography device (e.g. the smartcard) is connected.')?>
+       </p>
        <p id="createRequestError" style="display:none">
                <?=_('Could not generate certificate request.')?>
        </p>
index c311b85..5e2b8c0 100644 (file)
@@ -84,6 +84,7 @@ var CAcert_keygen_IE = function () {
        var generatingKeyNotice = document.getElementById("generatingKeyNotice");
        var createRequestErrorChooseAlgorithm = document.getElementById("createRequestErrorChooseAlgorithm");
        var createRequestErrorConfirmDialogue = document.getElementById("createRequestErrorConfirmDialogue");
+       var createRequestErrorConnectDevice = document.getElementById("createRequestErrorConnectDevice"));
        var createRequestError = document.getElementById("createRequestError");
        var invalidKeySizeError = document.getElementById("invalidKeySizeError");
        var unsupportedPlatformError = document.getElementById("unsupportedPlatformError");
@@ -593,7 +594,11 @@ var CAcert_keygen_IE = function () {
                                        form.submit();
                                } catch (e) {
                                        if (e.number === -2147023673) {
+                                               // 0x800704c7 => dialogue declined
                                                showError(createRequestErrorConfirmDialogue.innerHTML, e);
+                                       } else if (e.number === -2146435043) {
+                                               // 0x8010001d => crypto-device not connected
+                                               showError(createRequestErrorConnectDevice.innerHTML, e);
                                        } else {
                                                showError(createRequestError.innerHTML, e);
                                        }