fix creation/auth process
This commit is contained in:
183
wco/apx/apx.js
183
wco/apx/apx.js
@@ -336,64 +336,7 @@ apx.wcoobserver = () => {
|
|||||||
e.setAttribute("wco-name", wconame);
|
e.setAttribute("wco-name", wconame);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
apx.managecontext = () => {
|
||||||
// State management
|
|
||||||
apx.save = () => {
|
|
||||||
localStorage.setItem(apx.data.headers.xapp, JSON.stringify(apx.data));
|
|
||||||
};
|
|
||||||
apx.update = async () => {
|
|
||||||
if (!apxtri) {
|
|
||||||
console.log(
|
|
||||||
'Please add to the html page header, this line const apxtri = { headers: { xtrkversion: 1, xtribe: "smatchit", xapp: "pwa", xlang: "fr", xalias: "anonymous", xhash: "anonymous", xdays: 0} ,pagename:"apxid"} '
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//if (apxtri.forcereload){localStorage.setItem("forcereload",true)};
|
|
||||||
if (document.querySelector("html").getAttribute("lang")) {
|
|
||||||
apxtri.headers.xlang = document.querySelector("html").getAttribute("lang");
|
|
||||||
}
|
|
||||||
//alert(localStorage.getItem(apxtri.headers.xapp))
|
|
||||||
if (localStorage.getItem(apxtri.headers.xapp)) {
|
|
||||||
apx.data = JSON.parse(localStorage.getItem(apxtri.headers.xapp));
|
|
||||||
//update with current pagename and eventualy pageauth
|
|
||||||
apx.data.pagename = apxtri.pagename;
|
|
||||||
if (apxtri.pageauth) apx.data.pageauth = apxtri.pageauth;
|
|
||||||
// check localstorage in line with current webpage
|
|
||||||
if (
|
|
||||||
apx.data.headers.xtribe != apxtri.headers.xtribe ||
|
|
||||||
apx.data.headers.xlang != apxtri.headers.xlang ||
|
|
||||||
apx.data.headers.xtrkversion != apxtri.headers.xtrkversion
|
|
||||||
) {
|
|
||||||
// if an app change of tribe
|
|
||||||
localStorage.removeItem(apxtri.headers.xapp);
|
|
||||||
delete apx.data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!apx.data) {
|
|
||||||
console.log("init or reinit apx.data");
|
|
||||||
apx.data = apxtri;
|
|
||||||
}
|
|
||||||
apx.pagecontext = { search: {}, hash: {} };
|
|
||||||
if (window.location.hash != "") {
|
|
||||||
window.location.hash
|
|
||||||
.slice(1)
|
|
||||||
.split("&")
|
|
||||||
.forEach((kv) => {
|
|
||||||
const keyval = kv.split("=");
|
|
||||||
apx.pagecontext.hash[keyval[0]] = keyval[1];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (window.location.search != "") {
|
|
||||||
window.location.search
|
|
||||||
.slice(1)
|
|
||||||
.split("&")
|
|
||||||
.forEach((kv) => {
|
|
||||||
const keyval = kv.split("=");
|
|
||||||
apx.pagecontext.hash[keyval[0]] = keyval[1];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
console.log("apx.pagecontext:", apx.pagecontext);
|
|
||||||
|
|
||||||
// Set authenticate parameter if in pagecontext and redirect to the requested url
|
// Set authenticate parameter if in pagecontext and redirect to the requested url
|
||||||
console.log(
|
console.log(
|
||||||
apx.pagecontext.hash.xdays,
|
apx.pagecontext.hash.xdays,
|
||||||
@@ -413,17 +356,12 @@ apx.update = async () => {
|
|||||||
) {
|
) {
|
||||||
//Means this page is called from an external auth app
|
//Means this page is called from an external auth app
|
||||||
let headervalid = true;
|
let headervalid = true;
|
||||||
const headerkey = [
|
|
||||||
"xalias",
|
|
||||||
"xhash",
|
|
||||||
"xdays",
|
|
||||||
"xprofils",
|
|
||||||
"xtribe",
|
|
||||||
"xlang",
|
|
||||||
];
|
|
||||||
headerkey.forEach((h) => {
|
headerkey.forEach((h) => {
|
||||||
if (apx.pagecontext.hash[h]) {
|
if (apx.pagecontext.hash[h]) {
|
||||||
apx.data.headers[h] = (h==="xprofils")? apx.pagecontext.hash[h].split(","):apx.pagecontext.hash[h];
|
apx.data.headers[h] =
|
||||||
|
h === "xprofils"
|
||||||
|
? apx.pagecontext.hash[h].split(",")
|
||||||
|
: apx.pagecontext.hash[h];
|
||||||
} else {
|
} else {
|
||||||
headervalid = false;
|
headervalid = false;
|
||||||
}
|
}
|
||||||
@@ -438,6 +376,85 @@ apx.update = async () => {
|
|||||||
console.log("Your try to access a page failled with ", apx.pagecontext);
|
console.log("Your try to access a page failled with ", apx.pagecontext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
// State management
|
||||||
|
apx.save = () => {
|
||||||
|
localStorage.setItem(apx.data.headers.xapp, JSON.stringify(apx.data));
|
||||||
|
};
|
||||||
|
apx.update = async () => {
|
||||||
|
if (!apxtri || !apxtri.headers || !apxtri.headers.xapp) {
|
||||||
|
console.log(
|
||||||
|
'Please add to the html page header, this line const apxtri = { headers: { xtrkversion: 1, xtribe: "smatchit", xapp: "pwa", xlang: "fr", xalias: "anonymous", xhash: "anonymous", xdays: 0} ,pagename:"apxid"} '
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const headerkey = ["xalias", "xhash", "xdays", "xprofils", "xtribe", "xlang"];
|
||||||
|
if (document.querySelector("html").getAttribute("lang")) {
|
||||||
|
apxtri.headers.xlang = document.querySelector("html").getAttribute("lang");
|
||||||
|
}
|
||||||
|
apxtri.headers.xlang = apxtri.headers?.xlang || "en";
|
||||||
|
//Get if exist in localstorage a key apxtri.headers.xapp
|
||||||
|
if (apxtri.headers.xapp && localStorage.getItem(apxtri.headers.xapp)) {
|
||||||
|
apx.data = JSON.parse(localStorage.getItem(apxtri.headers.xapp));
|
||||||
|
//update with current pagename and eventualy pageauth
|
||||||
|
apx.data.pagename = apxtri.pagename;
|
||||||
|
if (apxtri.pageauth) apx.data.pageauth = apxtri.pageauth;
|
||||||
|
const isauth = await axios.get('/api/apxtri/pagans/isauth', { headers: apx.data.headers, withCredentials:true,validateStatus: (status) => true});
|
||||||
|
if (
|
||||||
|
(isauth.status!==200 && apx.data.headers.alias!=="anonymous") ||
|
||||||
|
apx.data.headers.xtribe != apxtri.headers.xtribe ||
|
||||||
|
apx.data.headers.xlang != apxtri.headers.xlang ||
|
||||||
|
apx.data.headers.xtrkversion != apxtri.headers.xtrkversion
|
||||||
|
) {
|
||||||
|
// if no more authenticated or change of tribe...
|
||||||
|
localStorage.removeItem(apxtri.headers.xapp);
|
||||||
|
delete apx.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//reinit if apx.data does not exist
|
||||||
|
apx.data = apx?.data || apxtri;
|
||||||
|
// get context from url search ?q=x&s=z or hash #q=x&s=z
|
||||||
|
// search comme from a reloading page instead of hash is just a passive link
|
||||||
|
apx.pagecontext = { search: {}, hash: {} };
|
||||||
|
["hash", "search"].forEach((type) => {
|
||||||
|
const paramString = window.location[type];
|
||||||
|
if (paramString) {
|
||||||
|
paramString
|
||||||
|
.slice(1)
|
||||||
|
.split("&")
|
||||||
|
.forEach((kv) => {
|
||||||
|
const [key, value] = kv.split("=");
|
||||||
|
apx.pagecontext.hash[key] = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log("apx.pagecontext:", apx.pagecontext);
|
||||||
|
|
||||||
|
// check is authenticated
|
||||||
|
if (
|
||||||
|
apx.data.headers.xalias === "anonymous" ||
|
||||||
|
(apx.pagecontext.hash.xdays &&
|
||||||
|
dayjs(apx.pagecontext.hash.xdays).diff(dayjs(), "hours") < 25)
|
||||||
|
) {
|
||||||
|
// reset authentification data
|
||||||
|
apx.data.headers.xalias = "anonymous";
|
||||||
|
apx.data.headers.xdays = 0;
|
||||||
|
apx.data.headers.xprofils = ["anonymous"];
|
||||||
|
delete apx.data.headers.xhash;
|
||||||
|
}
|
||||||
|
//apx.managecontext(); (todo when all work target is to use context to redirect if key word used in contexte url, ....)
|
||||||
|
if (
|
||||||
|
apx.data.headers.xalias === "anonymous" &&
|
||||||
|
(apx.data.auth || !apx.data.allowedprofils.includes("anonymous"))
|
||||||
|
) {
|
||||||
|
// Means user is not authenticat and has a rememberMe previously selected (auth) OR this page is not accessible to an anonymous.
|
||||||
|
// Redirect to apxid page if auth is ok then redirect to this page
|
||||||
|
// notauth then expected to have alias privatekey
|
||||||
|
//document.location.href = `/apxtriadmin/${apx.data.pageauth}_${apx.data.headers.xlang}.html#url=${apx.data.
|
||||||
|
document.location.href = `/apxtriadmin/apxid_${apx.data.headers.xlang}.html#url=${apx.data.pagename}_${apx.data.headers.xlang}.html`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check accessright to the page
|
||||||
if (
|
if (
|
||||||
apx.data.allowedprofils &&
|
apx.data.allowedprofils &&
|
||||||
!apx.data.allowedprofils.includes("anonymous") &&
|
!apx.data.allowedprofils.includes("anonymous") &&
|
||||||
@@ -449,13 +466,9 @@ apx.update = async () => {
|
|||||||
console.log("profils authorized:", profilintersect);
|
console.log("profils authorized:", profilintersect);
|
||||||
if (profilintersect.length == 0) {
|
if (profilintersect.length == 0) {
|
||||||
alert(apx.data.ref.Middlewares.notallowtoaccess);
|
alert(apx.data.ref.Middlewares.notallowtoaccess);
|
||||||
|
document.location.href = `/apxtriadmin/apxid_${apx.data.headers.xlang}.html`
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (dayjs().valueOf() - apx.data.headers.xdays > 86400000) {
|
|
||||||
// need to refresh authentification if possible by opening the pageauth with url context
|
|
||||||
// the pageauth redirect to this current page after authentification, if not then wait credential
|
|
||||||
document.location.href = `/${apx.data.pageauth}_${apx.data.headers.xlang}.html#url=${apx.data.pagename}_${apx.data.headers.xlang}.html`;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
console.log("authorized to access");
|
console.log("authorized to access");
|
||||||
/* à voir si utile redirect to authentification page pageauth with a redirection if authentify to the pagename (check if /src/ then add it)
|
/* à voir si utile redirect to authentification page pageauth with a redirection if authentify to the pagename (check if /src/ then add it)
|
||||||
@@ -465,6 +478,11 @@ apx.update = async () => {
|
|||||||
apxtri.pagename
|
apxtri.pagename
|
||||||
}_${apxtri.headers.xlang}.html`;
|
}_${apxtri.headers.xlang}.html`;
|
||||||
*/
|
*/
|
||||||
|
/// axios setting //
|
||||||
|
axios.defaults.withCredentials = true; // force to send cookie http only for authentification
|
||||||
|
axios.defaults.headers.common=apx.data.headers;
|
||||||
|
////////////////////
|
||||||
|
|
||||||
////////////////////////////////////////////
|
////////////////////////////////////////////
|
||||||
apx.data.version = 0; //this force an update to be removed in production
|
apx.data.version = 0; //this force an update to be removed in production
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
@@ -473,8 +491,7 @@ apx.update = async () => {
|
|||||||
let initset = {};
|
let initset = {};
|
||||||
try {
|
try {
|
||||||
initset = await axios.get(initdb, {
|
initset = await axios.get(initdb, {
|
||||||
headers: apx.data.headers,
|
timeout: 2000
|
||||||
timeout: 2000,
|
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
@@ -491,21 +508,11 @@ apx.update = async () => {
|
|||||||
setTimeout(apx.update, 30000);
|
setTimeout(apx.update, 30000);
|
||||||
}
|
}
|
||||||
if (initset.data.msg == "data_model_update") {
|
if (initset.data.msg == "data_model_update") {
|
||||||
// mise à jour local
|
|
||||||
/*if (initset.data.data.wco) {
|
|
||||||
|
|
||||||
console.log("WARNING!!, local apxtri.wco was erase by updatelocaldb.wco");
|
|
||||||
}*/
|
|
||||||
Object.keys(initset.data.data).forEach((k) => {
|
Object.keys(initset.data.data).forEach((k) => {
|
||||||
if (k !== "headers") {
|
if (k !== "headers") {
|
||||||
apx.data[k] = initset.data.data[k];
|
apx.data[k] = initset.data.data[k];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/* if (apx.data.confpage.wco && !apx.data.wco){
|
|
||||||
console.log("update apx.data.wco with localdb cause does not exist")
|
|
||||||
apx.data.wco=apx.data.confpage.wco;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
console.log("local update done");
|
console.log("local update done");
|
||||||
apx.save();
|
apx.save();
|
||||||
}
|
}
|
||||||
@@ -529,11 +536,11 @@ apx.indexedDB.set = async (db, storeName, value) => {
|
|||||||
|
|
||||||
if (!db.objectStoreNames.contains("threads")) {
|
if (!db.objectStoreNames.contains("threads")) {
|
||||||
db.createObjectStore("threads", { keyPath: "uuid" });
|
db.createObjectStore("threads", { keyPath: "uuid" });
|
||||||
};
|
}
|
||||||
|
|
||||||
if (!db.objectStoreNames.contains("messages")) {
|
if (!db.objectStoreNames.contains("messages")) {
|
||||||
db.createObjectStore("messages", { keyPath: "privatriid" });
|
db.createObjectStore("messages", { keyPath: "privatriid" });
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
request.onsuccess = (event) => {
|
request.onsuccess = (event) => {
|
||||||
@@ -541,7 +548,7 @@ apx.indexedDB.set = async (db, storeName, value) => {
|
|||||||
|
|
||||||
if (!db.objectStoreNames.contains(storeName)) {
|
if (!db.objectStoreNames.contains(storeName)) {
|
||||||
return resolve();
|
return resolve();
|
||||||
};
|
}
|
||||||
|
|
||||||
const transaction = db.transaction(storeName, "readwrite");
|
const transaction = db.transaction(storeName, "readwrite");
|
||||||
const store = transaction.objectStore(storeName);
|
const store = transaction.objectStore(storeName);
|
||||||
@@ -589,7 +596,7 @@ apx.indexedDB.del = async (db, storeName, key) => {
|
|||||||
|
|
||||||
if (!db.objectStoreNames.contains(storeName)) {
|
if (!db.objectStoreNames.contains(storeName)) {
|
||||||
return resolve();
|
return resolve();
|
||||||
};
|
}
|
||||||
|
|
||||||
const transaction = db.transaction(storeName, "readwrite");
|
const transaction = db.transaction(storeName, "readwrite");
|
||||||
const store = transaction.objectStore(storeName);
|
const store = transaction.objectStore(storeName);
|
||||||
|
@@ -11,6 +11,8 @@ apx.apxauth.loadwco = async (id, ctx) => {
|
|||||||
ctx
|
ctx
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
|
// Check that in localdb tpl exist if not means it is not authenticated
|
||||||
|
if (!apx.data.tpl[`apxauthscreen${ctx.link}`]) ctx.link="signin";
|
||||||
const tpldataname = `${apx.data.pagename}_${id}_apxauth`;
|
const tpldataname = `${apx.data.pagename}_${id}_apxauth`;
|
||||||
const apxauthid = document.getElementById(id);
|
const apxauthid = document.getElementById(id);
|
||||||
const data = apx.apxauth.getdata(id, ctx);
|
const data = apx.apxauth.getdata(id, ctx);
|
||||||
@@ -31,7 +33,7 @@ apx.apxauth.getdata = (id, ctx) => {
|
|||||||
data.xalias = apx.data.headers.xalias;
|
data.xalias = apx.data.headers.xalias;
|
||||||
data.xtribe = apx.data.headers.xtribe;
|
data.xtribe = apx.data.headers.xtribe;
|
||||||
|
|
||||||
data.emailssuport = apx.data.appdata.emailsupport
|
data.emailssuport = apx.data?.appdata?.emailsupport
|
||||||
? apx.data.appdata.emailsupport
|
? apx.data.appdata.emailsupport
|
||||||
: "";
|
: "";
|
||||||
switch (ctx.link) {
|
switch (ctx.link) {
|
||||||
@@ -44,7 +46,7 @@ apx.apxauth.getdata = (id, ctx) => {
|
|||||||
});
|
});
|
||||||
data.noprofils = data.profils.length == 0;
|
data.noprofils = data.profils.length == 0;
|
||||||
data.member = apx.data.headers.xprofils.includes("persons");
|
data.member = apx.data.headers.xprofils.includes("persons");
|
||||||
data.websites = apx.data.appdata.websites;
|
data.websites = apx.data?.appdata?.websites || [];
|
||||||
data.optionlinks=apx.data.tpldata[tpldataname].optionlinks
|
data.optionlinks=apx.data.tpldata[tpldataname].optionlinks
|
||||||
data.town=apx.data.town
|
data.town=apx.data.town
|
||||||
data.nation=apx.data.nation
|
data.nation=apx.data.nation
|
||||||
@@ -52,10 +54,13 @@ apx.apxauth.getdata = (id, ctx) => {
|
|||||||
apx.data.tpldata[tpldataname].optionlinksmajor.forEach(o=>data.optionlinks.push(o))
|
apx.data.tpldata[tpldataname].optionlinksmajor.forEach(o=>data.optionlinks.push(o))
|
||||||
apx.save()
|
apx.save()
|
||||||
}
|
}
|
||||||
|
if (!apx.data.itms) apx.data.itms={}
|
||||||
|
if (!apx.data.wco) apx.data.wco={}
|
||||||
|
|
||||||
// get towns list
|
// get towns list
|
||||||
axios
|
axios
|
||||||
.get(`/api/apxtri/odmdb/idx/apxtri/towns/towns`, {
|
.get(`/api/apxtri/odmdb/idx/apxtri/towns/towns`, {
|
||||||
headers: apx.data.headers,
|
headers: apx.data.headers, withCredentials:true
|
||||||
})
|
})
|
||||||
.then((rep) => {
|
.then((rep) => {
|
||||||
console.log(rep)
|
console.log(rep)
|
||||||
@@ -72,7 +77,7 @@ apx.apxauth.getdata = (id, ctx) => {
|
|||||||
});
|
});
|
||||||
axios
|
axios
|
||||||
.get(`/api/apxtri/odmdb/idx/apxtri/pagans/lst_alias`, {
|
.get(`/api/apxtri/odmdb/idx/apxtri/pagans/lst_alias`, {
|
||||||
headers: apx.data.headers,
|
headers: apx.data.headers, withCredentials:true
|
||||||
})
|
})
|
||||||
.then((rep) => {
|
.then((rep) => {
|
||||||
if (rep.status==200){
|
if (rep.status==200){
|
||||||
@@ -139,7 +144,7 @@ apx.apxauth.redirecturlwithauth = (
|
|||||||
apx.apxauth.logout = () => {
|
apx.apxauth.logout = () => {
|
||||||
axios
|
axios
|
||||||
.get(`/api/apxtri/pagans/logout`, {
|
.get(`/api/apxtri/pagans/logout`, {
|
||||||
headers: apx.data.headers,
|
headers: apx.data.headers, withCredentials:true
|
||||||
})
|
})
|
||||||
.then((rep) => {
|
.then((rep) => {
|
||||||
console.log("logout", rep);
|
console.log("logout", rep);
|
||||||
@@ -250,7 +255,7 @@ apx.apxauth.authentifyme = async (
|
|||||||
console.log(`get /api/apxtri/pagans/alias/${alias}`);
|
console.log(`get /api/apxtri/pagans/alias/${alias}`);
|
||||||
axios
|
axios
|
||||||
.get(`/api/apxtri/pagans/alias/${alias}`, {
|
.get(`/api/apxtri/pagans/alias/${alias}`, {
|
||||||
headers: apx.data.headers,
|
headers: apx.data.headers, withCredentials:true
|
||||||
})
|
})
|
||||||
.then(async (rep) => {
|
.then(async (rep) => {
|
||||||
//console.log(rep.data);
|
//console.log(rep.data);
|
||||||
@@ -358,7 +363,7 @@ apx.apxauth.recoverykey = (id, aliasoremail) => {
|
|||||||
document.querySelector(`#${id} .msginfo`).innerHTML = "";
|
document.querySelector(`#${id} .msginfo`).innerHTML = "";
|
||||||
axios
|
axios
|
||||||
.post(`/api/apxtri/pagans/keyrecovery`, recodata, {
|
.post(`/api/apxtri/pagans/keyrecovery`, recodata, {
|
||||||
headers: apx.data.headers,
|
headers: apx.data.headers
|
||||||
})
|
})
|
||||||
.then((rep) => {
|
.then((rep) => {
|
||||||
rep.data.data.search = aliasoremail;
|
rep.data.data.search = aliasoremail;
|
||||||
@@ -678,15 +683,14 @@ apx.apxauth.registerIdentity = async (id, trustedtribe) => {
|
|||||||
data.trustedtribe = trustedtribe;
|
data.trustedtribe = trustedtribe;
|
||||||
console.log(data)
|
console.log(data)
|
||||||
axios
|
axios
|
||||||
.post(`/api/apxtri/pagans`, data, { headers: apx.data.headers })
|
.post(`/api/apxtri/pagans`, data, { headers: apx.data.headers, withCredentials:true})
|
||||||
.then((reppagan) => {
|
.then((reppagan) => {
|
||||||
//console.log(reppagan.data);
|
//console.log(reppagan.data);
|
||||||
apx.notification(`#${id} .msginfo`, reppagan.data);
|
apx.notification(`#${id} .msginfo`, reppagan.data);
|
||||||
authid.querySelector(`.btncreateidentity`).classList.add("hidden");
|
authid.querySelector(`.btncreateidentity`).classList.add("hidden");
|
||||||
authid.querySelector(`.signupbtnreload`).classList.remove("hidden");
|
authid.querySelector(`.signupbtnreload`).classList.remove("hidden");
|
||||||
//remove tmp cause create phc change to keep tplauth in memory and avoid asking again the pasword
|
apx.data.headers.xprofils=reppagan.data.profils;
|
||||||
//delete apx.data.tmpauth;
|
apx.data.save();
|
||||||
//apx.save();
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log("error:", err);
|
console.log("error:", err);
|
||||||
@@ -713,13 +717,13 @@ apx.apxauth.jointribe = (id) => {
|
|||||||
};
|
};
|
||||||
axios
|
axios
|
||||||
.put(`/api/apxtri/pagans/person/${apx.data.headers.xtribe}`, data, {
|
.put(`/api/apxtri/pagans/person/${apx.data.headers.xtribe}`, data, {
|
||||||
headers: apx.data.headers,
|
headers: apx.data.headers, withCredentials:true
|
||||||
})
|
})
|
||||||
.then((rep) => {
|
.then((rep) => {
|
||||||
apx.notification(`#${id} .msginfo`, rep.data);
|
apx.notification(`#${id} .msginfo`, rep.data);
|
||||||
axios
|
axios
|
||||||
.get(`/api/apxtri/pagans/logout`, {
|
.get(`/api/apxtri/pagans/logout`, {
|
||||||
headers: apx.data.headers,
|
headers: apx.data.headers, withCredentials:true
|
||||||
})
|
})
|
||||||
.then((rep) => {
|
.then((rep) => {
|
||||||
console.log("logout", rep);
|
console.log("logout", rep);
|
||||||
|
@@ -5,7 +5,9 @@ apx.simplemobnav.loadwco = (id, ctx) => {
|
|||||||
const tpldataname = `${apx.data.pagename}_${id}_simplemobnav`;
|
const tpldataname = `${apx.data.pagename}_${id}_simplemobnav`;
|
||||||
const simplemobnavid = document.getElementById(id)
|
const simplemobnavid = document.getElementById(id)
|
||||||
console.log("load simplemobnav with tpldataname:", tpldataname, " id:", id, " ctx:", ctx);
|
console.log("load simplemobnav with tpldataname:", tpldataname, " id:", id, " ctx:", ctx);
|
||||||
|
// check if authenticate if yes then show myworld instead of signin
|
||||||
|
//console.log("ggggggggggggg",apx.data.headers.xalias)
|
||||||
|
//if (apx.data.headers.xalias!="anonymous") ctx.link="myworld";
|
||||||
let initmenu;
|
let initmenu;
|
||||||
if (simplemobnavid.innerHTML.trim() === "") {
|
if (simplemobnavid.innerHTML.trim() === "") {
|
||||||
// Get 1st menu matching the first profil in profilmenu
|
// Get 1st menu matching the first profil in profilmenu
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
xuuid:0
|
xuuid:0
|
||||||
},
|
},
|
||||||
pagename: "apxid",
|
pagename: "apxid",
|
||||||
pageauth: "apxid",
|
|
||||||
wcoobserver:true,
|
wcoobserver:true,
|
||||||
allowedprofils:["anonymous"],
|
allowedprofils:["anonymous"],
|
||||||
version:0
|
version:0
|
||||||
|
@@ -22,7 +22,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mainprofil": "pagans",
|
"mainprofil": "pagans",
|
||||||
"link": "logout"
|
"link": "myworld"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mainprofil": "anonymous",
|
"mainprofil": "anonymous",
|
||||||
|
@@ -6,21 +6,21 @@
|
|||||||
"anonymous"
|
"anonymous"
|
||||||
],
|
],
|
||||||
"tpl": {
|
"tpl": {
|
||||||
|
"simplemobnavnavbuttonh": "apxtri/objects/wco/simplemobnav/navbuttonh.mustache",
|
||||||
|
"simplemobnavnavlist": "apxtri/objects/wco/simplemobnav/navlist.mustache",
|
||||||
|
"simplemobnavnavbutton": "apxtri/objects/wco/simplemobnav/navbuttonh.mustache",
|
||||||
|
"simplemobnavmain": "apxtri/objects/wco/simplemobnav/main.mustache",
|
||||||
"apxauthmain": "apxtri/objects/wco/apxauth/main",
|
"apxauthmain": "apxtri/objects/wco/apxauth/main",
|
||||||
"apxauthscreensignup": "apxtri/objects/wco/apxauth/screensignup",
|
"apxauthscreensignup": "apxtri/objects/wco/apxauth/screensignup",
|
||||||
"apxauthscreensignin": "apxtri/objects/wco/apxauth/screensignin",
|
"apxauthscreensignin": "apxtri/objects/wco/apxauth/screensignin",
|
||||||
"apxauthscreenlogout": "apxtri/objects/wco/apxauth/screenlogout",
|
"apxauthscreenlogout": "apxtri/objects/wco/apxauth/screenlogout",
|
||||||
"apxauthscreenmyworld": "apxtri/objects/wco/apxauth/screenmyworld",
|
"apxauthscreenmyworld": "apxtri/objects/wco/apxauth/screenmyworld",
|
||||||
"apxauthscreeninformation": "apxtri/objects/wco/apxauth/screeninformation",
|
"apxauthscreeninformation": "apxtri/objects/wco/apxauth/screeninformation",
|
||||||
"apxauthscreenforgetkey": "apxtri/objects/wco/apxauth/screenforgetkey",
|
"apxauthscreenforgetkey": "apxtri/objects/wco/apxauth/screenforgetkey"
|
||||||
"simplemobnavnavbuttonh": "apxtri/objects/wco/simplemobnav/navbuttonh.mustache",
|
|
||||||
"simplemobnavnavlist": "apxtri/objects/wco/simplemobnav/navlist.mustache",
|
|
||||||
"simplemobnavnavbutton": "apxtri/objects/wco/simplemobnav/navbuttonh.mustache",
|
|
||||||
"simplemobnavmain": "apxtri/objects/wco/simplemobnav/main.mustache"
|
|
||||||
},
|
},
|
||||||
"tpldata": {
|
"tpldata": {
|
||||||
"apxid_signature_apxauth": "apxtri/objects/wwws/admin/src/tpldata/apxid_signature_apxauth",
|
|
||||||
"apxid_authentification_simplemobnav": "apxtri/objects/wwws/admin/src/tpldata/apxid_authentification_simplemobnav",
|
"apxid_authentification_simplemobnav": "apxtri/objects/wwws/admin/src/tpldata/apxid_authentification_simplemobnav",
|
||||||
|
"apxid_signature_apxauth": "apxtri/objects/wwws/admin/src/tpldata/apxid_signature_apxauth",
|
||||||
"apxid_mydata_simplemobnav": "apxtri/objects/wwws/admin/src/tpldata/apxid_mydata_simplemobnav"
|
"apxid_mydata_simplemobnav": "apxtri/objects/wwws/admin/src/tpldata/apxid_mydata_simplemobnav"
|
||||||
},
|
},
|
||||||
"schema": [
|
"schema": [
|
||||||
@@ -34,44 +34,6 @@
|
|||||||
"Checkjson": "apxtri/models/tplstrings/Checkjson",
|
"Checkjson": "apxtri/models/tplstrings/Checkjson",
|
||||||
"Notification": "apxtri/models/tplstrings/Notifications",
|
"Notification": "apxtri/models/tplstrings/Notifications",
|
||||||
"Middlewares": "apxtri/models/tplstrings/Middlewares"
|
"Middlewares": "apxtri/models/tplstrings/Middlewares"
|
||||||
},
|
|
||||||
"wco": {
|
|
||||||
"favicon": {
|
|
||||||
"href": "static/img/icons/iconbglight.png"
|
|
||||||
},
|
|
||||||
"logo": {
|
|
||||||
"src": "static/img/logo/logobgdark.png",
|
|
||||||
"alt": "apXtri"
|
|
||||||
},
|
|
||||||
"claim": {
|
|
||||||
"textContent": "L'Unique et sa propriété"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"appdata": {}
|
|
||||||
},
|
|
||||||
"admindata": {
|
|
||||||
"version": 1,
|
|
||||||
"profils": [
|
|
||||||
"anonymous"
|
|
||||||
],
|
|
||||||
"tpl": {
|
|
||||||
"adminskullverticalnav": "apxtri/objects/wco/adminskull/verticalnav",
|
|
||||||
"adminskullresult": "apxtri/objects/wco/adminskull/result",
|
|
||||||
"adminskullmain": "apxtri/objects/wco/adminskull/main",
|
|
||||||
"adminskullheadnav": "apxtri/objects/wco/adminskull/headnav"
|
|
||||||
},
|
|
||||||
"tpldata": {},
|
|
||||||
"schema": [
|
|
||||||
"apxtri/objects/pagans",
|
|
||||||
"apxtri/objects/persons"
|
|
||||||
],
|
|
||||||
"ref": {
|
|
||||||
"Checkjson": "apxtri/models/tplstrings/Checkjson",
|
|
||||||
"Notification": "apxtri/models/tplstrings/Notifications",
|
|
||||||
"Middlewares": "apxtri/models/tplstrings/Middlewares",
|
|
||||||
"Odmdb": "apxtri/models/tplstrings/Odmdb",
|
|
||||||
"Pagans": "apxtri/models//tplstrings/Pagans",
|
|
||||||
"Persons": "apxtri/models/tplstrings/Persons"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"privatri": {
|
"privatri": {
|
||||||
@@ -87,23 +49,48 @@
|
|||||||
"privatriInviteAlias": "apxtri/objects/wco/privatri/inviteAlias.mustache",
|
"privatriInviteAlias": "apxtri/objects/wco/privatri/inviteAlias.mustache",
|
||||||
"privatriMessage": "apxtri/objects/wco/privatri/message.mustache",
|
"privatriMessage": "apxtri/objects/wco/privatri/message.mustache",
|
||||||
"privatriThread": "apxtri/objects/wco/privatri/thread.mustache",
|
"privatriThread": "apxtri/objects/wco/privatri/thread.mustache",
|
||||||
"privatriThreadAlias": "apxtri/objects/wco/privatri/threadAlias.mustache",
|
"privatriThreadAliasList": "apxtri/objects/wco/privatri/threadAliasList.mustache",
|
||||||
"privatriThreadSettings": "apxtri/objects/wco/privatri/threadSettings.mustache",
|
"privatriThreadSettings": "apxtri/objects/wco/privatri/threadSettings.mustache",
|
||||||
"privatriToastAlert": "apxtri/objects/wco/privatri/toastAlert.mustache",
|
"privatriToastAlert": "apxtri/objects/wco/privatri/toastAlert.mustache"
|
||||||
"privatriThreadAliasList": "apxtri/objects/wco/privatri/threadAliasList.mustache"
|
|
||||||
},
|
},
|
||||||
"tpldata": {
|
"tpldata": {
|
||||||
"privatri_main_privatri": "apxtri/objects/wwws/admin/src/tpldata/privatri_main_privatri",
|
"privatri_main_privatri": "apxtri/objects/wwws/admin/src/tpldata/privatri_main_privatri"
|
||||||
"privatri_privatrimain_privatri": "apxtri/objects/wwws/admin/src/tpldata/privatri_privatrimain_privatri"
|
|
||||||
},
|
},
|
||||||
"schema": [],
|
"schema": [],
|
||||||
"ref": {
|
"ref": {
|
||||||
"Checkjson": "apxtri/models/tplstrings/Checkjson",
|
"Checkjson": "apxtri/models/tplstrings/Checkjson",
|
||||||
"Notification": "apxtri/models/tplstrings/Notifications",
|
"Notification": "apxtri/models/tplstrings/Notifications",
|
||||||
"Middlewares": "apxtri/models/tplstrings/Middlewares"
|
"Middlewares": "apxtri/models/tplstrings/Middlewares"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"wco": {},
|
"admindata": {
|
||||||
"appdata": {}
|
"version": 1,
|
||||||
|
"profils": [
|
||||||
|
"anonymous"
|
||||||
|
],
|
||||||
|
"tpl": {},
|
||||||
|
"tpldata": {},
|
||||||
|
"schema": [],
|
||||||
|
"ref": {
|
||||||
|
"Checkjson": "apxtri/models/tplstrings/Checkjson",
|
||||||
|
"Notification": "apxtri/models/tplstrings/Notifications",
|
||||||
|
"Middlewares": "apxtri/models/tplstrings/Middlewares"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
kull/headnav"
|
||||||
|
},
|
||||||
|
"tpldata": {},
|
||||||
|
"schema": [
|
||||||
|
"apxtri/objects/pagans",
|
||||||
|
"apxtri/objects/persons"
|
||||||
|
],
|
||||||
|
"ref": {
|
||||||
|
"Odmdb": "apxtri/models/tplstrings/Odmdb",
|
||||||
|
"Pagans": "apxtri/models//tplstrings/Pagans",
|
||||||
|
"Persons": "apxtri/models/tplstrings/Persons"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user