diff options
author | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2020-02-20 19:00:45 +0300 |
---|---|---|
committer | Derick Montague <derick.montague@ibm.com> | 2020-02-25 01:52:23 +0300 |
commit | 52b0223005c91dc95f82ef0752ea2f3ae50788e6 (patch) | |
tree | 75a3bbc88269645e3f018f8c24a724bfb024164b /src/store | |
parent | 9d40e308fb33d5cef91deb8d78451ab021614898 (diff) | |
download | webui-vue-52b0223005c91dc95f82ef0752ea2f3ae50788e6.tar.xz |
Add password requirements to local user page
- Make api call to get user account settings
- Update add/edit user form to include dynamic password
requirement values
- Fix edit username bug by adding input listener to field
that sets form control to $dirty state and adds
property to PATCH request
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I3535f4214ee12c95d5e502134bf3e36597d2421a
Diffstat (limited to 'src/store')
-rw-r--r-- | src/store/modules/AccessControl/LocalUserMangementStore.js | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/store/modules/AccessControl/LocalUserMangementStore.js b/src/store/modules/AccessControl/LocalUserMangementStore.js index eb5822e1..67c3a1e4 100644 --- a/src/store/modules/AccessControl/LocalUserMangementStore.js +++ b/src/store/modules/AccessControl/LocalUserMangementStore.js @@ -19,16 +19,44 @@ const getResponseCount = responses => { const LocalUserManagementStore = { namespaced: true, state: { - allUsers: [] + allUsers: [], + accountLockoutDuration: null, + accountLockoutThreshold: null, + accountMinPasswordLength: null, + accountMaxPasswordLength: null }, getters: { allUsers(state) { return state.allUsers; + }, + accountSettings(state) { + return { + lockoutDuration: state.accountLockoutDuration, + lockoutThreshold: state.accountLockoutThreshold + }; + }, + accountPasswordRequirements(state) { + return { + minLength: state.accountMinPasswordLength, + maxLength: state.accountMaxPasswordLength + }; } }, mutations: { setUsers(state, allUsers) { state.allUsers = allUsers; + }, + setLockoutDuration(state, lockoutDuration) { + state.accountLockoutDuration = lockoutDuration; + }, + setLockoutThreshold(state, lockoutThreshold) { + state.accountLockoutThreshold = lockoutThreshold; + }, + setAccountMinPasswordLength(state, minPasswordLength) { + state.accountMinPasswordLength = minPasswordLength; + }, + setAccountMaxPasswordLength(state, maxPasswordLength) { + state.accountMaxPasswordLength = maxPasswordLength; } }, actions: { @@ -46,6 +74,20 @@ const LocalUserManagementStore = { throw new Error('Error loading local users.'); }); }, + getAccountSettings({ commit }) { + api + .get('/redfish/v1/AccountService') + .then(({ data }) => { + commit('setLockoutDuration', data.AccountLockoutDuration); + commit('setLockoutThreshold', data.AccountLockoutThreshold); + commit('setAccountMinPasswordLength', data.MinPasswordLength); + commit('setAccountMaxPasswordLength', data.MaxPasswordLength); + }) + .catch(error => { + console.log(error); + throw new Error('Error loading account settings.'); + }); + }, async createUser({ dispatch }, { username, password, privilege, status }) { const data = { UserName: username, |