- Fix: setlang
- Completed work: page '/vref' (Verify registration) OK
This commit is contained in:
@@ -12,6 +12,7 @@ const messages = {
|
||||
home: 'Principale',
|
||||
SignUp: 'Registrazione',
|
||||
SignIn: 'Login',
|
||||
vreg: 'Verifica Reg',
|
||||
Test: 'Test',
|
||||
},
|
||||
components: {
|
||||
@@ -95,6 +96,7 @@ const messages = {
|
||||
home: 'Dashboard One',
|
||||
SignUp: 'SignUp',
|
||||
SignIn: 'SignIn',
|
||||
vreg: 'Verify Reg',
|
||||
Test: 'Test',
|
||||
},
|
||||
components: {
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
console.log('Drawer created...')
|
||||
}
|
||||
|
||||
|
||||
photo = ''
|
||||
user = null
|
||||
links = {
|
||||
@@ -58,6 +57,7 @@
|
||||
{route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home'},
|
||||
{route: '/signup', faIcon: 'fa fa-signup', materialIcon: 'login', name: 'pages.SignUp'},
|
||||
{route: '/signin', faIcon: 'fa fa-login', materialIcon: 'login', name: 'pages.SignIn'},
|
||||
/* {route: '/vreg?idlink=aaa', faIcon: 'fa fa-login', materialIcon: 'login', name: 'pages.vreg'},*/
|
||||
],
|
||||
show: true
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ export interface IToken {
|
||||
|
||||
|
||||
export interface ILinkReg {
|
||||
idLink: string
|
||||
idlink: string
|
||||
}
|
||||
|
||||
export interface IIdToken {
|
||||
|
||||
10
src/pages/dashboard/home.vue
Normal file
10
src/pages/dashboard/home.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<q-page>Prova pagina</q-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
// name: 'PageName',
|
||||
}
|
||||
</script>
|
||||
50
src/plugins/guard.js
Normal file
50
src/plugins/guard.js
Normal file
@@ -0,0 +1,50 @@
|
||||
// import something here
|
||||
|
||||
// leave the export, even if you don't use it
|
||||
export default ({ app, router, store, Vue }) => {
|
||||
// something to do
|
||||
|
||||
// ******************************************
|
||||
// *** Per non permettere di accedere alle pagine in cui è necessario essere Loggati ! ***
|
||||
// ******************************************
|
||||
|
||||
/*
|
||||
router.beforeEach((to, from, next) => {
|
||||
var accessToken = store.state.session.userSession.accessToken
|
||||
// ESTANDO LOGEADO
|
||||
if (accessToken) {
|
||||
// SE PERMITE IR DE AREA PUBLICA A PRIVADA
|
||||
if (!from.matched.some(record => record.meta.requiresAuth) && to.matched.some(record => record.meta.requiresAuth)) {
|
||||
next()
|
||||
}
|
||||
// SE PERMITE IR DE UNA AREA PRIVADA A OTRA PRIVADA
|
||||
if (from.matched.some(record => record.meta.requiresAuth) && to.matched.some(record => record.meta.requiresAuth)) {
|
||||
next()
|
||||
}
|
||||
// NO SE PERMITE IR A UN AREA PUBLICA DESDE UN AREA PRIVADA
|
||||
if (from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
|
||||
next(false)
|
||||
}
|
||||
// SE REDIRIJE AL PANEL
|
||||
if (!from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
|
||||
next('/Panel')
|
||||
}
|
||||
// NO ESTA LOGEADO
|
||||
} else {
|
||||
// SE PERMITE IR DE UNA AREA PUBLICA A OTRA PUBLICA
|
||||
if (!from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
|
||||
next()
|
||||
}
|
||||
// SE PERMITE IR DE UNA AREA PRIVADA A UNA PUBLICA (LOGOUT)
|
||||
if (from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
|
||||
next()
|
||||
}
|
||||
// NO SE PERMITE IR DE UNA AREA PUBLICA A UNA PRIVADA
|
||||
if (!from.matched.some(record => record.meta.requiresAuth) && to.matched.some(record => record.meta.requiresAuth)) {
|
||||
// REDIRIGIR A LOGIN
|
||||
next('/')
|
||||
}
|
||||
}
|
||||
})
|
||||
*/
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export default class Home extends Vue {
|
||||
visibile: boolean = false
|
||||
cardvisible: string = 'hidden'
|
||||
displaycard: string = 'block'
|
||||
$t: any
|
||||
|
||||
public $q
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import { RouteConfig as VueRouteConfig } from 'vue-router'
|
||||
|
||||
import { RouteNames } from './route-names'
|
||||
|
||||
|
||||
export const RouteConfig: VueRouteConfig[] = [
|
||||
{
|
||||
component: () => import('@/root/home/home.vue'),
|
||||
@@ -10,10 +9,26 @@ export const RouteConfig: VueRouteConfig[] = [
|
||||
path: '/',
|
||||
meta: { name: 'Home' }
|
||||
},
|
||||
{ path: '/test', component: () => import('@/views/login/test.vue'), meta: { name: 'Test' } },
|
||||
{ path: '/signup', component: () => import('@/views/login/signup/signup.vue'), meta: { name: 'Registration' } },
|
||||
{ path: '/signin', component: () => import('@/views/login/signin/signin.vue'), meta: { name: 'Login' } },
|
||||
{ path: '/vreg', component: () => import('@/views/login/vreg.vue'), meta: { name: 'Verify Reg' } }
|
||||
{
|
||||
path: '/test',
|
||||
component: () => import('@/views/login/test.vue'),
|
||||
meta: { name: 'Test' }
|
||||
},
|
||||
{
|
||||
path: '/signup',
|
||||
component: () => import('@/views/login/signup/signup.vue'),
|
||||
meta: { name: 'Registration' }
|
||||
},
|
||||
{
|
||||
path: '/signin',
|
||||
component: () => import('@/views/login/signin/signin.vue'),
|
||||
meta: { name: 'Login' }
|
||||
},
|
||||
{
|
||||
path: '/vreg',
|
||||
component: () => import('@/views/login/vreg/vreg.vue'),
|
||||
meta: { name: 'Verify Reg' }
|
||||
}
|
||||
/*
|
||||
{
|
||||
path: '/requestresetpwd',
|
||||
|
||||
@@ -6,6 +6,7 @@ import router from '@router'
|
||||
|
||||
import { serv_constants } from '../Modules/serv_constants'
|
||||
import { rescodes } from '../Modules/rescodes'
|
||||
import { UserStore } from "@store"
|
||||
|
||||
const bcrypt = require('bcryptjs')
|
||||
|
||||
@@ -85,6 +86,7 @@ namespace Mutations {
|
||||
|
||||
function setlang(state: IUserState, newstr: string) {
|
||||
state.lang = newstr
|
||||
localStorage.setItem('lang', state.lang)
|
||||
}
|
||||
|
||||
function UpdatePwd(state: IUserState, data: IIdToken) {
|
||||
@@ -108,6 +110,14 @@ namespace Mutations {
|
||||
}
|
||||
|
||||
function autologin (state: IUserState) {
|
||||
// INIT
|
||||
UserStore.mutations.setlang(process.env.LANG_DEFAULT)
|
||||
// ++Todo: Estrai la Lang dal Localstorage
|
||||
const lang = localStorage.getItem('lang')
|
||||
if (lang) {
|
||||
UserStore.mutations.setlang(lang)
|
||||
}
|
||||
|
||||
const token = localStorage.getItem('token')
|
||||
if (!token) {
|
||||
return
|
||||
@@ -245,7 +255,7 @@ namespace Actions {
|
||||
let usertosend = {
|
||||
keyappid: process.env.PAO_APP_ID,
|
||||
idapp: process.env.APP_ID,
|
||||
idLink: paramquery.idLink
|
||||
idlink: paramquery.idlink
|
||||
}
|
||||
console.log(usertosend)
|
||||
|
||||
@@ -253,7 +263,7 @@ namespace Actions {
|
||||
|
||||
let myres
|
||||
|
||||
return Api.SendReq(call, state.lang, Getters.getters.tok, 'POST', usertosend)
|
||||
return await Api.SendReq(call, state.lang, Getters.getters.tok, 'POST', usertosend)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
myres = res
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
<template>
|
||||
<div class="mypanel">
|
||||
<q-alert color="primary q-title" style="text-align: center;">
|
||||
{{ $t('reg.title_verif_reg')}}
|
||||
</q-alert>
|
||||
<br>
|
||||
|
||||
<transition
|
||||
enter-active-class="animated flipInX"
|
||||
leave-active-class="animated flipOutX"
|
||||
appear
|
||||
>
|
||||
<q-alert
|
||||
v-if="giaverificato"
|
||||
type="warning"
|
||||
>
|
||||
{{ risultato}}
|
||||
</q-alert>
|
||||
<q-alert
|
||||
v-if="verificatook"
|
||||
type="positive"
|
||||
>
|
||||
{{ risultato}}
|
||||
</q-alert>
|
||||
</transition>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import {mapActions} from 'vuex'
|
||||
import * as types from '../../store/mutation-types'
|
||||
import { rescodes } from '../../../store/Modules/rescodes'
|
||||
|
||||
import {serv_constants} from '../../store/Modules/serv_constants';
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
risultato : '',
|
||||
riscode: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.load();
|
||||
},
|
||||
computed:{
|
||||
giaverificato: function() {
|
||||
return this.riscode !== serv_constants.RIS_CODE_EMAIL_VERIFIED
|
||||
},
|
||||
verificatook: function() {
|
||||
return this.riscode === serv_constants.RIS_CODE_EMAIL_VERIFIED
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions("user", {
|
||||
verifreg: types.USER_VREG,
|
||||
}),
|
||||
load: function () {
|
||||
this.verifreg(this.$route.query).then((ris) => {
|
||||
this.riscode = ris.code;
|
||||
this.risultato = ris.msg;
|
||||
console.log("RIS = ");
|
||||
console.log(ris);
|
||||
|
||||
if (this.verificatook) {
|
||||
setTimeout(() => {
|
||||
this.$router.replace('/');
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
}).catch((err) => {
|
||||
console.log("ERR = " + err);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mypanel {
|
||||
padding:10px;
|
||||
margin: 10px;
|
||||
|
||||
}
|
||||
</style>
|
||||
5
src/views/login/vreg/vreg.css
Normal file
5
src/views/login/vreg/vreg.css
Normal file
@@ -0,0 +1,5 @@
|
||||
.mypanel {
|
||||
padding:10px;
|
||||
margin: 10px;
|
||||
|
||||
}
|
||||
62
src/views/login/vreg/vreg.ts
Normal file
62
src/views/login/vreg/vreg.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import Vue from 'vue'
|
||||
import { Component } from 'vue-property-decorator' // Questo va messo SEMPRE ! (ed anche $t ....) altrimenti non carica !
|
||||
|
||||
import { UserStore } from '@store'
|
||||
|
||||
import { serv_constants } from '../../../store/Modules/serv_constants'
|
||||
|
||||
import './vreg.css'
|
||||
import { ILinkReg } from '../../../model/other'
|
||||
|
||||
@Component({
|
||||
|
||||
})
|
||||
export default class Vreg extends Vue {
|
||||
public risultato: string = '---'
|
||||
public riscode: number = 0
|
||||
$t: any
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
console.log('Vreg constructor...')
|
||||
}
|
||||
|
||||
created() {
|
||||
console.log('vreg created')
|
||||
this.load()
|
||||
}
|
||||
|
||||
get myrisultato() {
|
||||
return this.risultato
|
||||
}
|
||||
|
||||
get giaverificato() {
|
||||
return this.riscode !== serv_constants.RIS_CODE_EMAIL_VERIFIED
|
||||
}
|
||||
|
||||
get verificatook() {
|
||||
return this.riscode === serv_constants.RIS_CODE_EMAIL_VERIFIED
|
||||
}
|
||||
|
||||
load() {
|
||||
console.log('load')
|
||||
let param: ILinkReg
|
||||
param = { idlink: this.$route.query.idlink.toString() }
|
||||
console.log('idlink = ', param)
|
||||
UserStore.actions.vreg(param).then((ris) => {
|
||||
this.riscode = ris.code
|
||||
this.risultato = ris.msg
|
||||
console.log('RIS = ')
|
||||
console.log(ris)
|
||||
|
||||
if (this.verificatook) {
|
||||
setTimeout(() => {
|
||||
this.$router.replace('/')
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
}).catch((err) => {
|
||||
console.log('ERR = ' + err)
|
||||
})
|
||||
}
|
||||
}
|
||||
36
src/views/login/vreg/vreg.vue
Normal file
36
src/views/login/vreg/vreg.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<q-page padding class="vreg">
|
||||
<div class="mypanel">
|
||||
<q-alert color="primary q-title" style="text-align: center;">
|
||||
{{ $t('reg.title_verif_reg')}}
|
||||
</q-alert>
|
||||
<br>
|
||||
|
||||
<transition
|
||||
enter-active-class="animated flipInX"
|
||||
leave-active-class="animated flipOutX"
|
||||
appear
|
||||
>
|
||||
<span>
|
||||
<q-alert
|
||||
v-if="giaverificato"
|
||||
type="warning"
|
||||
>
|
||||
{{ myrisultato}}
|
||||
</q-alert>
|
||||
<q-alert
|
||||
v-if="verificatook"
|
||||
type="positive"
|
||||
>
|
||||
{{ myrisultato}}
|
||||
</q-alert>
|
||||
</span>
|
||||
</transition>
|
||||
|
||||
|
||||
</div>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./vreg.ts">
|
||||
</script>
|
||||
Reference in New Issue
Block a user