mirror of
https://framagit.org/les/gancio.git
synced 2025-01-31 16:42:22 +01:00
improve recover and user_confirm error messages
This commit is contained in:
parent
98c56b6d32
commit
54cc50169b
2 changed files with 25 additions and 20 deletions
|
@ -1,5 +1,6 @@
|
|||
<template lang='pug'>
|
||||
v-container
|
||||
v-form(@submit.prevent="change_password" v-model='valid')
|
||||
v-row.mt-5(align='center' justify='center')
|
||||
v-col(cols='12' md="6" lg="5" xl="4")
|
||||
v-card
|
||||
|
@ -11,14 +12,17 @@ v-container
|
|||
:rules="$validators.password"
|
||||
autofocus :placeholder='$t("common.new_password")'
|
||||
v-model='new_password')
|
||||
div(v-else) {{$t('recover.not_valid_code')}}
|
||||
template(v-else)
|
||||
v-card-text
|
||||
v-alert(type='error' :icon='mdiAlert') {{$t('recover.not_valid_code')}} <br/> {{ error }}
|
||||
|
||||
v-card-actions
|
||||
v-spacer
|
||||
v-btn(v-if='user' text color='primary' @click='change_password') {{$t('common.send')}}
|
||||
v-btn(v-if='user' outlined color='primary' type='submit' :disabled='!valid') {{$t('common.send')}}
|
||||
</template>
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import { mdiAlert } from '@mdi/js'
|
||||
|
||||
export default {
|
||||
name: 'Recover',
|
||||
|
@ -28,11 +32,11 @@ export default {
|
|||
const user = await $axios.$post('/user/check_recover_code', { recover_code: code })
|
||||
return { user, code }
|
||||
} catch (e) {
|
||||
return { user: false }
|
||||
return { user: false, error: String(e) }
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return { new_password: '' }
|
||||
return { new_password: '', valid: false, mdiAlert }
|
||||
},
|
||||
computed: mapState(['settings']),
|
||||
methods: {
|
||||
|
|
|
@ -15,10 +15,11 @@ v-container
|
|||
v-btn(color="primary" type='submit' :disabled='!new_password' @click='change_password' outlined) {{$t('common.send')}}
|
||||
|
||||
v-card-text(v-else)
|
||||
v-alert.ma-5(type='error') {{$t('recover.not_valid_code')}}
|
||||
v-alert.ma-5(type='error' :icon='mdiAlert') {{$t('recover.not_valid_code')}} <br/> {{ error }}
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import { mdiAlert } from '@mdi/js'
|
||||
|
||||
export default {
|
||||
name: 'Recover',
|
||||
|
@ -28,11 +29,11 @@ export default {
|
|||
const user = await $axios.$post('/user/check_recover_code', { recover_code: code })
|
||||
return { user, code }
|
||||
} catch (e) {
|
||||
return { user: false }
|
||||
return { user: false, error: String(e) }
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return { new_password: '' }
|
||||
return { new_password: '', mdiAlert }
|
||||
},
|
||||
methods: {
|
||||
async change_password () {
|
||||
|
|
Loading…
Reference in a new issue