diff --git a/src/main/resources/public/index.html b/src/main/resources/public/index.html index e741a1a..6150ab9 100644 --- a/src/main/resources/public/index.html +++ b/src/main/resources/public/index.html @@ -81,7 +81,7 @@ - + \ No newline at end of file diff --git a/src/main/resources/public/scripts/app.js b/src/main/resources/public/scripts/app.js index 0dde9f5..623457a 100644 --- a/src/main/resources/public/scripts/app.js +++ b/src/main/resources/public/scripts/app.js @@ -79,7 +79,7 @@ String.prototype.replaceAll = function (search, replace) }; -app.service ('bridgeService', function ($http, $window, ngToast) { +app.service ('bridgeService', function ($http, $window, ngToast, zxcvbn) { var self = this; this.state = {base: "./api/devices", bridgelocation: ".", systemsbase: "./system", huebase: "./api", configs: [], backups: [], devices: [], device: {}, mapandid: [], type: "", settings: [], myToastMsg: [], logMsgs: [], loggerInfo: [], mapTypes: [], olddevicename: "", logShowAll: false, @@ -227,6 +227,11 @@ app.service ('bridgeService', function ($http, $window, ngToast) { ); }; + this.score = function() { + var compute = zxcvbn.apply(null, arguments); + return compute && compute.score; + } + this.aContainsB = function (a, b) { return a.indexOf(b) >= 0; } @@ -1189,7 +1194,7 @@ app.controller('SecurityDialogCtrl', function ($scope, bridgeService, ngDialog) $scope.setSecurityInfo = function () { ngDialog.close('ngdialog1'); - bridgeService.changeSecuritySettings($scope.useLinkButton, $scope.secureHueApi, $scope.execGarden, $scope.aPassword, $scope.aPassword2); + bridgeService.changeSecuritySettings($scope.useLinkButton, $scope.secureHueApi, $scope.execGarden, $scope.password, $scope.password2); }; }); @@ -3015,7 +3020,7 @@ app.filter('passwordCount', [function() { }; }]); -app.directive('okPassword', ['zxcvbn', function(zxcvbn) { +app.directive('okPassword', ['bridgeService', function(bridgeService) { return { // restrict to only attribute and class restrict: 'AC', @@ -3031,7 +3036,7 @@ app.directive('okPassword', ['zxcvbn', function(zxcvbn) { var pwd = $scope.password = $element.val(); // resolve password strength score using zxcvbn service - $scope.passwordStrength = pwd ? (pwd.length > 7 && zxcvbn.score(pwd) || 0) : null; + $scope.passwordStrength = pwd ? (pwd.length > 7 && bridgeService.score(pwd) || 0) : null; // define the validity criterion for okPassword constraint ngModelCtrl.$setValidity('okPassword', $scope.passwordStrength >= 2); @@ -3042,14 +3047,6 @@ app.directive('okPassword', ['zxcvbn', function(zxcvbn) { }]); app.controller('FormController', function($scope) {}); - app.factory('zxcvbn', [function() { - return { - score: function() { - var compute = zxcvbn.apply(null, arguments); - return compute && compute.score; - } - }; - }]); app.directive('pwCheck', [function () { return { diff --git a/src/main/resources/public/views/system.html b/src/main/resources/public/views/system.html index 486b45e..d53cb6c 100644 --- a/src/main/resources/public/views/system.html +++ b/src/main/resources/public/views/system.html @@ -541,7 +541,7 @@
If you are exposing this to the internet, you use a sufficiently strong password. Password must be more than 7 characters.
- +
{{ password | passwordCount:7 }}
@@ -551,7 +551,7 @@
- +
Passwords don't match.