Show password rules for new user
This commit is contained in:
@@ -29,6 +29,15 @@
|
||||
<v-flex xs12 pa-1>
|
||||
<v-text-field label="Display Name" v-model="displayName"></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs12 pa-1 v-if="!isEditMode">
|
||||
<v-text-field
|
||||
label="Password*"
|
||||
type="password"
|
||||
hint="Minimal 8 karakter, kombinasi huruf dan angka"
|
||||
persistent-hint
|
||||
v-model="password"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs12 pa-1>
|
||||
<v-autocomplete
|
||||
@@ -130,11 +139,21 @@ module.exports = {
|
||||
alert('Password wajib diisi')
|
||||
return false
|
||||
}
|
||||
if (requirePassword) {
|
||||
let pwd = this.password || ''
|
||||
if (pwd.length < 8) {
|
||||
alert('Password minimal 8 karakter')
|
||||
return false
|
||||
}
|
||||
if (!(/[A-Za-z]/.test(pwd) && /[0-9]/.test(pwd))) {
|
||||
alert('Password harus kombinasi huruf dan angka')
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
},
|
||||
async saveUser() {
|
||||
this.password = window.prompt('Masukkan password untuk user ini') || ''
|
||||
if (!this.validateBasic(true)) return
|
||||
if (!this.validateBasic(!this.isEditMode)) return
|
||||
let resp = await this.$store.dispatch('dashboard_user/save', {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
|
||||
Reference in New Issue
Block a user