fix page verify registration
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
APP_VERSION="0.0.47"
|
APP_VERSION="0.0.51"
|
||||||
SERVICE_WORKER_FILE='service-worker.js'
|
SERVICE_WORKER_FILE="service-worker.js"
|
||||||
APP_ID='1'
|
APP_ID="1"
|
||||||
APP_URL='https://freeplanet.app'
|
APP_URL="https://freeplanet.app"
|
||||||
PROVA_PAOLO='PROVA SVILUPPO'
|
PROVA_PAOLO="PROVA SVILUPPO"
|
||||||
LANG_DEFAULT='it'
|
LANG_DEFAULT="it"
|
||||||
PAO_APP_ID='KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF'
|
PAO_APP_ID="KKPPAA5KJK435J3KSS9F9D8S9F8SD98F9SDF"
|
||||||
MASTER_KEY='KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T'
|
MASTER_KEY="KKPPSS5KJK435J3KSS9F9D8S9F8SD3CR3T"
|
||||||
MONGODB_HOST='http://localhost:3000'
|
MONGODB_HOST="http://localhost:3000"
|
||||||
LOGO_REG="freeplanet-logo-full.svg"
|
LOGO_REG="freeplanet-logo-full.svg"
|
||||||
TEST_EMAIL='paolo.arena77@gmail.com'
|
TEST_EMAIL="paolo.arena77@gmail.com"
|
||||||
TEST_USERNAME='paoloar77'
|
TEST_USERNAME="paoloar77"
|
||||||
TEST_PASSWORD='mypassword@1A'
|
TEST_PASSWORD="mypassword@1A"
|
||||||
PUBLICKEY_PUSH='BGxRrFWnPoa_ImUaWXmeEOFVI9VNKVKaAPsvsM1XY6wn24yxp9MyOQ4crNYCJKxSXV65Y1GblW5_VLoamedcZ1I'
|
PUBLICKEY_PUSH="BGxRrFWnPoa_ImUaWXmeEOFVI9VNKVKaAPsvsM1XY6wn24yxp9MyOQ4crNYCJKxSXV65Y1GblW5_VLoamedcZ1I"
|
||||||
IN_CONSTRUCTION='0'
|
IN_CONSTRUCTION="0"
|
||||||
DEBUG='1'
|
DEBUG="1"
|
||||||
TELEGRAM_SUPPORT='https://t.me/freeplanet_supporto'
|
TELEGRAM_SUPPORT="https://t.me/freeplanet_supporto"
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ module.exports = function (ctx) {
|
|||||||
iconSet: 'fontawesome-v5',
|
iconSet: 'fontawesome-v5',
|
||||||
lang: 'it', // Quasar language
|
lang: 'it', // Quasar language
|
||||||
},
|
},
|
||||||
animations: [],
|
animations: 'all',
|
||||||
ssr: {
|
ssr: {
|
||||||
pwa: {
|
pwa: {
|
||||||
runtimeCaching: [
|
runtimeCaching: [
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ export default class Header extends Vue {
|
|||||||
|
|
||||||
console.log('this.$q.i18n=', this.$q.i18n, 'this.$q.getLocale()=', this.$q.lang.isoName)
|
console.log('this.$q.i18n=', this.$q.i18n, 'this.$q.getLocale()=', this.$q.lang.isoName)
|
||||||
const my = this.getLangAtt()
|
const my = this.getLangAtt()
|
||||||
tools.showNotif(this.$q, 'prima: ' + String(my))
|
// tools.showNotif(this.$q, 'prima: ' + String(my))
|
||||||
|
|
||||||
let mylang = tools.getItemLS(tools.localStorage.lang)
|
let mylang = tools.getItemLS(tools.localStorage.lang)
|
||||||
if (mylang === '') {
|
if (mylang === '') {
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ export const removeAuthHeaders = () => {
|
|||||||
delete axiosInstance.defaults.headers.Authorization
|
delete axiosInstance.defaults.headers.Authorization
|
||||||
}
|
}
|
||||||
|
|
||||||
async function Request(type: string, path: string, payload: any, setAuthToken?: boolean): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
async function Request(type: string, path: string, payload: any): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||||
let ricevuto = false
|
let ricevuto = false
|
||||||
try {
|
try {
|
||||||
// console.log(`Axios Request [${type}]:`, axiosInstance.defaults)
|
console.log(`Axios Request [${type}]:`, axiosInstance.defaults, 'path:', path)
|
||||||
let response: AxiosResponse
|
let response: AxiosResponse
|
||||||
if (type === 'post' || type === 'put' || type === 'patch') {
|
if (type === 'post' || type === 'put' || type === 'patch') {
|
||||||
response = await axiosInstance[type](path, payload, {
|
response = await axiosInstance[type](path, payload, {
|
||||||
@@ -52,7 +52,7 @@ async function Request(type: string, path: string, payload: any, setAuthToken?:
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
ricevuto = true
|
ricevuto = true
|
||||||
// console.log('Request Response: ', response)
|
console.log('Request Response: ', response)
|
||||||
// console.log(new Types.AxiosSuccess(response.data, response.status))
|
// console.log(new Types.AxiosSuccess(response.data, response.status))
|
||||||
|
|
||||||
const setAuthToken = (path === '/updatepwd')
|
const setAuthToken = (path === '/updatepwd')
|
||||||
@@ -109,7 +109,7 @@ async function Request(type: string, path: string, payload: any, setAuthToken?:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
GlobalStore.state.connData.uploading_server = (GlobalStore.state.connData.uploading_server === 1) ? -1 : GlobalStore.state.connData.uploading_server
|
GlobalStore.state.connData.uploading_server = (GlobalStore.state.connData.uploading_server === 1) ? -1 : GlobalStore.state.connData.uploading_server
|
||||||
GlobalStore.state.connData.downloading_server = (GlobalStore.state.connData.downloading_server === 1) ? -1 : GlobalStore.state.connData.downloading_server
|
GlobalStore.state.connData.downloading_server = (GlobalStore.state.connData.downloading_server === 1) ? -1 : GlobalStore.state.connData.downloading_server
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import router from '@router'
|
|||||||
import * as Types from '@src/store/Api/ApiTypes'
|
import * as Types from '@src/store/Api/ApiTypes'
|
||||||
import { costanti } from '@src/store/Modules/costanti'
|
import { costanti } from '@src/store/Modules/costanti'
|
||||||
|
|
||||||
|
|
||||||
// const algoliaApi = new AlgoliaSearch()
|
// const algoliaApi = new AlgoliaSearch()
|
||||||
export namespace ApiTool {
|
export namespace ApiTool {
|
||||||
export async function post(path: string, payload?: any) {
|
export async function post(path: string, payload?: any) {
|
||||||
@@ -57,7 +56,7 @@ export namespace ApiTool {
|
|||||||
refresh_token
|
refresh_token
|
||||||
}, {
|
}, {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Bearer ${token}`
|
Authorization: `Bearer ${token}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -65,23 +64,22 @@ export namespace ApiTool {
|
|||||||
export async function SendReq(url: string, method: string, mydata: any, setAuthToken: boolean = false): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
export async function SendReq(url: string, method: string, mydata: any, setAuthToken: boolean = false): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||||
UserStore.mutations.setServerCode(tools.EMPTY)
|
UserStore.mutations.setServerCode(tools.EMPTY)
|
||||||
UserStore.mutations.setResStatus(0)
|
UserStore.mutations.setResStatus(0)
|
||||||
return await new Promise(function (resolve, reject) {
|
return await new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
|
||||||
return sendRequest(url, method, mydata)
|
return sendRequest(url, method, mydata)
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
// console.log('res', res)
|
// console.log('res', res)
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
if (method === 'get')
|
if (method === 'get') {
|
||||||
GlobalStore.state.connData.downloading_server = 0
|
GlobalStore.state.connData.downloading_server = 0
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
GlobalStore.state.connData.uploading_server = 0
|
GlobalStore.state.connData.uploading_server = 0
|
||||||
GlobalStore.state.connData.downloading_server = 0
|
GlobalStore.state.connData.downloading_server = 0
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
|
|
||||||
UserStore.mutations.setResStatus(res.status)
|
UserStore.mutations.setResStatus(res.status)
|
||||||
if (res.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
|
if (res.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN) {
|
||||||
// Forbidden
|
// Forbidden
|
||||||
@@ -95,10 +93,11 @@ export namespace ApiTool {
|
|||||||
return resolve(res)
|
return resolve(res)
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
if (method === 'get')
|
if (method === 'get') {
|
||||||
GlobalStore.state.connData.downloading_server = -1
|
GlobalStore.state.connData.downloading_server = -1
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
GlobalStore.state.connData.uploading_server = -1
|
GlobalStore.state.connData.uploading_server = -1
|
||||||
GlobalStore.state.connData.downloading_server = -1
|
GlobalStore.state.connData.downloading_server = -1
|
||||||
@@ -114,13 +113,13 @@ export namespace ApiTool {
|
|||||||
export async function syncAlternative(mystrparam) {
|
export async function syncAlternative(mystrparam) {
|
||||||
// console.log('[ALTERNATIVE Background syncing', mystrparam)
|
// console.log('[ALTERNATIVE Background syncing', mystrparam)
|
||||||
|
|
||||||
let multiparams = mystrparam.split('|')
|
const multiparams = mystrparam.split('|')
|
||||||
if (multiparams) {
|
if (multiparams) {
|
||||||
if (multiparams.length > 3) {
|
if (multiparams.length > 3) {
|
||||||
let cmd = multiparams[0]
|
const cmd = multiparams[0]
|
||||||
let table = multiparams[1]
|
const table = multiparams[1]
|
||||||
let method = multiparams[2]
|
const method = multiparams[2]
|
||||||
let token = multiparams[3]
|
const token = multiparams[3]
|
||||||
// let lang = multiparams[3]
|
// let lang = multiparams[3]
|
||||||
|
|
||||||
if (cmd === 'sync-todos') {
|
if (cmd === 'sync-todos') {
|
||||||
@@ -136,17 +135,18 @@ export namespace ApiTool {
|
|||||||
|
|
||||||
// console.log('A1) INIZIO.............................................................')
|
// console.log('A1) INIZIO.............................................................')
|
||||||
return globalroutines(null, 'readall', table, null)
|
return globalroutines(null, 'readall', table, null)
|
||||||
.then(function (alldata) {
|
.then((alldata) => {
|
||||||
const myrecs = [...alldata]
|
const myrecs = [...alldata]
|
||||||
// console.log('----------------------- LEGGO QUALCOSA ')
|
// console.log('----------------------- LEGGO QUALCOSA ')
|
||||||
|
|
||||||
const promises = myrecs.map(rec => {
|
const promises = myrecs.map((rec) => {
|
||||||
// console.log('syncing', table, '', rec.descr)
|
// console.log('syncing', table, '', rec.descr)
|
||||||
// let link = String(process.env.MONGODB_HOST) + '/todos'
|
// let link = String(process.env.MONGODB_HOST) + '/todos'
|
||||||
let link = '/todos'
|
let link = '/todos'
|
||||||
|
|
||||||
if (method !== 'POST')
|
if (method !== 'POST') {
|
||||||
link += '/' + rec._id
|
link += '/' + rec._id
|
||||||
|
}
|
||||||
|
|
||||||
// console.log(' [Alternative] ++++++++++++++++++ SYNCING !!!! ', rec.descr, table, 'FETCH: ', method, link, 'data:')
|
// console.log(' [Alternative] ++++++++++++++++++ SYNCING !!!! ', rec.descr, table, 'FETCH: ', method, link, 'data:')
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ export namespace ApiTool {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
return globalroutines(null, 'delete', 'swmsg', null, mystrparam)
|
return globalroutines(null, 'delete', 'swmsg', null, mystrparam)
|
||||||
})
|
})
|
||||||
.catch(function (err) {
|
.catch((err) => {
|
||||||
if (err.message === 'Failed to fetch') {
|
if (err.message === 'Failed to fetch') {
|
||||||
errorfromserver = true
|
errorfromserver = true
|
||||||
}
|
}
|
||||||
@@ -177,11 +177,11 @@ export namespace ApiTool {
|
|||||||
// CALL ALL THE PROMISES
|
// CALL ALL THE PROMISES
|
||||||
return Promise.all(promises).then(() => {
|
return Promise.all(promises).then(() => {
|
||||||
return (errorfromserver && !lettoqualcosa)
|
return (errorfromserver && !lettoqualcosa)
|
||||||
}).catch(err => {
|
}).catch((err) => {
|
||||||
return (errorfromserver && !lettoqualcosa)
|
return (errorfromserver && !lettoqualcosa)
|
||||||
})
|
})
|
||||||
|
|
||||||
}).catch(e => {
|
}).catch((e) => {
|
||||||
// console.log('ERROR:', e)
|
// console.log('ERROR:', e)
|
||||||
return (errorfromserver && !lettoqualcosa)
|
return (errorfromserver && !lettoqualcosa)
|
||||||
})
|
})
|
||||||
@@ -200,6 +200,5 @@ export namespace ApiTool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
export default ApiTool
|
export default ApiTool
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ namespace Getters {
|
|||||||
routes: [
|
routes: [
|
||||||
{ route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home' },
|
{ route: '/', faIcon: 'fa fa-home', materialIcon: 'home', name: 'pages.home' },
|
||||||
{
|
{
|
||||||
route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'todo', name: 'pages.Todo',
|
route: '/todo', faIcon: 'fa fa-list-alt', materialIcon: 'format_list_numbered', name: 'pages.Todo',
|
||||||
routes2: listatodo
|
routes2: listatodo
|
||||||
},
|
},
|
||||||
{ route: '/category', faIcon: 'fa fa-list-alt', materialIcon: 'category', name: 'pages.Category' }
|
{ route: '/category', faIcon: 'fa fa-list-alt', materialIcon: 'category', name: 'pages.Category' }
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ const state: IUserState = {
|
|||||||
isAdmin: false
|
isAdmin: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const b = storeBuilder.module<IUserState>('UserModule', state)
|
const b = storeBuilder.module<IUserState>('UserModule', state)
|
||||||
const stateGetter = b.state()
|
const stateGetter = b.state()
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ namespace Getters {
|
|||||||
// return state.userInfos.firstname?capitalize(state.userInfos.firstname) + " " + capitalize(state.userInfos.lastname):null;
|
// return state.userInfos.firstname?capitalize(state.userInfos.firstname) + " " + capitalize(state.userInfos.lastname):null;
|
||||||
// })
|
// })
|
||||||
|
|
||||||
const lang = b.read(state => {
|
const lang = b.read((state) => {
|
||||||
if (state.lang !== '') {
|
if (state.lang !== '') {
|
||||||
return state.lang
|
return state.lang
|
||||||
} else {
|
} else {
|
||||||
@@ -60,11 +59,11 @@ namespace Getters {
|
|||||||
// }
|
// }
|
||||||
// }, 'tok')
|
// }, 'tok')
|
||||||
|
|
||||||
const isServerError = b.read(state => {
|
const isServerError = b.read((state) => {
|
||||||
return (state.servercode === tools.ERR_SERVERFETCH)
|
return (state.servercode === tools.ERR_SERVERFETCH)
|
||||||
}, 'isServerError')
|
}, 'isServerError')
|
||||||
|
|
||||||
const getServerCode = b.read(state => {
|
const getServerCode = b.read((state) => {
|
||||||
return state.servercode
|
return state.servercode
|
||||||
}, 'getServerCode')
|
}, 'getServerCode')
|
||||||
|
|
||||||
@@ -84,27 +83,27 @@ namespace Getters {
|
|||||||
// get fullName() { return fullName();},
|
// get fullName() { return fullName();},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace Mutations {
|
namespace Mutations {
|
||||||
function authUser(state: IUserState, data: IUserState ) {
|
function authUser(state: IUserState, data: IUserState ) {
|
||||||
state.userId = data.userId
|
state.userId = data.userId
|
||||||
state.username = data.username
|
state.username = data.username
|
||||||
if (data.verified_email)
|
if (data.verified_email) {
|
||||||
state.verified_email = data.verified_email
|
state.verified_email = data.verified_email
|
||||||
|
}
|
||||||
|
|
||||||
if (data.categorySel)
|
if (data.categorySel) {
|
||||||
state.categorySel = data.categorySel // ??
|
state.categorySel = data.categorySel
|
||||||
|
} // ??
|
||||||
|
|
||||||
resetArrToken(state.tokens)
|
resetArrToken(state.tokens)
|
||||||
state.tokens.push({ access: 'auth', token: state.x_auth_token, data_login: new Date() })
|
state.tokens.push({ access: 'auth', token: state.x_auth_token, data_login: new Date() })
|
||||||
|
|
||||||
// ++Todo: Settings Users Admin
|
// ++Todo: Settings Users Admin
|
||||||
if (state.username === 'paoloar77')
|
if (state.username === 'paoloar77') {
|
||||||
state.isAdmin = true
|
state.isAdmin = true
|
||||||
|
}
|
||||||
|
|
||||||
// console.log('state.tokens', state.tokens)
|
// console.log('state.tokens', state.tokens)
|
||||||
}
|
}
|
||||||
@@ -144,7 +143,6 @@ namespace Mutations {
|
|||||||
state.x_auth_token = x_auth_token
|
state.x_auth_token = x_auth_token
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function resetArrToken(arrtokens) {
|
function resetArrToken(arrtokens) {
|
||||||
if (!arrtokens.tokens) {
|
if (!arrtokens.tokens) {
|
||||||
arrtokens.tokens = []
|
arrtokens.tokens = []
|
||||||
@@ -165,7 +163,6 @@ namespace Mutations {
|
|||||||
state.categorySel = 'personal'
|
state.categorySel = 'personal'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function setErrorCatch(state: IUserState, axerr: Types.AxiosError) {
|
function setErrorCatch(state: IUserState, axerr: Types.AxiosError) {
|
||||||
if (state.servercode !== tools.ERR_SERVERFETCH) {
|
if (state.servercode !== tools.ERR_SERVERFETCH) {
|
||||||
state.servercode = axerr.getCode()
|
state.servercode = axerr.getCode()
|
||||||
@@ -192,7 +189,6 @@ namespace Mutations {
|
|||||||
return msgerrore
|
return msgerrore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const mutations = {
|
export const mutations = {
|
||||||
authUser: b.commit(authUser),
|
authUser: b.commit(authUser),
|
||||||
setpassword: b.commit(setpassword),
|
setpassword: b.commit(setpassword),
|
||||||
@@ -207,7 +203,6 @@ namespace Mutations {
|
|||||||
getMsgError: b.commit(getMsgError)
|
getMsgError: b.commit(getMsgError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Actions {
|
namespace Actions {
|
||||||
@@ -237,7 +232,7 @@ namespace Actions {
|
|||||||
Mutations.mutations.setServerCode(tools.CALLING)
|
Mutations.mutations.setServerCode(tools.CALLING)
|
||||||
|
|
||||||
return await Api.SendReq('/updatepwd', 'POST', usertosend, true)
|
return await Api.SendReq('/updatepwd', 'POST', usertosend, true)
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
return { code: res.data.code, msg: res.data.msg }
|
return { code: res.data.code, msg: res.data.msg }
|
||||||
})
|
})
|
||||||
.catch((error: Types.AxiosError) => {
|
.catch((error: Types.AxiosError) => {
|
||||||
@@ -249,7 +244,7 @@ namespace Actions {
|
|||||||
|
|
||||||
async function requestpwd(context, paramquery: IUserState) {
|
async function requestpwd(context, paramquery: IUserState) {
|
||||||
|
|
||||||
let usertosend = {
|
const usertosend = {
|
||||||
keyappid: process.env.PAO_APP_ID,
|
keyappid: process.env.PAO_APP_ID,
|
||||||
idapp: process.env.APP_ID,
|
idapp: process.env.APP_ID,
|
||||||
email: paramquery.email
|
email: paramquery.email
|
||||||
@@ -259,7 +254,7 @@ namespace Actions {
|
|||||||
Mutations.mutations.setServerCode(tools.CALLING)
|
Mutations.mutations.setServerCode(tools.CALLING)
|
||||||
|
|
||||||
return await Api.SendReq('/requestnewpwd', 'POST', usertosend)
|
return await Api.SendReq('/requestnewpwd', 'POST', usertosend)
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
return { code: res.data.code, msg: res.data.msg }
|
return { code: res.data.code, msg: res.data.msg }
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
UserStore.mutations.setErrorCatch(error)
|
UserStore.mutations.setErrorCatch(error)
|
||||||
@@ -269,7 +264,7 @@ namespace Actions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function vreg(context, paramquery: ILinkReg) {
|
async function vreg(context, paramquery: ILinkReg) {
|
||||||
let usertosend = {
|
const usertosend = {
|
||||||
keyappid: process.env.PAO_APP_ID,
|
keyappid: process.env.PAO_APP_ID,
|
||||||
idapp: process.env.APP_ID,
|
idapp: process.env.APP_ID,
|
||||||
idlink: paramquery.idlink
|
idlink: paramquery.idlink
|
||||||
@@ -279,7 +274,7 @@ namespace Actions {
|
|||||||
Mutations.mutations.setServerCode(tools.CALLING)
|
Mutations.mutations.setServerCode(tools.CALLING)
|
||||||
|
|
||||||
return await Api.SendReq('/vreg', 'POST', usertosend)
|
return await Api.SendReq('/vreg', 'POST', usertosend)
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
// console.log("RITORNO 2 ");
|
// console.log("RITORNO 2 ");
|
||||||
// mutations.setServerCode(myres);
|
// mutations.setServerCode(myres);
|
||||||
if (res.data.code === serv_constants.RIS_CODE_EMAIL_VERIFIED) {
|
if (res.data.code === serv_constants.RIS_CODE_EMAIL_VERIFIED) {
|
||||||
@@ -300,12 +295,12 @@ namespace Actions {
|
|||||||
|
|
||||||
// console.log("PASSW: " + authData.password);
|
// console.log("PASSW: " + authData.password);
|
||||||
|
|
||||||
let mylang = state.lang
|
const mylang = state.lang
|
||||||
console.log('MYLANG: ' + mylang)
|
console.log('MYLANG: ' + mylang)
|
||||||
|
|
||||||
return bcrypt.hash(authData.password, bcrypt.genSaltSync(12))
|
return bcrypt.hash(authData.password, bcrypt.genSaltSync(12))
|
||||||
.then((hashedPassword: string) => {
|
.then((hashedPassword: string) => {
|
||||||
let usertosend = {
|
const usertosend = {
|
||||||
keyappid: process.env.PAO_APP_ID,
|
keyappid: process.env.PAO_APP_ID,
|
||||||
lang: mylang,
|
lang: mylang,
|
||||||
email: authData.email,
|
email: authData.email,
|
||||||
@@ -319,7 +314,7 @@ namespace Actions {
|
|||||||
Mutations.mutations.setServerCode(tools.CALLING)
|
Mutations.mutations.setServerCode(tools.CALLING)
|
||||||
|
|
||||||
return Api.SendReq('/users', 'POST', usertosend)
|
return Api.SendReq('/users', 'POST', usertosend)
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
|
|
||||||
const newuser = res.data
|
const newuser = res.data
|
||||||
|
|
||||||
@@ -328,8 +323,8 @@ namespace Actions {
|
|||||||
Mutations.mutations.setServerCode(res.status)
|
Mutations.mutations.setServerCode(res.status)
|
||||||
|
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
let userId = newuser._id
|
const userId = newuser._id
|
||||||
let username = authData.username
|
const username = authData.username
|
||||||
if (process.env.DEV) {
|
if (process.env.DEV) {
|
||||||
console.log('USERNAME = ' + username)
|
console.log('USERNAME = ' + username)
|
||||||
console.log('IDUSER= ' + userId)
|
console.log('IDUSER= ' + userId)
|
||||||
@@ -376,12 +371,12 @@ namespace Actions {
|
|||||||
try {
|
try {
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
sub = await navigator.serviceWorker.ready
|
sub = await navigator.serviceWorker.ready
|
||||||
.then(function (swreg) {
|
.then(function(swreg) {
|
||||||
console.log('swreg')
|
console.log('swreg')
|
||||||
let sub = swreg.pushManager.getSubscription()
|
const sub = swreg.pushManager.getSubscription()
|
||||||
return sub
|
return sub
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch((e) => {
|
||||||
sub = null
|
sub = null
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -406,8 +401,9 @@ namespace Actions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// console.log('PASSO 4')
|
// console.log('PASSO 4')
|
||||||
if (process.env.DEBUG === '1')
|
if (process.env.DEBUG === '1') {
|
||||||
console.log(usertosend)
|
console.log(usertosend)
|
||||||
|
}
|
||||||
|
|
||||||
Mutations.mutations.setServerCode(tools.CALLING)
|
Mutations.mutations.setServerCode(tools.CALLING)
|
||||||
|
|
||||||
@@ -416,7 +412,7 @@ namespace Actions {
|
|||||||
console.log('Api.SendReq')
|
console.log('Api.SendReq')
|
||||||
|
|
||||||
return Api.SendReq('/users/login', 'POST', usertosend, true)
|
return Api.SendReq('/users/login', 'POST', usertosend, true)
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
myres = res
|
myres = res
|
||||||
|
|
||||||
if (myres.status !== 200) {
|
if (myres.status !== 200) {
|
||||||
@@ -424,16 +420,16 @@ namespace Actions {
|
|||||||
}
|
}
|
||||||
return myres
|
return myres
|
||||||
|
|
||||||
}).then(res => {
|
}).then((res) => {
|
||||||
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
GlobalStore.mutations.SetwasAlreadySubOnDb(res.data.subsExistonDb)
|
GlobalStore.mutations.SetwasAlreadySubOnDb(res.data.subsExistonDb)
|
||||||
|
|
||||||
let myuser: IUserState = res.data.usertosend
|
const myuser: IUserState = res.data.usertosend
|
||||||
if (myuser) {
|
if (myuser) {
|
||||||
let userId = myuser.userId
|
const userId = myuser.userId
|
||||||
let username = authData.username
|
const username = authData.username
|
||||||
let verified_email = myuser.verified_email
|
const verified_email = myuser.verified_email
|
||||||
|
|
||||||
Mutations.mutations.authUser({
|
Mutations.mutations.authUser({
|
||||||
userId,
|
userId,
|
||||||
@@ -458,7 +454,7 @@ namespace Actions {
|
|||||||
|
|
||||||
return tools.OK
|
return tools.OK
|
||||||
|
|
||||||
}).then(code => {
|
}).then((code) => {
|
||||||
if (code === tools.OK) {
|
if (code === tools.OK) {
|
||||||
return setGlobal(true)
|
return setGlobal(true)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -491,14 +487,14 @@ namespace Actions {
|
|||||||
|
|
||||||
await GlobalStore.actions.clearDataAfterLogout()
|
await GlobalStore.actions.clearDataAfterLogout()
|
||||||
|
|
||||||
let usertosend = {
|
const usertosend = {
|
||||||
keyappid: process.env.PAO_APP_ID,
|
keyappid: process.env.PAO_APP_ID,
|
||||||
idapp: process.env.APP_ID
|
idapp: process.env.APP_ID
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(usertosend)
|
console.log(usertosend)
|
||||||
const riscall = await Api.SendReq('/users/me/token', 'DELETE', usertosend)
|
const riscall = await Api.SendReq('/users/me/token', 'DELETE', usertosend)
|
||||||
.then(res => {
|
.then((res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
Mutations.mutations.clearAuthData()
|
Mutations.mutations.clearAuthData()
|
||||||
@@ -525,7 +521,6 @@ namespace Actions {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function autologin_FromLocalStorage(context) {
|
async function autologin_FromLocalStorage(context) {
|
||||||
try {
|
try {
|
||||||
// console.log('*** autologin_FromLocalStorage ***')
|
// console.log('*** autologin_FromLocalStorage ***')
|
||||||
@@ -538,7 +533,7 @@ namespace Actions {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
const expirationDateStr = localStorage.getItem(tools.localStorage.expirationDate)
|
const expirationDateStr = localStorage.getItem(tools.localStorage.expirationDate)
|
||||||
let expirationDate = new Date(String(expirationDateStr))
|
const expirationDate = new Date(String(expirationDateStr))
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
if (now >= expirationDate) {
|
if (now >= expirationDate) {
|
||||||
console.log('!!! Login Expired')
|
console.log('!!! Login Expired')
|
||||||
@@ -571,7 +566,6 @@ namespace Actions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
autologin_FromLocalStorage: b.dispatch(autologin_FromLocalStorage),
|
autologin_FromLocalStorage: b.dispatch(autologin_FromLocalStorage),
|
||||||
logout: b.dispatch(logout),
|
logout: b.dispatch(logout),
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
.mypanel {
|
|
||||||
padding:10px;
|
|
||||||
margin: 10px;
|
|
||||||
|
|
||||||
}
|
|
||||||
11
src/views/login/vreg/vreg.scss
Normal file
11
src/views/login/vreg/vreg.scss
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
.mypanel {
|
||||||
|
padding: 10px;
|
||||||
|
margin: 10px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.mybanner {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
@@ -5,21 +5,21 @@ import { UserStore } from '@store'
|
|||||||
|
|
||||||
import { serv_constants } from '../../../store/Modules/serv_constants'
|
import { serv_constants } from '../../../store/Modules/serv_constants'
|
||||||
|
|
||||||
import './vreg.css'
|
import './vreg.scss'
|
||||||
import { ILinkReg } from '../../../model/other'
|
import { ILinkReg } from '../../../model/other'
|
||||||
|
|
||||||
@Component({})
|
@Component({})
|
||||||
export default class Vreg extends Vue {
|
export default class Vreg extends Vue {
|
||||||
public risultato: string = '---'
|
public risultato: string = '---'
|
||||||
public riscode: number = 0
|
public riscode: number = 0
|
||||||
$t: any
|
public $t: any
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
console.log('Vreg constructor...')
|
console.log('Vreg constructor...')
|
||||||
}
|
}
|
||||||
|
|
||||||
created() {
|
public created() {
|
||||||
console.log('vreg created')
|
console.log('vreg created')
|
||||||
this.load()
|
this.load()
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ export default class Vreg extends Vue {
|
|||||||
return this.riscode === serv_constants.RIS_CODE_EMAIL_VERIFIED
|
return this.riscode === serv_constants.RIS_CODE_EMAIL_VERIFIED
|
||||||
}
|
}
|
||||||
|
|
||||||
load() {
|
public load() {
|
||||||
// console.log('load')
|
// console.log('load')
|
||||||
let param: ILinkReg
|
let param: ILinkReg
|
||||||
param = { idlink: this.$route.query.idlink.toString() }
|
param = { idlink: this.$route.query.idlink.toString() }
|
||||||
@@ -45,8 +45,7 @@ export default class Vreg extends Vue {
|
|||||||
.then((ris) => {
|
.then((ris) => {
|
||||||
this.riscode = ris.code
|
this.riscode = ris.code
|
||||||
this.risultato = ris.msg
|
this.risultato = ris.msg
|
||||||
console.log('RIS = ')
|
console.log('RIS = ', ris)
|
||||||
console.log(ris)
|
|
||||||
|
|
||||||
if (this.verificatook) {
|
if (this.verificatook) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
@@ -1,30 +1,37 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-page padding class="vreg">
|
<q-page padding class="vreg">
|
||||||
<div class="mypanel">
|
<div class="q-pa-md q-gutter-sm">
|
||||||
<q-banner color="primary q-title" style="text-align: center;">
|
<q-banner
|
||||||
|
rounded
|
||||||
|
class="bg-primary text-white"
|
||||||
|
color="primary q-title"
|
||||||
|
style="text-align: center;">
|
||||||
{{ $t('reg.title_verif_reg')}}
|
{{ $t('reg.title_verif_reg')}}
|
||||||
</q-banner>
|
</q-banner>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<transition
|
<transition
|
||||||
enter-active-class="animated flipInX"
|
enter-active-class="animated fadeIn"
|
||||||
leave-active-class="animated flipOutX"
|
leave-active-class="animated fadeOut"
|
||||||
appear
|
appear
|
||||||
|
|
||||||
>
|
>
|
||||||
<span>
|
|
||||||
<q-banner
|
<q-banner
|
||||||
|
rounded
|
||||||
|
class="bg-warning text-black"
|
||||||
|
style="text-align: center;"
|
||||||
v-if="giaverificato"
|
v-if="giaverificato"
|
||||||
type="warning"
|
|
||||||
>
|
>
|
||||||
{{ myrisultato}}
|
<span class="mybanner">{{ myrisultato}}</span>
|
||||||
</q-banner>
|
</q-banner>
|
||||||
<q-banner
|
<q-banner
|
||||||
|
class="bg-positive text-white"
|
||||||
|
style="text-align: center;"
|
||||||
|
rounded
|
||||||
v-if="verificatook"
|
v-if="verificatook"
|
||||||
type="positive"
|
|
||||||
>
|
>
|
||||||
{{ myrisultato}}
|
<span class="mybanner">{{ myrisultato}}</span>
|
||||||
</q-banner>
|
</q-banner>
|
||||||
</span>
|
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user