Se errore di connessione al Server: compare l'username telegram !
Se Cookie disattivati: non riesci a loggare.
sui Gruppi: non si vede il Comune !
Sei stato accettato da paoloar77 a far parte del Gruppo Terraw. MSG SBAGLIATO
l'immagine dell'amministratore del gruppo non compariva
This commit is contained in:
Paolo Arena
2022-03-30 22:48:08 +02:00
parent 1b090fd75b
commit 9448797fe3
18 changed files with 64 additions and 24 deletions

View File

@@ -84,11 +84,11 @@ async function Request(type: string, path: string, payload: any): Promise<Types.
}
if (setAuthToken) {
userStore.UpdatePwd(x_auth_token)
tools.localStSetItem(toolsext.localStorage.token, x_auth_token)
localStorage.setItem(toolsext.localStorage.token, x_auth_token)
}
userStore.setAuth(x_auth_token)
tools.localStSetItem(toolsext.localStorage.token, x_auth_token)
localStorage.setItem(toolsext.localStorage.token, x_auth_token)
}
globalStore.setStateConnection(ricevuto ? 'online' : 'offline')

View File

@@ -670,7 +670,7 @@ export const colmyGoods = [
fieldtype: costanti.FieldType.string,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
noshowlabel: true,
maxlength: 90,
maxlength: 120,
required: true,
sortable: false,
}),
@@ -837,7 +837,7 @@ export const colmySkills = [
fieldtype: costanti.FieldType.string,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
noshowlabel: true,
maxlength: 90,
maxlength: 120,
required: true,
sortable: false,
}),
@@ -1010,7 +1010,7 @@ export const colmyBachecas = [
fieldtype: costanti.FieldType.string,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
noshowlabel: true,
maxlength: 90,
maxlength: 120,
required: true,
sortable: false,
}),

View File

@@ -3364,6 +3364,10 @@ export const tools = {
localStorage.setItem(item, value)
},
localStReal(item: string, value : string) {
localStorage.setItem(item, value)
},
setCookie(mytok: any, value: string) {
// console.log('setCookie', mytok, value)
if (localStorage.getItem('cookie-id') === 'decline')
@@ -4138,8 +4142,9 @@ export const tools = {
isLogged() {
const userStore = useUserStore()
const globalStore = useGlobalStore()
if (!!userStore)
return userStore.isLogged
return userStore.isLogged && !globalStore.serverError
else
return false
},

View File

@@ -540,8 +540,8 @@ export const useUserStore = defineStore('UserStore', {
tools.localStSetItem(toolsext.localStorage.perm, String(myuser.perm) || '')
if (myuser.profile !== undefined) tools.localStSetItem(toolsext.localStorage.img, (myuser.profile.img) ? String(myuser.profile.img) || '' : '')
else tools.localStSetItem(toolsext.localStorage.img, '')
tools.localStSetItem(toolsext.localStorage.token, this.x_auth_token)
tools.localStSetItem(toolsext.localStorage.expirationDate, expirationDate.toString())
localStorage.setItem(toolsext.localStorage.token, this.x_auth_token)
localStorage.setItem(toolsext.localStorage.expirationDate, expirationDate.toString())
tools.localStSetItem(toolsext.localStorage.isLogged, String(true))
tools.localStSetItem(toolsext.localStorage.verified_email, String(myuser.verified_email))
tools.localStSetItem(toolsext.localStorage.verified_by_aportador, String(myuser.verified_by_aportador))
@@ -600,8 +600,8 @@ export const useUserStore = defineStore('UserStore', {
tools.localStSetItem(toolsext.localStorage.username, newuser.username)
tools.localStSetItem(toolsext.localStorage.name, newuser.name)
tools.localStSetItem(toolsext.localStorage.surname, newuser.surname)
tools.localStSetItem(toolsext.localStorage.token, this.x_auth_token)
tools.localStSetItem(toolsext.localStorage.expirationDate, expirationDate.toString())
localStorage.setItem(toolsext.localStorage.token, this.x_auth_token)
localStorage.setItem(toolsext.localStorage.expirationDate, expirationDate.toString())
tools.localStSetItem(toolsext.localStorage.verified_email, String(false))
tools.localStSetItem(toolsext.localStorage.verified_by_aportador, String(false))
@@ -815,6 +815,8 @@ export const useUserStore = defineStore('UserStore', {
this.isLogged = isok && isLogged
console.log('this.isLogged', this.isLogged, 'isok', isok, 'isLogged', isLogged)
if (static_data.functionality.ENABLE_TODOS_LOADING)
await todos.dbLoad({ checkPending: true })
@@ -842,7 +844,7 @@ export const useUserStore = defineStore('UserStore', {
try {
const globalStore = useGlobalStore()
// console.log('*** autologin_FromLocalStorage ***')
console.log('*** autologin_FromLocalStorage ***')
// INIT
let isLogged = false
@@ -850,7 +852,23 @@ export const useUserStore = defineStore('UserStore', {
this.lang = tools.getItemLS(toolsext.localStorage.lang)
const token = localStorage.getItem(toolsext.localStorage.token)
if (token) {
const expirationDateStr = localStorage.getItem(toolsext.localStorage.expirationDate)
const expirationDate = new Date(String(expirationDateStr))
const now = tools.getDateNow()
if (now < expirationDate) {
this.setAuth(token)
isLogged = true
} else {
// ++ ?? che fare qui
}
} else {
isLogged = tools.isLogged()
}
/*if (token) {
const expirationDateStr = localStorage.getItem(toolsext.localStorage.expirationDate)
const expirationDate = new Date(String(expirationDateStr))
const now = tools.getDateNow()
@@ -900,7 +918,9 @@ export const useUserStore = defineStore('UserStore', {
isLogged = true
}
}
}*/
return await this.setGlobal($router, isLogged)
.then((loadstorage: any) => {

View File

@@ -1327,17 +1327,21 @@ export const useGlobalStore = defineStore('GlobalStore', {
this.mypage = (res.data.mypage) ? [...res.data.mypage] : []
}
let isLogged = false
// console.log('res.data.myuser', res.data.myuser)
if (res.data.myuser) {
userStore.authUser(res.data.myuser)
userStore.updateLocalStorage(res.data.myuser)
isLogged = !!res.data.myuser.username
} else {
// User not exist !!
}
const isLogged = localStorage.getItem(toolsext.localStorage.username)
// const isLogged = localStorage.getItem(toolsext.localStorage.username)
console.log('isLogged', isLogged)
// calendarStore.editable = userStore.isAdmin || userStore.isManager || userStore.isTutor