- Downline User

- Not registered if already exists.
- Forgot Password
This commit is contained in:
Paolo Arena
2020-01-30 01:20:56 +01:00
parent 1956e53d07
commit 4b54a9ce52
31 changed files with 793 additions and 0 deletions

View File

View File

@@ -0,0 +1,25 @@
import Vue from 'vue'
import { Component } from 'vue-property-decorator'
import { GlobalStore } from '@store'
import { tools } from '../../../store/Modules/tools'
import { UserStore } from '../../../store/Modules'
import { CTitleBanner } from '../../../components/CTitleBanner'
@Component({
components: { CTitleBanner }
})
export default class Dbop extends Vue {
public ris: string = ''
public async changeCellInt() {
const mydata = {
dbop: 'changeCellInt'
}
this.ris = await UserStore.actions.execDbOp({ mydata })
}
}

View File

@@ -0,0 +1,27 @@
<template>
<div>
<CTitleBanner title="Operazioni su DB:"></CTitleBanner>
<div class="q-ma-md q-pa-sm text-center rounded-borders q-list--bordered">
<q-btn label="Passa i codici Telefoni sul campo cell" color="primary" @click="changeCellInt"></q-btn>
</div>
<q-field
stack-label
dense
>
<template v-slot:control>
<div class="self-center full-width no-outline text-center" tabindex="0">{{ris}}</div>
</template>
</q-field>
</div>
</template>
<script lang="ts" src="./dbop.ts">
</script>
<style lang="scss" scoped>
@import './dbop';
</style>

View File

@@ -0,0 +1 @@
export {default as dbop} from './dbop.vue'

View File

@@ -0,0 +1,18 @@
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: {
repeatPassword: {
required,
sameAsPassword: sameAs('password')
},
password: {
required,
minLength: minLength(8),
complexity
}
}
}

View File

@@ -0,0 +1,125 @@
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({
mixins: [validationMixin],
validations,
components: { Logo, CTitleBanner }
})
export default class Updatepassword extends Vue {
public $q
public $t
public $v
public emailsent = false
public form = {
password: '',
repeatPassword: '',
tokenforgot: '',
email: '',
idapp: ''
}
public created() {
// this.load()
}
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') })
// console.log('this.$route.query', this.$route.query)
this.form.tokenforgot = this.$route.query.tokenforgot.toString()
this.form.email = this.$route.query.email.toString()
this.form.idapp = process.env.APP_ID
console.log(this.form)
UserStore.actions.resetpwd(this.form)
.then((ris) => {
console.log('ris', ris)
if (ris.code === serv_constants.RIS_CODE_OK)
this.$router.push('/signin')
else if (ris.code === serv_constants.RIS_CODE_TOKEN_RESETPASSWORD_NOT_FOUND)
tools.showNegativeNotif(this.$q, this.$t('reset.token_scaduto'))
else
tools.showNegativeNotif(this.$q, this.$t('fetch.errore_server'))
this.$q.loading.hide()
}).catch(error => {
console.log('ERROR = ' + error)
this.$q.loading.hide()
})
}
public errorMsg(cosa: string, item: any) {
try {
if (!item.$error) {
return ''
}
// console.log('errorMsg', cosa, item)
if (item.$params.email && !item.email) {
return this.$t('reg.err.email')
}
if (cosa === 'repeatpassword') {
if (!item.sameAsPassword) {
return this.$t('reg.err.sameaspassword')
}
}
// console.log('item', item)
if (item.minLength !== undefined) {
if (!item.minLength) {
return this.$t('reg.err.atleast') + ` ${item.$params.minLength.min} ` + this.$t('reg.err.char')
}
}
if (item.complexity !== undefined) {
if (!item.complexity) {
return this.$t('reg.err.complexity')
}
}
// if (!item.maxLength) { return this.$t('reg.err.notmore') + ` ${item.$params.maxLength.max} ` + this.$t('reg.err.char') }
if (item.required !== undefined) {
if (!item.required) {
return this.$t('reg.err.required')
}
}
// console.log(' ....avanti')
if (cosa === 'email') {
// console.log("EMAIL " + item.isUnique);
// console.log(item);
if (!item.isUnique) {
return this.$t('reg.err.duplicate_email')
}
}
return ''
} catch (error) {
// console.log("ERR : " + error);
}
}
}

View File

@@ -0,0 +1,81 @@
<template>
<div class="mypanel">
<div v-if="!emailinviata">
<q-banner
rounded
class="bg-primary text-white"
style="text-align: center;">
<span class="mybanner">{{ $t('reset.title_update_pwd')}}</span>
</q-banner>
<br>
<div class="column">
<q-input
v-model="form.password"
type="password"
rounded outlined
@blur="$v.form.password.$touch"
:error="$v.form.password.$error"
:error-message="`${errorMsg('password', $v.form.password)}`"
maxlength="30"
:label="$t('reg.password')">
<template v-slot:prepend>
<q-icon name="vpn_key"/>
</template>
</q-input>
<q-input
v-model="form.repeatPassword"
type="password"
maxlength="30"
rounded outlined
@blur="$v.form.repeatPassword.$touch"
:error="$v.form.repeatPassword.$error"
:error-message="`${errorMsg('repeatpassword', $v.form.repeatPassword)}`"
:label="$t('reg.repeatPassword')">
<template v-slot:prepend>
<q-icon name="vpn_key"/>
</template>
</q-input>
<div align="center">
<q-btn rounded size="lg" color="primary" @click="submit" :disable="$v.$error">
{{$t('reset.update_password')}}
</q-btn>
</div>
</div>
</div>
<div v-else>
<q-banner
rounded
class="bg-primary text-white"
style="text-align: center;">
<span class="mybanner">{{ $t('reset.email_sent')}}</span>
</q-banner>
<br>
<div>
{{ $t('reset.check_email')}}
</div>
</div>
</div>
</template>
<script lang="ts" src="./updatepassword.ts">
</script>
<style lang="scss" scoped>
@import './updatepassword';
</style>