From 9c8adc65fadee99e2d50e03a0621a57d9caf3cf0 Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Fri, 6 Mar 2020 19:41:42 +0100 Subject: [PATCH] [fix] Login: file chooser must be opened by controller, not by HTML element itself - Fix issue #886 --- www/js/controllers/login-controllers.js | 12 +++++++++++- www/templates/login/form_file_import.html | 3 +-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/www/js/controllers/login-controllers.js b/www/js/controllers/login-controllers.js index 3f5e21a92..f5f40c7e0 100644 --- a/www/js/controllers/login-controllers.js +++ b/www/js/controllers/login-controllers.js @@ -43,7 +43,7 @@ function LoginController($scope, $timeout, $controller, csWallet) { } -function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils, csCrypto, ionicReady, +function LoginModalController($scope, $timeout, $q, $ionicPopover, $document, CryptoUtils, csCrypto, ionicReady, UIUtils, BMA, Modals, csSettings, Device, parameters) { 'ngInject'; @@ -544,6 +544,16 @@ function LoginModalController($scope, $timeout, $q, $ionicPopover, CryptoUtils, }); }; + /** + * On the file chooser + */ + $scope.openFileChooser = function() { + var elements = angular.element(document.getElementById('loginImportFile')); + if (elements && elements.length) { + elements[0].click(); + } + } + /** * On file drop */ diff --git a/www/templates/login/form_file_import.html b/www/templates/login/form_file_import.html index d4fd655fa..0008161a4 100644 --- a/www/templates/login/form_file_import.html +++ b/www/templates/login/form_file_import.html @@ -8,8 +8,7 @@ </div> <div dropzone="onKeyFileDrop(file)"> - <div ng-if="!formData.file" - onclick="angular.element(document.querySelector('#loginImportFile'))[0].click();"> + <div ng-if="!formData.file" ng-click="openFileChooser()"> <h2 class="gray" translate>COMMON.CHOOSE_FILE</h2> <input type="file" id="loginImportFile" accept=".dunikey,.yml" style="visibility:hidden; position:absolute;" -- GitLab