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
diff --git a/src/store/modules/AccessControl/LocalUserMangementStore.js b/src/store/modules/AccessControl/LocalUserMangementStore.js
index eb5822e..67c3a1e 100644
--- a/src/store/modules/AccessControl/LocalUserMangementStore.js
+++ b/src/store/modules/AccessControl/LocalUserMangementStore.js
@@ -19,16 +19,44 @@
 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 @@
           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,