Client - update password update in user account

This commit is contained in:
Sam
2022-02-26 21:20:11 +01:00
parent a4d7dc24da
commit 7d78bcc302
19 changed files with 276 additions and 73 deletions

View File

@ -38,14 +38,13 @@
watch,
} from 'vue'
import { ROOT_STORE } from '@/store/constants'
import { AUTH_USER_STORE, ROOT_STORE } from '@/store/constants'
import { useStore } from '@/use/useStore'
import { getPasswordStrength, setZxcvbnOptions } from '@/utils/password'
interface Props {
password: string
}
const props = defineProps<Props>()
const { password } = toRefs(props)
@ -53,6 +52,9 @@
const language: ComputedRef<string> = computed(
() => store.getters[ROOT_STORE.GETTERS.LANGUAGE]
)
const isSuccess: ComputedRef<boolean> = computed(
() => store.getters[AUTH_USER_STORE.GETTERS.IS_SUCCESS]
)
const passwordScore: Ref<number> = ref(0)
const passwordStrength: Ref<string> = ref('')
const passwordSuggestions: Ref<string[]> = ref([])
@ -77,7 +79,11 @@
watch(
() => password.value,
async (newPassword) => {
calculatePasswordStrength(newPassword)
if (isSuccess.value) {
passwordStrength.value = ''
} else {
calculatePasswordStrength(newPassword)
}
}
)
</script>