From b93608db49fa40f4e7ad742e4aa285d106caf117 Mon Sep 17 00:00:00 2001
From: Sukanya Pandey <sukapan1@in.ibm.com>
Date: Fri, 10 Jul 2020 18:51:58 +0530
Subject: Add min and max password range in profile settings

 -Api used to get the min and max value is  redfish/v1/AccountService.

Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: I0f211496bef85aefe843052a6b6ba72156d2e4c7
---
 src/views/ProfileSettings/ProfileSettings.vue | 34 ++++++++++++++++-----------
 1 file changed, 20 insertions(+), 14 deletions(-)

(limited to 'src/views/ProfileSettings/ProfileSettings.vue')

diff --git a/src/views/ProfileSettings/ProfileSettings.vue b/src/views/ProfileSettings/ProfileSettings.vue
index df74b4b7..32278b24 100644
--- a/src/views/ProfileSettings/ProfileSettings.vue
+++ b/src/views/ProfileSettings/ProfileSettings.vue
@@ -95,10 +95,7 @@
 </template>
 
 <script>
-import PageTitle from '@/components/Global/PageTitle';
-import PageSection from '@/components/Global/PageSection';
 import BVToastMixin from '@/components/Mixins/BVToastMixin';
-import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js';
 import InputPasswordToggle from '@/components/Global/InputPasswordToggle';
 import {
   maxLength,
@@ -106,23 +103,37 @@ import {
   required,
   sameAs
 } from 'vuelidate/lib/validators';
+import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
+import PageTitle from '@/components/Global/PageTitle';
+import PageSection from '@/components/Global/PageSection';
+import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js';
 
 export default {
   name: 'ProfileSettings',
-  components: { PageTitle, PageSection, InputPasswordToggle },
-  mixins: [BVToastMixin, VuelidateMixin],
+  components: { InputPasswordToggle, PageSection, PageTitle },
+  mixins: [BVToastMixin, LoadingBarMixin, VuelidateMixin],
   data() {
     return {
-      passwordRequirements: {
-        minLength: 8,
-        maxLength: 20
-      },
       form: {
         newPassword: '',
         confirmPassword: ''
       }
     };
   },
+  computed: {
+    username() {
+      return this.$store.getters['global/username'];
+    },
+    passwordRequirements() {
+      return this.$store.getters['localUsers/accountPasswordRequirements'];
+    }
+  },
+  created() {
+    this.startLoader();
+    this.$store
+      .dispatch('localUsers/getAccountSettings')
+      .finally(() => this.endLoader());
+  },
   validations() {
     return {
       form: {
@@ -138,11 +149,6 @@ export default {
       }
     };
   },
-  computed: {
-    username() {
-      return this.$store.getters['global/username'];
-    }
-  },
   methods: {
     submitForm() {
       this.$v.$touch();
-- 
cgit v1.2.3

