summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAppaRao Puli <apparao.puli@linux.intel.com>2019-03-12 14:56:40 +0530
committerGunnar Mills <gmills@us.ibm.com>2019-03-27 18:47:41 +0000
commitb1e7c86360f3f9bb05264a3cdbc5a587aa8f1175 (patch)
treef1c80198d474c9a631fa062f956e0a4398a9ee77
parentb5c5dc5d6c7d35738949f8576228076642590864 (diff)
downloadphosphor-webui-b1e7c86360f3f9bb05264a3cdbc5a587aa8f1175.tar.gz
phosphor-webui-b1e7c86360f3f9bb05264a3cdbc5a587aa8f1175.zip
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>
-rw-r--r--app/common/services/api-utils.js33
-rw-r--r--app/users/controllers/user-accounts-controller.html37
-rw-r--r--app/users/controllers/user-accounts-controller.js56
-rw-r--r--app/users/styles/user-accounts.scss21
4 files changed, 141 insertions, 6 deletions
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 743d3fa..9711ba6 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -685,6 +685,39 @@ window.angular && (function(angular) {
}
return deferred.promise;
},
+
+ getAllUserAccountProperties: function(callback) {
+ return $http({
+ method: 'GET',
+ url: DataService.getHost() + '/redfish/v1/AccountService',
+ withCredentials: true
+ })
+ .then(
+ function(response) {
+ return response.data;
+ },
+ function(error) {
+ console.log(error);
+ });
+ },
+
+ saveUserAccountProperties: function(lockoutduration, lockoutthreshold) {
+ var data = {};
+ if (lockoutduration != undefined) {
+ data['AccountLockoutDuration'] = lockoutduration;
+ }
+ if (lockoutthreshold != undefined) {
+ data['AccountLockoutThreshold'] = lockoutthreshold;
+ }
+
+ return $http({
+ method: 'PATCH',
+ url: DataService.getHost() + '/redfish/v1/AccountService',
+ withCredentials: true,
+ data: data
+ });
+ },
+
createUser: function(user, passwd, role, enabled) {
if (DataService.configJson.redfishSupportEnabled == true) {
var data = {};
diff --git a/app/users/controllers/user-accounts-controller.html b/app/users/controllers/user-accounts-controller.html
index 9c80da6..b48626d 100644
--- a/app/users/controllers/user-accounts-controller.html
+++ b/app/users/controllers/user-accounts-controller.html
@@ -1,5 +1,42 @@
<loader loading="loading"></loader>
<div id="user-accounts">
+
+ <div class="row column acnt-prop-header">
+ <h1>User account properties</h1>
+ </div>
+
+ <div class="col-sm-12">
+ <form class="row column user-manage__form">
+ <div class="col-sm-12">
+ <label class="col-md-1 control-label" for="lockoutTime"> User Lockout Time (sec) </label>
+ <div class="col-md-3 acnt-prop__input-wrapper">
+ <input type="number" id="lockoutTime" min="30" max="600" ng-model="properties.AccountLockoutDuration"/>
+ </div>
+ </div>
+ <div class="col-sm-12">
+ <label class="col-md-1 control-label" for="lockoutThreshold"> Failed Login Attempts </label>
+ <div class="col-md-3 acnt-prop__input-wrapper">
+ <input type="number" id="lockoutThreshold" min="3" max="10" ng-model="properties.AccountLockoutThreshold"/>
+ </div>
+ </div>
+ <div class= "col-sm-12">
+ <label class="col-md-1 control-label"> Max Password Length </label>
+ <div class="col-md-3 acnt-prop__span-wrapper">
+ <span>{{properties.MaxPasswordLength}}</span>
+ </div>
+ </div>
+ <div class="col-sm-12">
+ <label class="col-md-1 control-label"> Min Password Length </label>
+ <div class="col-md-3 acnt-prop__span-wrapper">
+ <span>{{properties.MinPasswordLength}}</span>
+ </div>
+ </div>
+ <div class="acnt-prop__submit-wrapper">
+ <button type="button" class="btn-primary inline" ng-click="saveAllValues()">Save settings</button>
+ </div>
+ </form>
+ </div>
+
<div class="row column">
<h1>User account information</h1>
</div>
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 @@ window.angular && (function(angular) {
$scope.state = 'none';
$scope.outMsg = '';
$scope.loading = true;
+ $scope.properties = {};
+ $scope.origProp = {};
function loadUserInfo() {
$scope.loading = true;
@@ -33,6 +35,16 @@ window.angular && (function(angular) {
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 @@ window.angular && (function(angular) {
$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 = '';
diff --git a/app/users/styles/user-accounts.scss b/app/users/styles/user-accounts.scss
index 3093546..858d1aa 100644
--- a/app/users/styles/user-accounts.scss
+++ b/app/users/styles/user-accounts.scss
@@ -19,6 +19,11 @@ $userInputHeight: 40px;
}
}
}
+.acnt-prop-header {
+ width: 100%;
+ border-bottom: 2px solid #b8c1c1;
+ margin: 0px 0px 15px;
+}
.user-manage__form {
width: 100%;
.dropdown__button {
@@ -44,13 +49,16 @@ $userInputHeight: 40px;
margin-bottom: 1em;
border-bottom: 1px solid $medgrey;
}
+ .acnt-prop__input-wrapper,
.user-manage__input-wrapper {
position: relative;
height: $userInputHeight;
- margin-bottom: 1em;
- input {
- padding-right: 60px;
- }
+ margin-bottom: 5px;
+ }
+ .acnt-prop__span-wrapper {
+ position: relative;
+ height: 20px;
+ margin-bottom: 5px;
}
.password-toggle {
position: absolute;
@@ -61,10 +69,11 @@ $userInputHeight: 40px;
font-size: .8em;
@include vertCenter;
}
+ .acnt-prop__submit-wrapper,
.user-manage__submit-wrapper {
width: 100%;
- margin-top: 3em;
- padding-top: 1em;
+ margin-top: 6px;
+ padding-top: 1px;
border-top: 1px solid $medgrey;
button {
float: right;
OpenPOWER on IntegriCloud