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:
parent
c78ef99a0d
commit
c80d345c63
|
@ -54,15 +54,17 @@
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="12" sm="6">
|
<v-col cols="12" sm="6">
|
||||||
<v-text-field
|
<v-form ref="newPassword">
|
||||||
ref="password"
|
<v-text-field
|
||||||
v-model="controlPassword"
|
ref="password"
|
||||||
outlined
|
v-model="controlPassword"
|
||||||
label="neues Password bestätigen"
|
outlined
|
||||||
type="password"
|
label="neues Password bestätigen"
|
||||||
:disabled="!password"
|
type="password"
|
||||||
:rules="[equal_password]"
|
:disabled="!password"
|
||||||
/>
|
:rules="[equal_password]"
|
||||||
|
/>
|
||||||
|
</v-form>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-divider />
|
<v-divider />
|
||||||
|
@ -267,19 +269,27 @@
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<v-text-field
|
<v-form ref="acceptedPasswordTest">
|
||||||
outlined
|
<v-text-field
|
||||||
label="Passwort"
|
outlined
|
||||||
v-model="acceptedPassword"
|
label="Passwort"
|
||||||
type="password"
|
v-model="acceptedPassword"
|
||||||
ref="acceptedPassword"
|
type="password"
|
||||||
:rules="[empty_password]"
|
ref="acceptedPassword"
|
||||||
></v-text-field>
|
:rules="[empty_password]"
|
||||||
|
></v-text-field>
|
||||||
|
</v-form>
|
||||||
<v-btn text color="primary" @click="save">Speichern</v-btn>
|
<v-btn text color="primary" @click="save">Speichern</v-btn>
|
||||||
</v-card-actions>
|
</v-card-actions>
|
||||||
<v-expand-transition>
|
<v-snackbar
|
||||||
<v-alert type="error" v-if="error">{{ error }}</v-alert>
|
v-if="error ? error.value : false"
|
||||||
</v-expand-transition>
|
:color="error ? (error.error ? 'error' : 'success') : ''"
|
||||||
|
:value="error"
|
||||||
|
v-model="error"
|
||||||
|
:timeout="0"
|
||||||
|
>
|
||||||
|
{{ error ? error.value : null }}
|
||||||
|
</v-snackbar>
|
||||||
</v-card>
|
</v-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -342,10 +352,8 @@ export default {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
empty_password: () => {
|
empty_password: data => {
|
||||||
return this.acceptedPassword !== null
|
return !!data || 'Password wird bentögigt'
|
||||||
? true
|
|
||||||
: 'Password wurde nicht gesetzt'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -373,21 +381,24 @@ export default {
|
||||||
if (this.$refs.mail.validate()) {
|
if (this.$refs.mail.validate()) {
|
||||||
if (this.mail) user.mail = this.mail
|
if (this.mail) user.mail = this.mail
|
||||||
}
|
}
|
||||||
if (this.$refs.password.validate()) {
|
if (this.$refs.newPassword.validate()) {
|
||||||
if (this.password) user.password = this.password
|
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({
|
this.saveConfig({
|
||||||
oldUsername: user.username,
|
oldUsername: user.username,
|
||||||
...user,
|
...user,
|
||||||
acceptedPassword: this.acceptedPassword
|
acceptedPassword: this.acceptedPassword
|
||||||
})
|
})
|
||||||
|
this.$refs.acceptedPassword.reset()
|
||||||
} else {
|
} else {
|
||||||
this.passError = 'Du musst dein Password eingeben'
|
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'
|
||||||
|
|
|
@ -6,7 +6,7 @@ const state = {
|
||||||
creditList: [],
|
creditList: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
addLoading: false,
|
addLoading: false,
|
||||||
error: '',
|
error: null,
|
||||||
days: [],
|
days: [],
|
||||||
messages: [],
|
messages: [],
|
||||||
status: [],
|
status: [],
|
||||||
|
@ -134,8 +134,12 @@ const mutations = {
|
||||||
setAddLoading(state, value) {
|
setAddLoading(state, value) {
|
||||||
state.addLoading = value
|
state.addLoading = value
|
||||||
},
|
},
|
||||||
setError(state, value) {
|
setError(state, {value, error}) {
|
||||||
state.error = value
|
//clearTimeout(state.error? state.error.timeout : null)
|
||||||
|
state.error = {value, error}
|
||||||
|
state.error.timeout = setTimeout(() => {
|
||||||
|
state.error = null
|
||||||
|
}, 6000)
|
||||||
},
|
},
|
||||||
createDays(state, date) {
|
createDays(state, date) {
|
||||||
let days = []
|
let days = []
|
||||||
|
@ -257,14 +261,15 @@ const actions = {
|
||||||
{ ...data },
|
{ ...data },
|
||||||
{ headers: { Token: rootState.login.user.accessToken } }
|
{ headers: { Token: rootState.login.user.accessToken } }
|
||||||
)
|
)
|
||||||
|
console.log(response.data)
|
||||||
commit('setUser', response.data)
|
commit('setUser', response.data)
|
||||||
commit('setError', '')
|
commit('setError', {value: 'Daten gespeichert', error: false})
|
||||||
dispatch('getLifeTime', null, { root: true })
|
dispatch('getLifeTime', null, { root: true })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.response) {
|
if (e.response) {
|
||||||
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
||||||
if (e.response.data) {
|
if (e.response.data) {
|
||||||
commit('setError', e.response.data.error)
|
commit('setError', { value: e.response.data.error, error: true})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue