fixed bug ##293

es wird nun validiert, dass die neuen passwörter übereinstimmen und dass das alte password eingetragen wurde.
This commit is contained in:
Tim Gröger 2020-06-21 12:26:56 +02:00
parent c78ef99a0d
commit c80d345c63
2 changed files with 48 additions and 32 deletions

View File

@ -54,15 +54,17 @@
/>
</v-col>
<v-col cols="12" sm="6">
<v-text-field
ref="password"
v-model="controlPassword"
outlined
label="neues Password bestätigen"
type="password"
:disabled="!password"
:rules="[equal_password]"
/>
<v-form ref="newPassword">
<v-text-field
ref="password"
v-model="controlPassword"
outlined
label="neues Password bestätigen"
type="password"
:disabled="!password"
:rules="[equal_password]"
/>
</v-form>
</v-col>
</v-row>
<v-divider />
@ -267,19 +269,27 @@
</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-form ref="acceptedPasswordTest">
<v-text-field
outlined
label="Passwort"
v-model="acceptedPassword"
type="password"
ref="acceptedPassword"
:rules="[empty_password]"
></v-text-field>
</v-form>
<v-btn text color="primary" @click="save">Speichern</v-btn>
</v-card-actions>
<v-expand-transition>
<v-alert type="error" v-if="error">{{ error }}</v-alert>
</v-expand-transition>
<v-snackbar
v-if="error ? error.value : false"
:color="error ? (error.error ? 'error' : 'success') : ''"
:value="error"
v-model="error"
:timeout="0"
>
{{ error ? error.value : null }}
</v-snackbar>
</v-card>
</div>
</template>
@ -342,10 +352,8 @@ export default {
}
return true
},
empty_password: () => {
return this.acceptedPassword !== null
? true
: 'Password wurde nicht gesetzt'
empty_password: data => {
return !!data || 'Password wird bentögigt'
}
}
},
@ -373,21 +381,24 @@ export default {
if (this.$refs.mail.validate()) {
if (this.mail) user.mail = this.mail
}
if (this.$refs.password.validate()) {
if (this.$refs.newPassword.validate()) {
if (this.password) user.password = this.password
} else {
return
}
if (this.$refs.acceptedPassword.validate()) {
console.log(this.$refs.acceptedPasswordTest.validate())
if (this.$refs.acceptedPasswordTest.validate()) {
this.saveConfig({
oldUsername: user.username,
...user,
acceptedPassword: this.acceptedPassword
})
this.$refs.acceptedPassword.reset()
} 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'

View File

@ -6,7 +6,7 @@ const state = {
creditList: [],
loading: false,
addLoading: false,
error: '',
error: null,
days: [],
messages: [],
status: [],
@ -134,8 +134,12 @@ const mutations = {
setAddLoading(state, value) {
state.addLoading = value
},
setError(state, value) {
state.error = value
setError(state, {value, error}) {
//clearTimeout(state.error? state.error.timeout : null)
state.error = {value, error}
state.error.timeout = setTimeout(() => {
state.error = null
}, 6000)
},
createDays(state, date) {
let days = []
@ -257,14 +261,15 @@ const actions = {
{ ...data },
{ headers: { Token: rootState.login.user.accessToken } }
)
console.log(response.data)
commit('setUser', response.data)
commit('setError', '')
commit('setError', {value: 'Daten gespeichert', error: false})
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response) {
if (e.response.status === 401) dispatch('logout', null, { root: true })
if (e.response.data) {
commit('setError', e.response.data.error)
commit('setError', { value: e.response.data.error, error: true})
}
}
}