WebUI: Support for configure failed login attempts
This commit adds the support for failed login attempts
configuration. With this user can configure the number of
failed login attempts and account lockout duration.
This also adds provision to view other user account
properties like MaxPassword, MinPassword etc.
Tested By:
Loaded the Webui and modified values like
Failed login Attempts and Account lockout duration.
Also tested other account properties view.
Change-Id: I6abd5a16771956640ba6b6d81c1c7ad9503067b1
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
diff --git a/app/users/controllers/user-accounts-controller.js b/app/users/controllers/user-accounts-controller.js
index b76d812..e12db00 100644
--- a/app/users/controllers/user-accounts-controller.js
+++ b/app/users/controllers/user-accounts-controller.js
@@ -17,6 +17,8 @@
$scope.state = 'none';
$scope.outMsg = '';
$scope.loading = true;
+ $scope.properties = {};
+ $scope.origProp = {};
function loadUserInfo() {
$scope.loading = true;
@@ -33,6 +35,16 @@
function(error) {
console.log(JSON.stringify(error));
}),
+
+ APIUtils.getAllUserAccountProperties().then(
+ function(res) {
+ $scope.properties = res;
+ $scope.origProp = angular.copy($scope.properties);
+ },
+ function(error) {
+ console.log(JSON.stringify(error));
+ }),
+
APIUtils.getAccountServiceRoles().then(
function(res) {
$scope.roles = res;
@@ -50,6 +62,50 @@
$scope.outMsg = '';
loadUserInfo();
};
+
+ $scope.saveAllValues = function() {
+ $scope.state = 'none';
+ $scope.outMsg = '';
+ $scope.loading = true;
+ var data = {};
+ if ($scope.properties.AccountLockoutDuration !=
+ $scope.origProp.AccountLockoutDuration) {
+ data['AccountLockoutDuration'] =
+ $scope.properties.AccountLockoutDuration;
+ }
+ if ($scope.properties.AccountLockoutThreshold !=
+ $scope.origProp.AccountLockoutThreshold) {
+ data['AccountLockoutThreshold'] =
+ $scope.properties.AccountLockoutThreshold;
+ }
+
+ if ($scope.properties.AccountLockoutDuration ==
+ $scope.origProp.AccountLockoutDuration &&
+ $scope.properties.AccountLockoutThreshold ==
+ $scope.origProp.AccountLockoutThreshold) {
+ // No change in properties, just return;
+ $scope.loading = false;
+ return;
+ }
+
+ APIUtils
+ .saveUserAccountProperties(
+ data['AccountLockoutDuration'], data['AccountLockoutThreshold'])
+ .then(
+ function(response) {
+ $scope.state = 'success';
+ $scope.outMsg =
+ 'User account properties has been updated successfully';
+ },
+ function(error) {
+ $scope.outMsg = 'Account Properties Updation failed.';
+ })
+ .finally(function() {
+ loadUserInfo();
+ $scope.loading = false;
+ });
+ };
+
$scope.setSelectedUser = function(user) {
$scope.state = 'none';
$scope.outMsg = '';