GUACAMOLE-96: Open "otpauth" link when user clicks on barcode. Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/b9dba7dd Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/b9dba7dd Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/b9dba7dd
Branch: refs/heads/master Commit: b9dba7ddf4eaa9c291035c706bfc6b32408544e8 Parents: 78cde50 Author: Michael Jumper <mjum...@apache.org> Authored: Fri Nov 24 13:54:26 2017 -0800 Committer: Michael Jumper <mjum...@apache.org> Committed: Sun Feb 4 19:45:18 2018 -0800 ---------------------------------------------------------------------- .../controllers/authenticationCodeFieldController.js | 13 +++++++++++-- .../src/main/resources/styles/totp.css | 1 + .../resources/templates/authenticationCodeField.html | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/b9dba7dd/extensions/guacamole-auth-totp/src/main/resources/controllers/authenticationCodeFieldController.js ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-totp/src/main/resources/controllers/authenticationCodeFieldController.js b/extensions/guacamole-auth-totp/src/main/resources/controllers/authenticationCodeFieldController.js index 27881f8..8f19c9f 100644 --- a/extensions/guacamole-auth-totp/src/main/resources/controllers/authenticationCodeFieldController.js +++ b/extensions/guacamole-auth-totp/src/main/resources/controllers/authenticationCodeFieldController.js @@ -21,8 +21,8 @@ * Controller for the "GUAC_TOTP_CODE" field which prompts the user to enter * the code generated by their authentication device. */ -angular.module('guacTOTP').controller('authenticationCodeFieldController', ['$scope', - function authenticationCodeFieldController($scope) { +angular.module('guacTOTP').controller('authenticationCodeFieldController', ['$scope', '$window', + function authenticationCodeFieldController($scope, $window) { /** * The secret key split into groups of at most four characters each, or @@ -56,4 +56,13 @@ angular.module('guacTOTP').controller('authenticationCodeFieldController', ['$sc $scope.detailsShown = false; }; + /** + * Attempts to open the "otpauth" URI containing the user's TOTP key, + * invoking whichever application may be installed locally for handling + * multi-factor authentication. + */ + $scope.openKeyURI = function openKeyURI() { + $window.open($scope.field.keyUri); + }; + }]); http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/b9dba7dd/extensions/guacamole-auth-totp/src/main/resources/styles/totp.css ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-totp/src/main/resources/styles/totp.css b/extensions/guacamole-auth-totp/src/main/resources/styles/totp.css index 6d2d89f..e578e6a 100644 --- a/extensions/guacamole-auth-totp/src/main/resources/styles/totp.css +++ b/extensions/guacamole-auth-totp/src/main/resources/styles/totp.css @@ -29,6 +29,7 @@ margin: 1em; border: 1px solid rgba(0,0,0,0.25); box-shadow: 1px 1px 2px rgba(0,0,0,0.25); + cursor: pointer; } h3.totp-details-header { http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/b9dba7dd/extensions/guacamole-auth-totp/src/main/resources/templates/authenticationCodeField.html ---------------------------------------------------------------------- diff --git a/extensions/guacamole-auth-totp/src/main/resources/templates/authenticationCodeField.html b/extensions/guacamole-auth-totp/src/main/resources/templates/authenticationCodeField.html index 0837b74..c493a20 100644 --- a/extensions/guacamole-auth-totp/src/main/resources/templates/authenticationCodeField.html +++ b/extensions/guacamole-auth-totp/src/main/resources/templates/authenticationCodeField.html @@ -6,7 +6,7 @@ <p translate="TOTP.HELP_ENROLL_BARCODE"></p> <!-- Barcode and key details --> - <div class="totp-qr-code"><img ng-src="{{field.qrCode}}"></div> + <div class="totp-qr-code"><img ng-src="{{field.qrCode}}" ng-click="openKeyURI()"></div> <h3 class="totp-details-header"> {{'TOTP.SECTION_HEADER_DETAILS' | translate}} <a class="totp-show-details" ng-click="showDetails()">{{'TOTP.ACTION_SHOW_DETAILS' | translate}}</a>