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