diff --git a/Duplicati/Server/webroot/ngax/scripts/controllers/SystemSettingsController.js b/Duplicati/Server/webroot/ngax/scripts/controllers/SystemSettingsController.js index 7c34ef6ac..f1a5b2fa5 100644 --- a/Duplicati/Server/webroot/ngax/scripts/controllers/SystemSettingsController.js +++ b/Duplicati/Server/webroot/ngax/scripts/controllers/SystemSettingsController.js @@ -1,4 +1,4 @@ -backupApp.controller('SystemSettingsController', function($rootScope, $scope, $location, $cookies, AppService, AppUtils, SystemInfo, gettextCatalog) { +backupApp.controller('SystemSettingsController', function($rootScope, $scope, $location, $cookies, AppService, DialogService, AppUtils, SystemInfo, gettextCatalog) { $scope.SystemInfo = SystemInfo.watch($scope); $scope.theme = $scope.$parent.$parent.saved_theme; @@ -53,6 +53,7 @@ backupApp.controller('SystemSettingsController', function($rootScope, $scope, $l $scope.requireRemotePassword = data.data['server-passphrase'] != null && data.data['server-passphrase'] != ''; $scope.remotePassword = data.data['server-passphrase']; + $scope.confirmPassword = ''; $scope.allowRemoteAccess = data.data['server-listen-interface'] != 'loopback'; $scope.startupDelayDurationValue = data.data['startup-delay'].substr(0, data.data['startup-delay'].length - 1) == "" ? "0" : data.data['startup-delay'].substr(0, data.data['startup-delay'].length - 1); $scope.startupDelayDurationMultiplier = data.data['startup-delay'].substr(-1) == "" ? "s" : data.data['startup-delay'].substr(-1); @@ -84,12 +85,14 @@ backupApp.controller('SystemSettingsController', function($rootScope, $scope, $l 'disable-tray-icon-login': $scope.disableTrayIconLogin }; - if ($scope.requireRemotePassword) { - if ($scope.rawdata['server-passphrase'] != $scope.remotePassword) { - patchdata['server-passphrase-salt'] = CryptoJS.lib.WordArray.random(256/8).toString(CryptoJS.enc.Base64); - patchdata['server-passphrase'] = CryptoJS.SHA256(CryptoJS.enc.Hex.parse(CryptoJS.enc.Utf8.parse($scope.remotePassword) + CryptoJS.enc.Base64.parse(patchdata['server-passphrase-salt']))).toString(CryptoJS.enc.Base64); + if ($scope.requireRemotePassword && $scope.rawdata['server-passphrase'] != $scope.remotePassword) { + if ($scope.remotePassword != $scope.confirmPassword) { + AppUtils.notifyInputError(gettextCatalog.getString('The passwords do not match')); + return; } - } else { + patchdata['server-passphrase-salt'] = CryptoJS.lib.WordArray.random(256/8).toString(CryptoJS.enc.Base64); + patchdata['server-passphrase'] = CryptoJS.SHA256(CryptoJS.enc.Hex.parse(CryptoJS.enc.Utf8.parse($scope.remotePassword) + CryptoJS.enc.Base64.parse(patchdata['server-passphrase-salt']))).toString(CryptoJS.enc.Base64); + } else if (!$scope.requireRemotePassword) { patchdata['server-passphrase-salt'] = null; patchdata['server-passphrase'] = null; } diff --git a/Duplicati/Server/webroot/ngax/templates/settings.html b/Duplicati/Server/webroot/ngax/templates/settings.html index 335abeda5..7c6062464 100644 --- a/Duplicati/Server/webroot/ngax/templates/settings.html +++ b/Duplicati/Server/webroot/ngax/templates/settings.html @@ -5,9 +5,13 @@

Access to user interface

- +
+
+
+ +