Richiesta Cambio Password: ti manda il codice a 6 cifre e poterlo inserire sulla APP.
This commit is contained in:
@@ -62,6 +62,10 @@ const webpackDevConfig = {
|
|||||||
new webpack.NamedModulesPlugin(),
|
new webpack.NamedModulesPlugin(),
|
||||||
],
|
],
|
||||||
devServer: {
|
devServer: {
|
||||||
|
headers: {
|
||||||
|
'Access-Control-Allow-Origin': '*',
|
||||||
|
'Access-Control-Allow-Headers': '*',
|
||||||
|
},
|
||||||
/*
|
/*
|
||||||
headers: {
|
headers: {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
|
|||||||
@@ -149,6 +149,10 @@ module.exports = configure((ctx) => ({
|
|||||||
https: false,
|
https: false,
|
||||||
port: 8084,
|
port: 8084,
|
||||||
open: false, // opens browser window automatically
|
open: false, // opens browser window automatically
|
||||||
|
headers: {
|
||||||
|
'Access-Control-Allow-Origin': '*',
|
||||||
|
'Access-Control-Allow-Headers': '*',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// https://v2.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework
|
// https://v2.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework
|
||||||
|
|||||||
@@ -1,19 +1,24 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { boot } from 'quasar/wrappers'
|
import { boot } from 'quasar/wrappers'
|
||||||
|
|
||||||
const api = axios.create({ baseURL: process.env.MONGODB_HOST })
|
const api = axios.create({
|
||||||
|
baseURL: process.env.MONGODB_HOST,
|
||||||
|
headers: {
|
||||||
|
'Content-type': 'application/json',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
export default boot(({ app }) => {
|
export default boot(({ app }) => {
|
||||||
// for use inside Vue files (Options API) through this.$axios and this.$api
|
// for use inside Vue files (Options API) through this.$axios and this.$api
|
||||||
|
|
||||||
app.config.globalProperties.$axios = axios
|
app.config.globalProperties.$axios = axios
|
||||||
// ^ ^ ^ this will allow you to use this.$axios (for Vue Options API form)
|
// ^ ^ ^ this will allow you to use this.$axios (for Vue Options API form)
|
||||||
// so you won't necessarily have to import axios in each vue file
|
// so you won't necessarily have to import axios in each vue file
|
||||||
|
|
||||||
app.config.globalProperties.$api = api
|
app.config.globalProperties.$api = api
|
||||||
// ^ ^ ^ this will allow you to use this.$api (for Vue Options API form)
|
// ^ ^ ^ this will allow you to use this.$api (for Vue Options API form)
|
||||||
// so you can easily perform requests against your app's API
|
// so you can easily perform requests against your app's API
|
||||||
//
|
//
|
||||||
})
|
})
|
||||||
|
|
||||||
export { axios }
|
export { axios }
|
||||||
|
|||||||
@@ -593,6 +593,7 @@ const msg_it = {
|
|||||||
char: 'caratteri',
|
char: 'caratteri',
|
||||||
terms: 'Devi accettare le condizioni, per continuare.',
|
terms: 'Devi accettare le condizioni, per continuare.',
|
||||||
email_not_exist: 'l\'Email non è presente in archivio, verificare se è corretta',
|
email_not_exist: 'l\'Email non è presente in archivio, verificare se è corretta',
|
||||||
|
code_resetpwd_error: 'Il codice inserito non è corretto.',
|
||||||
duplicate_email: 'l\'Email è già stata registrata',
|
duplicate_email: 'l\'Email è già stata registrata',
|
||||||
invalid_email: 'l\'Email non è valida',
|
invalid_email: 'l\'Email non è valida',
|
||||||
user_already_exist: 'La registrazione con questi dati (nome, cognome e cellulare) è stata già effettuata. Per accedere al sito, cliccare sul bottone LOGIN dalla HomePage.',
|
user_already_exist: 'La registrazione con questi dati (nome, cognome e cellulare) è stata già effettuata. Per accedere al sito, cliccare sul bottone LOGIN dalla HomePage.',
|
||||||
@@ -645,12 +646,14 @@ const msg_it = {
|
|||||||
reset: {
|
reset: {
|
||||||
title_reset_pwd: 'Reimposta la tua Password',
|
title_reset_pwd: 'Reimposta la tua Password',
|
||||||
send_reset_pwd: 'Invia Reimposta la password',
|
send_reset_pwd: 'Invia Reimposta la password',
|
||||||
|
resend_reset_pwd: 'Rimanda nuovamente',
|
||||||
incorso: 'Richiesta Nuova Email...',
|
incorso: 'Richiesta Nuova Email...',
|
||||||
email_sent: 'Email inviata',
|
email_sent: 'Email inviata',
|
||||||
check_email: 'Controlla la tua email, ti arriverà un messaggio con un link per reimpostare la tua password. Questo link, per sicurezza, scadrà dopo 4 ore.',
|
check_email: 'Controlla la tua email, ti arriverà un messaggio con un link per reimpostare la tua password. Questo link, per sicurezza, scadrà dopo 4 ore.',
|
||||||
token_scaduto: 'Il token è scaduto oppure è stato già usato. Ripetere la procedura di reset password',
|
token_scaduto: 'Il token è scaduto oppure è stato già usato. Ripetere la procedura di reset password',
|
||||||
title_update_pwd: 'Aggiorna la tua password',
|
title_update_pwd: 'Aggiorna la tua password',
|
||||||
update_password: 'Aggiorna Password',
|
update_password: 'Aggiorna Password',
|
||||||
|
confirmcode_reset: 'Conferma Codice',
|
||||||
},
|
},
|
||||||
logout: {
|
logout: {
|
||||||
uscito: 'Sei Uscito',
|
uscito: 'Sei Uscito',
|
||||||
|
|||||||
@@ -573,13 +573,14 @@ export const useUserStore = defineStore('UserStore', {
|
|||||||
async requestpwd(paramquery: any) {
|
async requestpwd(paramquery: any) {
|
||||||
const usertosend = {
|
const usertosend = {
|
||||||
email: paramquery.email,
|
email: paramquery.email,
|
||||||
|
codetocheck: paramquery.tokenforgot_code,
|
||||||
}
|
}
|
||||||
console.log(usertosend)
|
console.log(usertosend)
|
||||||
|
|
||||||
this.setServerCode(tools.CALLING)
|
this.setServerCode(tools.CALLING)
|
||||||
|
|
||||||
return Api.SendReq('/requestnewpwd', 'POST', usertosend)
|
return Api.SendReq('/requestnewpwd', 'POST', usertosend)
|
||||||
.then((res) => ({ code: res.data.code, msg: res.data.msg })).catch((error) => {
|
.then((res) => ({ code: res.data.code, msg: res.data.msg, link: res.data.link })).catch((error) => {
|
||||||
this.setErrorCatch(error)
|
this.setErrorCatch(error)
|
||||||
return this.getServerCode
|
return this.getServerCode
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,13 +4,14 @@ import { tools } from '@store/Modules/tools'
|
|||||||
import { Logo } from '../../components/logo'
|
import { Logo } from '../../components/logo'
|
||||||
import { CTitleBanner } from '../../components/CTitleBanner'
|
import { CTitleBanner } from '../../components/CTitleBanner'
|
||||||
|
|
||||||
import { defineComponent, reactive, ref } from 'vue'
|
import { defineComponent, reactive, ref, watch } from 'vue'
|
||||||
import { useI18n } from '@src/boot/i18n'
|
import { useI18n } from '@src/boot/i18n'
|
||||||
import { useUserStore } from '@store/UserStore'
|
import { useUserStore } from '@store/UserStore'
|
||||||
import { useGlobalStore } from '@store/globalStore'
|
import { useGlobalStore } from '@store/globalStore'
|
||||||
import { useQuasar } from 'quasar'
|
import { useQuasar } from 'quasar'
|
||||||
import useVuelidate from '@vuelidate/core'
|
import useVuelidate from '@vuelidate/core'
|
||||||
import { validations } from '@src/views/requestresetpwd/request-resetpwd-validate'
|
import { validations } from '@src/views/requestresetpwd/request-resetpwd-validate'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@@ -22,6 +23,8 @@ export default defineComponent({
|
|||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore()
|
||||||
|
|
||||||
|
const $router = useRouter()
|
||||||
|
|
||||||
const emailsent = ref(false)
|
const emailsent = ref(false)
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
email: '',
|
email: '',
|
||||||
@@ -34,6 +37,10 @@ export default defineComponent({
|
|||||||
|
|
||||||
const emailRef = ref(null)
|
const emailRef = ref(null)
|
||||||
|
|
||||||
|
watch(() => form.tokenforgot_code, (to: any, from: any) => {
|
||||||
|
checkCode()
|
||||||
|
})
|
||||||
|
|
||||||
function emailinviata() {
|
function emailinviata() {
|
||||||
return emailsent.value
|
return emailsent.value
|
||||||
}
|
}
|
||||||
@@ -75,6 +82,30 @@ export default defineComponent({
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkCode() {
|
||||||
|
|
||||||
|
const mycode = form.tokenforgot_code.trim()
|
||||||
|
if (mycode.length === 6) {
|
||||||
|
$q.loading.show({ message: t('reset.incorso') })
|
||||||
|
// Check if code is correct
|
||||||
|
userStore.requestpwd(form)
|
||||||
|
.then((ris: any) => {
|
||||||
|
if (ris.code === serv_constants.RIS_CODE_OK) {
|
||||||
|
if (ris.link)
|
||||||
|
$router.replace(ris.link)
|
||||||
|
} else {
|
||||||
|
tools.showNegativeNotif($q, t('reg.err.code_resetpwd_error'))
|
||||||
|
}
|
||||||
|
form.tokenforgot_code = ''
|
||||||
|
$q.loading.hide()
|
||||||
|
}).catch((err: any) => {
|
||||||
|
console.log('ERROR = ' + err.error)
|
||||||
|
$q.loading.hide()
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
emailinviata,
|
emailinviata,
|
||||||
submit,
|
submit,
|
||||||
@@ -82,6 +113,7 @@ export default defineComponent({
|
|||||||
emailRef,
|
emailRef,
|
||||||
v$,
|
v$,
|
||||||
tools,
|
tools,
|
||||||
|
checkCode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,60 +1,88 @@
|
|||||||
<template>
|
<template>
|
||||||
<form @submit.prevent.stop="submit" class="row justify-center text-center padding">
|
<form
|
||||||
|
v-if="!emailinviata()"
|
||||||
|
@submit.prevent.stop="submit"
|
||||||
|
class="row justify-center text-center padding"
|
||||||
|
>
|
||||||
<div class="q-gutter-sm q-ma-sm">
|
<div class="q-gutter-sm q-ma-sm">
|
||||||
|
<div>
|
||||||
<div v-if="!emailinviata()">
|
|
||||||
<q-banner
|
<q-banner
|
||||||
rounded
|
rounded
|
||||||
class="bg-primary text-white"
|
class="bg-primary text-white"
|
||||||
style="text-align: center;">
|
style="text-align: center"
|
||||||
|
>
|
||||||
<span class="mybanner">{{ $t('reset.title_reset_pwd') }}</span>
|
<span class="mybanner">{{ $t('reset.title_reset_pwd') }}</span>
|
||||||
</q-banner>
|
</q-banner>
|
||||||
<br>
|
<br />
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
ref="emailRef"
|
ref="emailRef"
|
||||||
v-model="form.email"
|
v-model="form.email"
|
||||||
rounded outlined
|
rounded
|
||||||
|
outlined
|
||||||
autocomplete="email"
|
autocomplete="email"
|
||||||
maxlength="50"
|
maxlength="50"
|
||||||
debounce="1000"
|
debounce="1000"
|
||||||
:error="v$.email.$error"
|
:error="v$.email.$error"
|
||||||
:error-message="tools.errorMsg( 'email', v$.email)"
|
:error-message="tools.errorMsg('email', v$.email)"
|
||||||
:label="$t('reg.email')">
|
:label="$t('reg.email')"
|
||||||
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon name="email"/>
|
<q-icon name="email" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</q-input>
|
</q-input>
|
||||||
|
|
||||||
<br>
|
<br />
|
||||||
|
|
||||||
<div class="center q-ma-sm">
|
<div class="center q-ma-sm">
|
||||||
<q-btn
|
<q-btn
|
||||||
rounded size="lg" color="primary" type="submit" :disable="v$.$error || v$.$invalid">{{ $t('reset.send_reset_pwd') }}
|
rounded
|
||||||
|
size="lg"
|
||||||
|
color="primary"
|
||||||
|
type="submit"
|
||||||
|
:disable="v$.$error || v$.$invalid"
|
||||||
|
>{{ $t('reset.send_reset_pwd') }}
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<q-banner
|
<q-banner rounded class="bg-positive text-white" style="text-align: center">
|
||||||
rounded
|
|
||||||
class="bg-positive text-white"
|
|
||||||
style="text-align: center;">
|
|
||||||
<span class="mybanner">{{ $t('reset.email_sent') }}</span>
|
<span class="mybanner">{{ $t('reset.email_sent') }}</span>
|
||||||
</q-banner>
|
</q-banner>
|
||||||
<br>
|
<br />
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<strong>{{ $t('reset.check_email') }}</strong>
|
<strong>{{ $t('reset.check_email') }}</strong>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
<br>
|
||||||
|
<q-input
|
||||||
|
v-model="form.tokenforgot_code"
|
||||||
|
rounded
|
||||||
|
outlined
|
||||||
|
label="Inserisci il codice a 6 cifre"
|
||||||
|
debounce="1000"
|
||||||
|
:maxlength="6"
|
||||||
|
type="number"
|
||||||
|
>
|
||||||
|
</q-input>
|
||||||
|
|
||||||
|
<br /><br />
|
||||||
|
|
||||||
|
<div class="center q-ma-sm">
|
||||||
|
<q-btn
|
||||||
|
@click="checkCode"
|
||||||
|
rounded
|
||||||
|
size="lg"
|
||||||
|
color="primary"
|
||||||
|
type="submit"
|
||||||
|
:disable="v$.$error || v$.$invalid"
|
||||||
|
>{{ $t('reset.confirmcode_reset') }}
|
||||||
|
</q-btn>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" src="./requestresetpwd.ts">
|
<script lang="ts" src="./requestresetpwd.ts">
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ export default defineComponent({
|
|||||||
const $router = useRouter()
|
const $router = useRouter()
|
||||||
const $route = useRoute()
|
const $route = useRoute()
|
||||||
|
|
||||||
|
const typePassword = ref('password')
|
||||||
|
|
||||||
const emailsent = ref(false)
|
const emailsent = ref(false)
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
password: '',
|
password: '',
|
||||||
@@ -93,6 +95,11 @@ export default defineComponent({
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showPassword() {
|
||||||
|
//
|
||||||
|
typePassword.value = typePassword.value === 'password' ? 'text' : 'password'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
form,
|
form,
|
||||||
@@ -100,6 +107,8 @@ export default defineComponent({
|
|||||||
submit,
|
submit,
|
||||||
tools,
|
tools,
|
||||||
v$,
|
v$,
|
||||||
|
showPassword,
|
||||||
|
typePassword,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
v-model="form.password"
|
v-model="form.password"
|
||||||
type="password"
|
:type="typePassword"
|
||||||
dense
|
dense
|
||||||
rounded outlined
|
rounded outlined
|
||||||
@blur="v$.password.$touch"
|
@blur="v$.password.$touch"
|
||||||
@@ -26,17 +26,27 @@
|
|||||||
maxlength="30"
|
maxlength="30"
|
||||||
:label="$t('reg.password')">
|
:label="$t('reg.password')">
|
||||||
|
|
||||||
|
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-btn
|
||||||
|
tabindex="-1"
|
||||||
|
:icon="typePassword === `password` ? `fas fa-eye-slash` : `fas fa-eye`"
|
||||||
|
@click="showPassword"
|
||||||
|
>
|
||||||
|
</q-btn>
|
||||||
|
</template>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon name="vpn_key"/>
|
<q-icon name="vpn_key"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
</q-input>
|
</q-input>
|
||||||
|
|
||||||
<div class="q-my-sm"></div>
|
<div class="q-my-sm"></div>
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
v-model="form.repeatPassword"
|
v-model="form.repeatPassword"
|
||||||
type="password"
|
:type="typePassword"
|
||||||
dense
|
dense
|
||||||
maxlength="30"
|
maxlength="30"
|
||||||
rounded outlined
|
rounded outlined
|
||||||
@@ -49,6 +59,14 @@
|
|||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon name="vpn_key"/>
|
<q-icon name="vpn_key"/>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-btn
|
||||||
|
tabindex="-1"
|
||||||
|
:icon="typePassword === `password` ? `fas fa-eye-slash` : `fas fa-eye`"
|
||||||
|
@click="showPassword"
|
||||||
|
>
|
||||||
|
</q-btn>
|
||||||
|
</template>
|
||||||
|
|
||||||
</q-input>
|
</q-input>
|
||||||
|
|
||||||
@@ -61,8 +79,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<pre>{{ v$.$errors }}</pre>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<q-banner
|
<q-banner
|
||||||
|
|||||||
Reference in New Issue
Block a user