fix submit UX on user_confirm

This commit is contained in:
lesion
2022-06-28 13:33:47 +02:00
parent 623ee02a21
commit c3e78bfd9a

View File

@@ -2,20 +2,20 @@
v-container v-container
v-row.mt-5(align='center' justify='center') v-row.mt-5(align='center' justify='center')
v-col(cols='12' md="6" lg="5" xl="4") v-col(cols='12' md="6" lg="5" xl="4")
v-card v-form(ref='form' @submit.prevent='change_password')
v-card-title {{$t('common.set_password')}} v-card
template(v-if='user') v-card-title {{$t('common.set_password')}}
v-card-subtitle {{user.email}} template(v-if='user')
v-card-text v-card-subtitle {{user.email}}
v-form v-card-text
v-text-field(type='password' v-model='new_password' :label="$t('common.new_password')" :rules='$validators.password' autofocus) v-text-field(type='password' v-model='new_password' :label="$t('common.new_password')" :rules='$validators.password' autofocus)
v-card-actions v-card-actions
v-spacer v-spacer
v-btn(text color="primary" :disabled='!new_password' @click='change_password') {{$t('common.send')}} v-btn(color="primary" type='submit' :disabled='!new_password' @click='change_password' outlined) {{$t('common.send')}}
v-card-text(v-else) v-card-text(v-else)
v-alert.ma-5(type='error') {{$t('recover.not_valid_code')}} v-alert.ma-5(type='error') {{$t('recover.not_valid_code')}}
</template> </template>
<script> <script>
@@ -36,10 +36,11 @@ export default {
}, },
methods: { methods: {
async change_password () { async change_password () {
if (!this.$refs.form.validate()) return
try { try {
await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password }) await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
this.$root.$message('common.password_updated', { color: 'success' }) this.$root.$message('common.password_updated', { color: 'success' })
this.$router.replace('/login') this.$router.push('/login')
} catch (e) { } catch (e) {
this.$root.$message(e, { color: 'warning' }) this.$root.$message(e, { color: 'warning' })
} }