- Chart Maps Nationality
- Username lowercase - Statistics - Telegram
This commit is contained in:
13
src/views/requestresetpwd/request-resetpwd-validate.ts
Normal file
13
src/views/requestresetpwd/request-resetpwd-validate.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { ISignupOptions } from 'model'
|
||||
import { email, minLength, required, sameAs } from 'vuelidate/lib/validators'
|
||||
// import { ValidationRuleset } from 'vuelidate'
|
||||
import { complexity, registeredemail, registereduser, aportadorexist } from '../../validation'
|
||||
|
||||
export const validations = {
|
||||
form: {
|
||||
email: {
|
||||
email,
|
||||
required
|
||||
}
|
||||
}
|
||||
}
|
||||
0
src/views/requestresetpwd/requestresetpwd.scss
Normal file
0
src/views/requestresetpwd/requestresetpwd.scss
Normal file
88
src/views/requestresetpwd/requestresetpwd.ts
Normal file
88
src/views/requestresetpwd/requestresetpwd.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
import Vue from 'vue'
|
||||
import { Component, Prop, Watch } from 'vue-property-decorator'
|
||||
import { serv_constants } from '../../store/Modules/serv_constants'
|
||||
|
||||
import { UserStore } from '../../store/Modules/index'
|
||||
import { tools } from '../../store/Modules/tools'
|
||||
import { Logo } from '../../components/logo'
|
||||
import { validationMixin } from 'vuelidate'
|
||||
import { CTitleBanner } from '../../components/CTitleBanner'
|
||||
import { validations } from './request-resetpwd-validate'
|
||||
|
||||
@Component({
|
||||
name: 'RequestResetPwd',
|
||||
mixins: [validationMixin],
|
||||
validations,
|
||||
components: { Logo, CTitleBanner }
|
||||
})
|
||||
|
||||
export default class RequestResetPwd extends Vue {
|
||||
public $q
|
||||
public $t
|
||||
public $v
|
||||
|
||||
public emailsent = false
|
||||
public form = {
|
||||
email: '',
|
||||
tokenforgot: ''
|
||||
}
|
||||
|
||||
get emailinviata() {
|
||||
return this.emailsent
|
||||
}
|
||||
|
||||
public submit() {
|
||||
this.$v.form.$touch()
|
||||
|
||||
if (this.$v.form.$error) {
|
||||
tools.showNotif(this.$q, this.$t('reg.err.errore_generico'))
|
||||
return
|
||||
}
|
||||
|
||||
this.$q.loading.show({ message: this.$t('reset.incorso') })
|
||||
|
||||
this.form.tokenforgot = ''
|
||||
|
||||
console.log(this.form)
|
||||
UserStore.actions.requestpwd(this.form)
|
||||
.then((ris) => {
|
||||
if (ris.code === serv_constants.RIS_CODE_OK)
|
||||
this.emailsent = true
|
||||
else if (ris.code === serv_constants.RIS_CODE_EMAIL_NOT_EXIST)
|
||||
tools.showNegativeNotif(this.$q, this.$t('reg.err.email_not_exist'))
|
||||
this.$q.loading.hide()
|
||||
}).catch((err) => {
|
||||
console.log('ERROR = ' + err.error)
|
||||
this.$q.loading.hide()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
public errorMsg(cosa: string, item: any) {
|
||||
try {
|
||||
if (!item.$error) {
|
||||
return ''
|
||||
}
|
||||
if (item.$params.email && !item.email) {
|
||||
return this.$t('reg.err.email')
|
||||
}
|
||||
|
||||
if (item.required !== undefined) {
|
||||
if (!item.required) {
|
||||
return this.$t('reg.err.required')
|
||||
}
|
||||
}
|
||||
|
||||
if (cosa === 'email') {
|
||||
if (!item.isUnique) {
|
||||
return this.$t('reg.err.duplicate_email')
|
||||
}
|
||||
}
|
||||
|
||||
return ''
|
||||
} catch (error) {
|
||||
// console.log("ERR : " + error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
65
src/views/requestresetpwd/requestresetpwd.vue
Normal file
65
src/views/requestresetpwd/requestresetpwd.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div class="row justify-center text-center padding">
|
||||
<div class="q-gutter-sm q-ma-sm" style="max-width: 800px; margin: auto;">
|
||||
|
||||
<div v-if="!emailinviata">
|
||||
<q-banner
|
||||
rounded
|
||||
class="bg-primary text-white"
|
||||
style="text-align: center;">
|
||||
<span class="mybanner">{{ $t('reset.title_reset_pwd')}}</span>
|
||||
</q-banner>
|
||||
<br>
|
||||
|
||||
<q-input
|
||||
v-model="form.email"
|
||||
rounded outlined
|
||||
autocomplete="email"
|
||||
@blur="$v.form.email.$touch"
|
||||
:error="$v.form.email.$error"
|
||||
:error-message="errorMsg('email', $v.form.email)"
|
||||
maxlength="50"
|
||||
debounce="1000"
|
||||
:label="$t('reg.email')">
|
||||
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="email"/>
|
||||
</template>
|
||||
|
||||
</q-input>
|
||||
|
||||
<br>
|
||||
|
||||
<div align="center q-ma-sm">
|
||||
<q-btn rounded size="lg" color="primary" @click="submit" :disable="$v.$error">
|
||||
{{$t('reset.send_reset_pwd')}}
|
||||
</q-btn>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-else>
|
||||
<q-banner
|
||||
rounded
|
||||
class="bg-positive text-white"
|
||||
style="text-align: center;">
|
||||
<span class="mybanner">{{ $t('reset.email_sent')}}</span>
|
||||
</q-banner>
|
||||
<br>
|
||||
|
||||
<div>
|
||||
<strong>{{ $t('reset.check_email')}}</strong>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./requestresetpwd.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './requestresetpwd';
|
||||
</style>
|
||||
Reference in New Issue
Block a user