2018-11-02 15:56:29 +01:00
|
|
|
<template>
|
|
|
|
|
<div class="mypanel">
|
|
|
|
|
|
|
|
|
|
<div v-if="!emailinviata">
|
2019-03-14 01:24:59 +01:00
|
|
|
<q-banner
|
|
|
|
|
rounded
|
|
|
|
|
class="bg-primary text-white"
|
|
|
|
|
style="text-align: center;">
|
|
|
|
|
<span class="mybanner">{{ $t('reset.title_update_pwd')}}</span>
|
2019-03-11 19:16:39 +01:00
|
|
|
</q-banner>
|
2018-11-02 15:56:29 +01:00
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
<q-field
|
|
|
|
|
:error="$v.form.password.$error"
|
|
|
|
|
:error-label="`${errorMsg('password', $v.form.password)}`"
|
|
|
|
|
>
|
|
|
|
|
<q-input
|
|
|
|
|
v-model="form.password"
|
|
|
|
|
:before="[{icon: 'vpn_key', handler () {}}]"
|
|
|
|
|
@blur="$v.form.password.$touch"
|
|
|
|
|
:error="$v.form.password.$error"
|
|
|
|
|
:float-label="$t('reg.password')"
|
|
|
|
|
/>
|
|
|
|
|
</q-field>
|
|
|
|
|
|
|
|
|
|
<q-field
|
|
|
|
|
:error="$v.form.repeatPassword.$error"
|
|
|
|
|
:error-label="`${errorMsg('repeatpassword', $v.form.repeatPassword)}`"
|
|
|
|
|
>
|
|
|
|
|
<q-input
|
|
|
|
|
v-model="form.repeatPassword"
|
|
|
|
|
:before="[{icon: 'vpn_key', handler () {}}]"
|
|
|
|
|
@blur="$v.form.repeatPassword.$touch"
|
|
|
|
|
:error="$v.form.repeatPassword.$error"
|
|
|
|
|
:float-label="$t('reg.repeatPassword')"
|
|
|
|
|
/>
|
|
|
|
|
</q-field>
|
|
|
|
|
|
|
|
|
|
<div align="center">
|
|
|
|
|
<q-btn rounded size="lg" color="primary" @click="submit" :disable="$v.$error">
|
|
|
|
|
{{$t('reset.update_password')}}
|
|
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else>
|
2019-03-14 01:24:59 +01:00
|
|
|
<q-banner
|
|
|
|
|
rounded
|
|
|
|
|
class="bg-primary text-white"
|
|
|
|
|
style="text-align: center;">
|
|
|
|
|
<span class="mybanner">{{ $t('reset.email_sent')}}</span>
|
2019-03-11 19:16:39 +01:00
|
|
|
</q-banner>
|
2018-11-02 15:56:29 +01:00
|
|
|
<br>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
{{ $t('reset.check_email')}}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
2019-03-11 19:16:39 +01:00
|
|
|
<script lang="ts">
|
2018-11-02 15:56:29 +01:00
|
|
|
|
2019-03-11 19:16:39 +01:00
|
|
|
import { mapActions } from 'vuex'
|
2018-11-02 20:30:53 +01:00
|
|
|
import * as types from '../../store/mutation-types'
|
2019-02-27 02:58:41 +01:00
|
|
|
//import {tools} from '../../store/Modules/user'
|
2018-11-02 15:56:29 +01:00
|
|
|
|
2019-03-11 19:16:39 +01:00
|
|
|
import { serv_constants } from '../../store/Modules/serv_constants'
|
2018-11-02 15:56:29 +01:00
|
|
|
|
|
|
|
|
|
2019-03-11 19:16:39 +01:00
|
|
|
import Vue from 'vue'
|
|
|
|
|
import { required } from "vuelidate/lib/validators"
|
|
|
|
|
import { UserStore } from "../../store/Modules";
|
|
|
|
|
import { IUserState } from "../../model";
|
2019-03-13 13:40:17 +01:00
|
|
|
import { tools } from "../../store/Modules/tools";
|
2019-07-12 14:09:44 +02:00
|
|
|
import { toolsext } from '@src/store/Modules/toolsext'
|
2019-03-11 19:16:39 +01:00
|
|
|
|
|
|
|
|
export default class UpdatePassword extends Vue {
|
|
|
|
|
emailsent = false
|
|
|
|
|
form: IUserState = {
|
|
|
|
|
password: '',
|
|
|
|
|
repeatPassword: '',
|
|
|
|
|
tokenforgot: '',
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-02 15:56:29 +01:00
|
|
|
created() {
|
2019-03-11 19:16:39 +01:00
|
|
|
// this.load()
|
|
|
|
|
}
|
|
|
|
|
get emailinviata() {
|
2018-11-02 15:56:29 +01:00
|
|
|
return this.emailsent
|
2019-03-11 19:16:39 +01:00
|
|
|
}
|
|
|
|
|
// validations: {
|
|
|
|
|
// form: {
|
|
|
|
|
// password: {
|
|
|
|
|
// required,
|
|
|
|
|
// },
|
|
|
|
|
// repeatPassword: {
|
|
|
|
|
// required,
|
|
|
|
|
// sameAsPassword: sameAs('password')
|
|
|
|
|
// },
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
|
2018-11-02 15:56:29 +01:00
|
|
|
submit() {
|
2019-03-11 19:16:39 +01:00
|
|
|
this.$v.form.$touch()
|
2018-11-02 15:56:29 +01:00
|
|
|
|
|
|
|
|
if (this.$v.form.$error) {
|
2019-03-13 13:40:17 +01:00
|
|
|
tools.showNotif(this.$q, this.$t('reg.err.errore_generico'))
|
2018-11-02 15:56:29 +01:00
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-11 19:16:39 +01:00
|
|
|
this.$q.loading.show({ message: this.$t('reset.incorso') })
|
2018-11-02 15:56:29 +01:00
|
|
|
|
2019-03-11 19:16:39 +01:00
|
|
|
this.form.tokenforgot = ''
|
2018-11-02 15:56:29 +01:00
|
|
|
|
2019-03-11 19:16:39 +01:00
|
|
|
console.log(this.form)
|
|
|
|
|
UserStore.actions.resetpwd(this.form)
|
2018-11-02 15:56:29 +01:00
|
|
|
.then((ris) => {
|
2019-03-11 19:16:39 +01:00
|
|
|
this.emailsent = ris.updatepwd
|
|
|
|
|
this.$q.loading.hide()
|
2018-11-02 15:56:29 +01:00
|
|
|
}).catch(error => {
|
2019-03-11 19:16:39 +01:00
|
|
|
console.log("ERROR = " + error)
|
|
|
|
|
this.$q.loading.hide()
|
|
|
|
|
})
|
2018-11-02 15:56:29 +01:00
|
|
|
|
|
|
|
|
}
|
2019-03-11 19:16:39 +01:00
|
|
|
})
|
2018-11-02 15:56:29 +01:00
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.mypanel {
|
|
|
|
|
padding: 10px;
|
|
|
|
|
margin: 10px;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</style>
|