user kann wieder sein password ändern

This commit is contained in:
Tim Gröger 2020-06-05 01:17:21 +02:00
parent 6caaa205ee
commit 6b27441ac9
1 changed files with 15 additions and 3 deletions

View File

@ -48,7 +48,7 @@
<v-col cols="12" sm="6">
<v-text-field
outlined
label="Password"
label="neues Password"
type="password"
v-model="password"
/>
@ -58,7 +58,7 @@
ref="password"
v-model="controlPassword"
outlined
label="Password bestätigen"
label="neues Password bestätigen"
type="password"
:disabled="!password"
:rules="[equal_password]"
@ -242,6 +242,7 @@
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-text-field outlined label="Passwort" v-model="acceptedPassword" type="password" ref="acceptedPassword" :rules="[empty_password]"></v-text-field>
<v-btn text color="primary" @click="save">Speicherns</v-btn>
</v-card-actions>
<v-expand-transition>
@ -296,6 +297,8 @@ export default {
controlPassword: null,
trashCan: mdiTrashCan,
isFulllineText: false,
acceptedPassword: null,
passError: null,
equal_password: value =>
this.password === value || 'Passwörter sind nicht identisch.',
email: value => {
@ -304,7 +307,11 @@ export default {
return pattern.test(value) || 'keine gültige E-Mail'
}
return true
},
empty_password: () => {
return this.acceptedPassword !== null ? true : 'Password wurde nicht gesetzt'
}
}
},
mounted() {
@ -334,9 +341,14 @@ export default {
if (this.$refs.password.validate()) {
if (this.password) user.password = this.password
}
this.saveConfig({ oldUsername: user.username, ...user })
if (this.$refs.acceptedPassword.validate()) {
this.saveConfig({oldUsername: user.username, ...user, acceptedPassword: this.acceptedPassword})
} else {
this.passError = "Du musst dein Password eingeben"
}
this.password = null
this.controlPassword = null
this.acceptedPassword = ''
},
calcLifefime(time) {
if (time < 60) return String(time) + 'Sekunden'