diff --git a/test/vuex/dashboard-user-mcu/components/oneDashboardUserMcuDetail.vue b/test/vuex/dashboard-user-mcu/components/oneDashboardUserMcuDetail.vue
index 67be339..a63662a 100644
--- a/test/vuex/dashboard-user-mcu/components/oneDashboardUserMcuDetail.vue
+++ b/test/vuex/dashboard-user-mcu/components/oneDashboardUserMcuDetail.vue
@@ -35,8 +35,19 @@
type="password"
hint="Minimal 8 karakter, wajib huruf besar, huruf kecil, angka, dan simbol"
persistent-hint
+ :success="passwordReady"
+ :error="passwordTouched && !passwordReady"
+ :error-messages="passwordTouched && !passwordReady ? ['Password belum memenuhi aturan'] : []"
+ @blur="passwordTouched = true"
v-model="password"
>
+
+ • Minimal 8 karakter
+ • Ada huruf besar (A-Z)
+ • Ada huruf kecil (a-z)
+ • Ada angka (0-9)
+ • Ada simbol
+
@@ -79,6 +90,7 @@ module.exports = {
username: '',
displayName: '',
password: '',
+ passwordTouched: false,
selectedProject: null,
projectKeyword: '',
pendingProjects: []
@@ -90,6 +102,23 @@ module.exports = {
assignedProjects() { return this.isEditMode ? (this.selectedUser.projects || []) : this.pendingProjects },
dialogsuccess() { return this.$store.state.dashboard_user.dialog_success },
msgsuccess() { return this.$store.state.dashboard_user.msg_success },
+ passwordChecks() {
+ let pwd = this.password || ''
+ return {
+ length: pwd.length >= 8,
+ upper: /[A-Z]/.test(pwd),
+ lower: /[a-z]/.test(pwd),
+ number: /[0-9]/.test(pwd),
+ symbol: /[^A-Za-z0-9]/.test(pwd)
+ }
+ },
+ passwordReady() {
+ return this.passwordChecks.length
+ && this.passwordChecks.upper
+ && this.passwordChecks.lower
+ && this.passwordChecks.number
+ && this.passwordChecks.symbol
+ },
projectItems() {
return (this.$store.state.dashboard_user.project_options || []).map(p => {
return Object.assign({}, p, { label: p.project_number + ' - ' + p.project_name })
@@ -104,6 +133,7 @@ module.exports = {
this.username = val.User_Username || ''
this.displayName = val.User_DisplayName || ''
this.password = ''
+ this.passwordTouched = false
if (val && val.User_ID) this.pendingProjects = []
}
},
@@ -140,6 +170,7 @@ module.exports = {
return false
}
if (requirePassword) {
+ this.passwordTouched = true
let pwd = this.password || ''
if (pwd.length < 8) {
alert('Password minimal 8 karakter')
@@ -170,6 +201,7 @@ module.exports = {
}
this.pendingProjects = []
}
+ this.passwordTouched = false
this.$store.commit('dashboard_user/update_selected_user', {})
this.refreshList()
} else {
@@ -258,6 +290,7 @@ module.exports = {
this.username = ''
this.displayName = ''
this.password = ''
+ this.passwordTouched = false
this.selectedProject = null
this.projectKeyword = ''
this.pendingProjects = []