Revue appels des éléments des dictionnaires dans scripts front-end avec utilisation de require() et uniquement les éléments nécessaires aux scripts.
This commit is contained in:
parent
528060529a
commit
764fc9bf93
@ -24,9 +24,9 @@ import { checkSession, getConfig, getTimeDifference } from "./tools/users.js";
|
||||
import { showBtnPayment, unCheckAllOthers } from "./tools/webportage.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txt = require("../../lang/"+lang+"/general");
|
||||
const txtUsers = require("../../lang/"+lang+"/user");
|
||||
const txtSubscriptions = require("../../lang/"+lang+"/subscription");
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { infosUserNbGodChilds, infosUserNoGodchilds, needBeConnected } = require("../../lang/"+lang+"/user");
|
||||
const { infosExpirated, infosNbDays } = require("../../lang/"+lang+"/subscription");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const divCrash = document.getElementById("crash");
|
||||
@ -48,11 +48,11 @@ const initialise = async () =>
|
||||
{
|
||||
const config = await getConfig();
|
||||
if(!config)
|
||||
addElement(divCrash, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divCrash, "p", serverError, "", ["error"]);
|
||||
else
|
||||
{
|
||||
// Si l'utilisateur n'est pas connecté avec le bon statut, pas la peine d'aller + loin :
|
||||
const isConnected=await checkSession(["user"], "/"+configFrontEnd.connectionPage, { message: txtUsers.needBeConnected, color:"error" }, window.location);
|
||||
const isConnected=await checkSession(["user"], "/"+configFrontEnd.connectionPage, { message: needBeConnected, color:"error" }, window.location);
|
||||
if(isConnected)
|
||||
{
|
||||
divMain.style.display="block";
|
||||
@ -107,10 +107,10 @@ const initialise = async () =>
|
||||
const beginSubTS=new Date(response.Subscription.createdAt).getTime();
|
||||
const nbDaysOk=response.Subscription.numberOfDays-Math.round((Date.now()-beginSubTS)/1000/3600/24);
|
||||
if(nbDaysOk > 0)
|
||||
addElement(divSubscribeIntro, "p", txtSubscriptions.infosNbDays.replace("NB_DAYS", nbDaysOk), "", ["info"]);
|
||||
addElement(divSubscribeIntro, "p", infosNbDays.replace("NB_DAYS", nbDaysOk), "", ["info"]);
|
||||
else
|
||||
{
|
||||
addElement(divSubscribeIntro, "p", txtSubscriptions.infosExpirated.replace("NB_DAYS", nbDaysOk), "", ["error"]);
|
||||
addElement(divSubscribeIntro, "p", infosExpirated.replace("NB_DAYS", nbDaysOk), "", ["error"]);
|
||||
window.location.assign("#subscribe");
|
||||
}
|
||||
}
|
||||
@ -162,11 +162,11 @@ const initialise = async () =>
|
||||
if(Array.isArray(response.errors))
|
||||
response.errors = response.errors.join("<br>");
|
||||
else
|
||||
response.errors = txt.serverError;
|
||||
response.errors = serverError;
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
// dans tous les cas, je mets à jour le contenu du formulaire :
|
||||
getInfos();
|
||||
}
|
||||
@ -239,10 +239,10 @@ const initialise = async () =>
|
||||
{
|
||||
const nbGodchilds=response.length;
|
||||
if(nbGodchilds===0)
|
||||
txtGodchilds=txtUsers.infosUserNoGodchilds;
|
||||
txtGodchilds=infosUserNoGodchilds;
|
||||
else
|
||||
{
|
||||
txtGodchilds=txtUsers.infosUserNbGodChilds.replace("#NB", nbGodchilds);
|
||||
txtGodchilds=infosUserNbGodChilds.replace("#NB", nbGodchilds);
|
||||
for(let i in response)
|
||||
txtGodchilds+=response[i].name+" ("+response[i].email+") ";
|
||||
}
|
||||
@ -257,7 +257,7 @@ const initialise = async () =>
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divCrash, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divCrash, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,8 @@ import { loadMatomo } from "./tools/matomo.js";
|
||||
import { checkAnswerDatas, checkSession, getTimeDifference, setSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txtServerError = require("../../lang/"+lang+"/general").serverError;
|
||||
const txtAlreadyConnected = require("../../lang/"+lang+"/user").alreadyConnected;
|
||||
const txtNeedChooseLoginWay = require("../../lang/"+lang+"/user").needChooseLoginWay;
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { alreadyConnected, needChooseLoginWay } = require("../../lang/"+lang+"/user");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const myForm = document.getElementById("connection");
|
||||
@ -41,7 +40,7 @@ const initialise = async () =>
|
||||
const isConnected=await checkSession();
|
||||
if(isConnected)
|
||||
{
|
||||
saveLocaly("message", { message: txtAlreadyConnected, color:"info" });// pour l'afficher sur la page suivante
|
||||
saveLocaly("message", { message: alreadyConnected, color:"info" });// pour l'afficher sur la page suivante
|
||||
const user=getLocaly("user", true);
|
||||
const homePage=user.status+"HomePage";
|
||||
window.location.assign("/"+configTemplate[homePage]);
|
||||
@ -59,7 +58,7 @@ const initialise = async () =>
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
@ -74,7 +73,7 @@ myForm.addEventListener("submit", function(e)
|
||||
divResponse.innerHTML="";// efface d'éventuels messages déjà affichés
|
||||
let datas=getDatasFromInputs(myForm);
|
||||
if(isEmpty(datas.password) && isEmpty(datas.getLoginLink))
|
||||
addElement(divResponse, "div", txtNeedChooseLoginWay, "", ["error"]);
|
||||
addElement(divResponse, "div", needChooseLoginWay, "", ["error"]);
|
||||
else
|
||||
{
|
||||
const xhr = new XMLHttpRequest();
|
||||
@ -116,7 +115,7 @@ myForm.addEventListener("submit", function(e)
|
||||
window.location.assign(url);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
}
|
||||
else if (response.errors)
|
||||
{
|
||||
@ -124,7 +123,7 @@ myForm.addEventListener("submit", function(e)
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
@ -139,7 +138,7 @@ myForm.addEventListener("submit", function(e)
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
});
|
@ -14,8 +14,8 @@ import { helloDev } from "./tools/everywhere.js";
|
||||
import { getConfig } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txt = require("../../lang/"+lang+"/general");
|
||||
const txtUsers = require("../../lang/"+lang+"/user");
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { byebyeMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
helloDev();
|
||||
|
||||
@ -27,18 +27,18 @@ const initialise = async () =>
|
||||
{
|
||||
config = await getConfig();
|
||||
if(!config)
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
else
|
||||
{
|
||||
removeLocaly("user");
|
||||
removeLocaly("url");
|
||||
removeLocaly("message");
|
||||
addElement(divResponse, "p", txtUsers.byebyeMessage, "", ["success"]);
|
||||
addElement(divResponse, "p", byebyeMessage, "", ["success"]);
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
initialise();
|
@ -17,8 +17,8 @@ import { getUrlParams } from "./tools/url.js";
|
||||
import { checkSession, getConfig, setSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txt = require("../../lang/"+lang+"/general");
|
||||
const txtUsers = require("../../lang/"+lang+"/user");
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { badLinkValidationMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
const divResponse = document.getElementById("response");
|
||||
|
||||
@ -31,7 +31,7 @@ const initialise = async () =>
|
||||
{
|
||||
config = await getConfig();
|
||||
if(!config)
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
else
|
||||
{
|
||||
const datas=getUrlParams();
|
||||
@ -54,11 +54,11 @@ const initialise = async () =>
|
||||
if(Array.isArray(response.errors))
|
||||
response.errors = response.errors.join("<br>");
|
||||
else
|
||||
response.errors = txt.serverError;
|
||||
response.errors = serverError;
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", txtUsers.badLinkValidationMessage.replace("#URL", configFrontEnd.accountPage), "", ["error"]);
|
||||
addElement(divResponse, "p", badLinkValidationMessage.replace("#URL", configFrontEnd.accountPage), "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhr.setRequestHeader("Authorization", "Bearer "+datas.t);
|
||||
@ -68,7 +68,7 @@ const initialise = async () =>
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
@ -23,18 +23,10 @@ import { helloDev, updateAccountLink } from "./tools/everywhere.js";
|
||||
import { dateFormat, isEmpty, replaceAll } from "../../tools/main";
|
||||
import { checkSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires : revoir pour ne prendre que les variables utilisées
|
||||
const txt = require("../../lang/"+lang+"/general");
|
||||
|
||||
const txtNotAllowed = require("../../lang/"+lang+"/general").notAllowed;
|
||||
const txtServerError = require("../../lang/"+lang+"/general").serverError;
|
||||
const txtStatsAdmin = require("../../lang/"+lang+"/general").statsAdmin;
|
||||
const txtNeedBeCompleted = require("../../lang/"+lang+"/questionnaire").needBeCompleted;
|
||||
const txtNextDateWithoutQuestionnaire = require("../../lang/"+lang+"/questionnaire").nextDateWithoutQuestionnaire;
|
||||
const txtNextQuestionnairesList = require("../../lang/"+lang+"/questionnaire").nextQuestionnairesList;
|
||||
const txtWelcome = require("../../lang/"+lang+"/user").welcomeMessage;
|
||||
|
||||
const txtQuestionnaire = require("../../lang/"+lang+"/questionnaire");
|
||||
// Dictionnaires :
|
||||
const { notAllowed, serverError, statsAdmin } = require("../../lang/"+lang+"/general");
|
||||
const { nextDateWithoutQuestionnaire, nextQuestionnairesList, questionnaireNeedBeCompleted } = require("../../lang/"+lang+"/questionnaire");
|
||||
const { welcomeMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const divMain = document.getElementById("main-content");
|
||||
@ -49,12 +41,12 @@ const initialise = async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
const isConnected=await checkSession(["manager", "admin"], "/"+configTemplate.connectionPage, { message: txtNotAllowed, color:"error" });
|
||||
const isConnected=await checkSession(["manager", "admin"], "/"+configTemplate.connectionPage, { message: notAllowed, color:"error" });
|
||||
if(isConnected)
|
||||
{
|
||||
const user=getLocaly("user", true);
|
||||
updateAccountLink(user.status, configTemplate);
|
||||
addElement(divMessage, "h2", txtWelcome.replace("#NAME", user.name));
|
||||
addElement(divMessage, "h2", welcomeMessage.replace("#NAME", user.name));
|
||||
divMain.style.display="block";
|
||||
if(!isEmpty(getLocaly("message")))
|
||||
{
|
||||
@ -85,7 +77,7 @@ const initialise = async () =>
|
||||
NB_USERS_DELETED_VALIDED : response.nbDeletedUsersWasValided,
|
||||
NB_USERS_DELETED_PREMIUM : response.nbDeletedUsersTotWasPremium
|
||||
};
|
||||
addElement(divMessage, "p", replaceAll(txtStatsAdmin, mapText), "", "", "", false);
|
||||
addElement(divMessage, "p", replaceAll(statsAdmin, mapText), "", "", "", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,12 +100,12 @@ const initialise = async () =>
|
||||
dayStr=new Intl.DateTimeFormat(lang, optionsDayStr).format(new Date(response.questionnaires[i].datePublishing));
|
||||
listHTML+="<li>"+dayStr+" "+dateFormat(response.questionnaires[i].datePublishing, availableLangs[0])+": <a href='"+configTemplate.questionnairesManagementPage+"?id="+response.questionnaires[i].id+"'>"+response.questionnaires[i].title+"</a>";
|
||||
if(response.questionnaires[i].isPublishable===false)
|
||||
listHTML+=" <span class='error'>("+txtNeedBeCompleted+")</li>";
|
||||
listHTML+=" <span class='error'>("+questionnaireNeedBeCompleted+")</li>";
|
||||
listHTML+="</li>";
|
||||
}
|
||||
if(response.questionnaires.length!==0)
|
||||
addElement(divQuestionnaires, "h2", txtNextQuestionnairesList.replace("#NB", response.questionnaires.length));
|
||||
addElement(divQuestionnaires, "h4", txtNextDateWithoutQuestionnaire+dateFormat(response.dateNeeded, availableLangs[0]), "", ["info"], "", false);
|
||||
addElement(divQuestionnaires, "h2", nextQuestionnairesList.replace("#NB", response.questionnaires.length));
|
||||
addElement(divQuestionnaires, "h4", nextDateWithoutQuestionnaire+dateFormat(response.dateNeeded, availableLangs[0]), "", ["info"], "", false);
|
||||
addElement(divQuestionnaires, "ul", listHTML, "", "", "", false);
|
||||
}
|
||||
}
|
||||
@ -135,7 +127,7 @@ const initialise = async () =>
|
||||
if (this.status === 200 && response.message!=undefined)
|
||||
addElement(divMessage, "p", response.message, "", ["success"], "", false);
|
||||
else
|
||||
addElement(divMessage, "p", txt.serverError, "", ["error"], "", false);
|
||||
addElement(divMessage, "p", serverError, "", ["error"], "", false);
|
||||
}
|
||||
}
|
||||
xhrRegenerate.setRequestHeader("Content-Type", "application/json");
|
||||
@ -147,7 +139,7 @@ const initialise = async () =>
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divCrash, "p", txtServerError, "", ["error"]);
|
||||
addElement(divCrash, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
@ -21,10 +21,10 @@ import { isEmpty, replaceAll } from "../../tools/main";
|
||||
import { checkSession, getConfig } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txt = require("../../lang/"+lang+"/general");
|
||||
const txtUsers = require("../../lang/"+lang+"/user");
|
||||
const txtAnwers = require("../../lang/"+lang+"/answer");
|
||||
const txtQuestionnaire = require("../../lang/"+lang+"/questionnaire");
|
||||
const { nbQuestionnaireWithoudAnswer, noQuestionnaireWithoudAnswer, statsUser } = require("../../lang/"+lang+"/answer");
|
||||
const { nextPage, previousPage, serverError } = require("../../lang/"+lang+"/general");
|
||||
const { searchQuestionnaireResultTitle, searchQuestionnaireWithResult, searchQuestionnaireWithNoResult } = require("../../lang/"+lang+"/questionnaire");
|
||||
const { needBeConnected, welcomeMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const divMain= document.getElementById("main-content");
|
||||
@ -47,16 +47,16 @@ const initialise = async () =>
|
||||
{
|
||||
const config = await getConfig();
|
||||
if(!config)
|
||||
addElement(divCrash, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divCrash, "p", serverError, "", ["error"]);
|
||||
else
|
||||
{
|
||||
// Si l'utilisateur n'est pas connecté, pas la peine d'aller + loin :
|
||||
const isConnected=await checkSession(["user"], "/"+configFrontEnd.connectionPage, { message: txtUsers.needBeConnected, color:"error" }, window.location);
|
||||
const isConnected=await checkSession(["user"], "/"+configFrontEnd.connectionPage, { message: needBeConnected, color:"error" }, window.location);
|
||||
if(isConnected)
|
||||
{
|
||||
const user=getLocaly("user", true);
|
||||
updateAccountLink(user.status, configFrontEnd);
|
||||
addElement(divMessage, "h1", txtUsers.welcomeMessage.replace("#NAME", user.name));
|
||||
addElement(divMessage, "h1", welcomeMessage.replace("#NAME", user.name));
|
||||
divMain.style.display="block";
|
||||
if(!isEmpty(getLocaly("message")))
|
||||
{
|
||||
@ -83,7 +83,7 @@ const initialise = async () =>
|
||||
AVGDURATION : response.avgDuration,
|
||||
AVGCORRECTANSWERS : response.avgCorrectAnswers
|
||||
};
|
||||
addElement(divMessage, "p", replaceAll(txtAnwers.statsUser, mapText), "", "", "", false);
|
||||
addElement(divMessage, "p", replaceAll(statsUser, mapText), "", "", "", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -101,19 +101,19 @@ const initialise = async () =>
|
||||
if (this.status === 200)
|
||||
{
|
||||
if(response.nbTot===0)
|
||||
addElement(quizIntro, "p", txtAnwers.noQuestionnaireWithoudAnswer, "", ["success"]);
|
||||
addElement(quizIntro, "p", noQuestionnaireWithoudAnswer, "", ["success"]);
|
||||
else if(response.html)
|
||||
{
|
||||
addElement(quizIntro, "p", txtAnwers.nbQuestionnaireWithoudAnswer.replace("#NB", response.questionnaires.length), "", ["info"]);
|
||||
addElement(quizIntro, "p", nbQuestionnaireWithoudAnswer.replace("#NB", response.questionnaires.length), "", ["info"]);
|
||||
quizListing.innerHTML=response.html;
|
||||
window.location.hash="";// sinon les hash s'enchaînent...
|
||||
window.location.assign("#quizsTitle");
|
||||
}
|
||||
else
|
||||
addElement(quizs, "p", txt.serverError, "", ["error"]);// revoir si intérêt d'afficher quelque chose
|
||||
addElement(quizs, "p", serverError, "", ["error"]);// revoir si intérêt d'afficher quelque chose
|
||||
}
|
||||
else
|
||||
addElement(quizs, "p", txt.serverError, "", ["error"]); // idem
|
||||
addElement(quizs, "p", serverError, "", ["error"]); // idem
|
||||
}
|
||||
}
|
||||
xhrLastQuizs.setRequestHeader("Authorization", "Bearer "+user.token);
|
||||
@ -123,7 +123,7 @@ const initialise = async () =>
|
||||
// La recherche peut être lancée via la bouton submit ou un lien de pagination
|
||||
const sendSearch = (type="search") =>
|
||||
{
|
||||
quizTitle.innerHTML=txtQuestionnaire.searchResultTitle;
|
||||
quizTitle.innerHTML=searchQuestionnaireResultTitle;
|
||||
quizListing.innerHTML=""+"";
|
||||
let datas=getDatasFromInputs(formSearch);
|
||||
const xhrSearch = new XMLHttpRequest();
|
||||
@ -140,13 +140,13 @@ const initialise = async () =>
|
||||
{
|
||||
if(response.nbTot===0)
|
||||
{
|
||||
addElement(quizIntro, "p", txtQuestionnaire.notFound, "", ["info"]);
|
||||
addElement(quizIntro, "p", searchQuestionnaireWithNoResult, "", ["info"]);
|
||||
window.location.hash="";// sinon les hash s'enchaînent...
|
||||
window.location.assign("#quizsTitle");
|
||||
}
|
||||
else if(response.html)
|
||||
{
|
||||
addElement(quizIntro, "p", txtQuestionnaire.searchWithResult.replace("#NB", response.nbTot) , "", ["success"]);
|
||||
addElement(quizIntro, "p", searchQuestionnaireWithResult.replace("#NB", response.nbTot) , "", ["success"]);
|
||||
quizListing.innerHTML=response.html;
|
||||
window.location.hash="";
|
||||
window.location.assign("#quizsTitle");
|
||||
@ -156,7 +156,7 @@ const initialise = async () =>
|
||||
quizPaginationNext.innerHTML="";
|
||||
if(response.begin != 0)// peut retourner "0" et non 0 !
|
||||
{
|
||||
addElement(quizPaginationPrevious, "a", "<< "+txt.previousPage , "previousRes", ["button"], { href: "#search" }); // revoir, les "<<" pourraient être gérées par le CSS
|
||||
addElement(quizPaginationPrevious, "a", "<< "+previousPage , "previousRes", ["button"], { href: "#search" }); // revoir, les "<<" pourraient être gérées par le CSS
|
||||
const previousPage=document.getElementById("previousRes");
|
||||
// le retour à la page précédente peut se faire en cliquant sur le bouton ou via l'historique du navigateur
|
||||
const goBackRes = () =>
|
||||
@ -183,7 +183,7 @@ const initialise = async () =>
|
||||
}
|
||||
if(response.end < (response.nbTot-1))// -1, car tableau commence à 0 !
|
||||
{
|
||||
addElement(quizPaginationNext, "a", txt.nextPage+ " >>", "nextRes", ["button"], { href: "#search" }, false);
|
||||
addElement(quizPaginationNext, "a", nextPage+ " >>", "nextRes", ["button"], { href: "#search" }, false);
|
||||
const nextPage=document.getElementById("nextRes");
|
||||
nextPage.addEventListener("click", function(e)
|
||||
{
|
||||
@ -196,10 +196,10 @@ const initialise = async () =>
|
||||
}
|
||||
}
|
||||
else
|
||||
addElement(quizs, "p", txt.serverError, "", ["error"]);
|
||||
addElement(quizs, "p", serverError, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(quizs, "p", txt.serverError, "", ["error"]);
|
||||
addElement(quizs, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhrSearch.setRequestHeader("Content-Type", "application/json");
|
||||
@ -230,7 +230,7 @@ const initialise = async () =>
|
||||
catch(e)
|
||||
{
|
||||
console.error(e);
|
||||
addElement(divCrash, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divCrash, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
initialise();
|
@ -21,7 +21,7 @@ const initialise = async () =>
|
||||
const isConnected=await checkSession();
|
||||
if(isConnected)
|
||||
{
|
||||
// on change le lien du compte en haut
|
||||
// on change le lien d'accès au compte
|
||||
const user=getLocaly("user", true);
|
||||
updateAccountLink(user.status, configTemplate);
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ import { getUrlParams } from "./tools/url.js";
|
||||
import { checkAnswerDatas, checkSession, getConfig, getTimeDifference, setSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txt = require("../../lang/"+lang+"/general");
|
||||
const txtUsers = require("../../lang/"+lang+"/user");
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { alreadyConnected, badLinkValidationMessage, validationMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
const divResponse = document.getElementById("response");
|
||||
|
||||
@ -34,14 +34,14 @@ const initialise = async () =>
|
||||
{
|
||||
config = await getConfig();
|
||||
if(!config)
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
else
|
||||
{
|
||||
// si l'utilisateur est déjà connecté, pas la peine d'aller + loin :
|
||||
const isConnected=await checkSession();
|
||||
if(isConnected)
|
||||
{
|
||||
saveLocaly("message", { message: txtUsers.alreadyConnected, color:"information" });// pour l'afficher sur la page suivante
|
||||
saveLocaly("message", { message: alreadyConnected, color:"information" });// pour l'afficher sur la page suivante
|
||||
const user=getLocaly("user", true);
|
||||
const homePage=user.status+"HomePage";
|
||||
window.location.assign("/"+configFrontEnd[homePage]);
|
||||
@ -67,7 +67,7 @@ const initialise = async () =>
|
||||
connexionMaxTime+=parseInt(response.connexionTime,10)*3600*1000;
|
||||
setSession(response.userId, response.token, connexionMaxTime);
|
||||
removeLocaly("lastAnswer");// ! important pour ne pas enregister plusieurs fois le résultat
|
||||
addElement(divResponse, "p", txtUsers.validationMessage, "", ["success"]);// au cas où blocage redirection
|
||||
addElement(divResponse, "p", validationMessage, "", ["success"]);// au cas où blocage redirection
|
||||
window.location.assign("/"+configFrontEnd.userHomePage);// connexion par lien ne concerne que les simples "user"
|
||||
}
|
||||
else if ((this.status === 401 || this.status === 403) && response.errors != undefined)
|
||||
@ -75,11 +75,11 @@ const initialise = async () =>
|
||||
if(Array.isArray(response.errors))
|
||||
response.errors = response.errors.join("<br>");
|
||||
else
|
||||
response.errors = txt.serverError;
|
||||
response.errors = serverError;
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", txtUsers.badLinkValidationMessage.replace("#URL", configFrontEnd.connectionPage), "", ["error"]);
|
||||
addElement(divResponse, "p", badLinkValidationMessage.replace("#URL", configFrontEnd.connectionPage), "", ["error"]);
|
||||
}
|
||||
}
|
||||
datas.timeDifference=getTimeDifference(config);
|
||||
@ -93,7 +93,7 @@ const initialise = async () =>
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
initialise();
|
@ -25,17 +25,9 @@ import { getUrlParams } from "./tools/url.js";
|
||||
import { checkSession, getPassword } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txtAddOkMessage = require("../../lang/"+lang+"/general").addOkMessage;
|
||||
const txtServerError = require("../../lang/"+lang+"/general").serverError;
|
||||
const txtInfosAdminGodfather = require("../../lang/"+lang+"/user").infosAdminGodfather;
|
||||
const txtInfosAdminNbGodChilds = require("../../lang/"+lang+"/user").infosAdminNbGodChilds;
|
||||
const txtInfosUserForAdmin = require("../../lang/"+lang+"/user").infosUserForAdmin;
|
||||
const txtNeedBeConnected = require("../../lang/"+lang+"/user").needBeConnected;
|
||||
const txtNotFound = require("../../lang/"+lang+"/user").notFound;
|
||||
const txtInfosExpiratedAdmin = require("../../lang/"+lang+"/subscription").infosExpiratedAdmin;
|
||||
const txtInfosNbDaysAdmin = require("../../lang/"+lang+"/subscription").infosNbDaysAdmin;
|
||||
const txtInfosPaymentsAdmin = require("../../lang/"+lang+"/subscription").infosPaymentsAdmin;
|
||||
const txtIsNotValided = require("../../lang/"+lang+"/subscription").isNotValided;
|
||||
const { addOkMessage, serverError } = require("../../lang/"+lang+"/general");
|
||||
const { infosAdminGodfather, infosAdminNbGodChilds, infosUserForAdmin, needBeConnected, searchUsersWithoutResult } = require("../../lang/"+lang+"/user");
|
||||
const { infosExpiratedAdmin, infosNbDaysAdmin, infosPaymentsAdmin, isNotValided } = require("../../lang/"+lang+"/subscription");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const divMain = document.getElementById("main-content");
|
||||
@ -60,7 +52,7 @@ const initialise = async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
const isConnected=await checkSession(["manager", "admin"], "/"+configTemplate.connectionPage, { message: txtNeedBeConnected, color:"error" }, window.location);
|
||||
const isConnected=await checkSession(["manager", "admin"], "/"+configTemplate.connectionPage, { message: needBeConnected, color:"error" }, window.location);
|
||||
if(isConnected)
|
||||
{
|
||||
const user=getLocaly("user", true);
|
||||
@ -120,7 +112,7 @@ const initialise = async () =>
|
||||
DATE_UPDATE : dateFormat(response.User.updatedAt),
|
||||
DATE_CONNECTION : dateFormat(response.User.connectedAt)
|
||||
};
|
||||
let subscribeIntro=replaceAll(txtInfosUserForAdmin, mapText);
|
||||
let subscribeIntro=replaceAll(infosUserForAdmin, mapText);
|
||||
for(let data in response.User)
|
||||
{
|
||||
if(formUser.elements[data]!==undefined)
|
||||
@ -143,14 +135,14 @@ const initialise = async () =>
|
||||
const beginSubTS=new Date(response.Subscription.createdAt).getTime();
|
||||
const nbDaysOk=response.Subscription.numberOfDays-Math.round((Date.now()-beginSubTS)/1000/3600/24);
|
||||
if(nbDaysOk > 0)
|
||||
subscribeIntro+="<br>"+txtInfosNbDaysAdmin.replace("NB_DAYS", nbDaysOk);
|
||||
subscribeIntro+="<br>"+infosNbDaysAdmin.replace("NB_DAYS", nbDaysOk);
|
||||
else
|
||||
subscribeIntro+="<br>"+txtInfosExpiratedAdmin;
|
||||
subscribeIntro+="<br>"+infosExpiratedAdmin;
|
||||
addElement(divSubscribeIntro, "p", subscribeIntro, "", ["info"], "", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
addElement(divSubscribeIntro, "p", txtIsNotValided, "", ["error"]);
|
||||
addElement(divSubscribeIntro, "p", isNotValided, "", ["error"]);
|
||||
validationCheckBox.style.display="block";
|
||||
}
|
||||
deleteCheckBox.style.display="block";
|
||||
@ -175,7 +167,7 @@ const initialise = async () =>
|
||||
AMOUNT : responsePay[i].amount,
|
||||
CLIENT_NAME : responsePay[i].clientName
|
||||
};
|
||||
txtPayments+="<li>"+replaceAll(txtInfosPaymentsAdmin, mapText)+"</li>";
|
||||
txtPayments+="<li>"+replaceAll(infosNbDaysAdmin, mapText)+"</li>";
|
||||
}
|
||||
addElement(divPaymentsInfos, "ul", txtPayments, "", ["info"], "", false);
|
||||
divPaymentsInfos.style.display="block"
|
||||
@ -198,7 +190,7 @@ const initialise = async () =>
|
||||
let responseGF=JSON.parse(this.responseText);
|
||||
if (this.status === 200 && responseGF.User != undefined)
|
||||
{
|
||||
addElement(divGodchildsInfos, "p", txtInfosAdminGodfather+"<a href='/"+configTemplate.usersManagementPage+"?id="+responseGF.User.id+"'>"+responseGF.User.name+"</a>"+".<br>", "", ["info"], "", false);
|
||||
addElement(divGodchildsInfos, "p", infosAdminGodfather+"<a href='/"+configTemplate.usersManagementPage+"?id="+responseGF.User.id+"'>"+responseGF.User.name+"</a>"+".<br>", "", ["info"], "", false);
|
||||
divGodchildsInfos.style.display="block";
|
||||
}
|
||||
}
|
||||
@ -220,7 +212,7 @@ const initialise = async () =>
|
||||
{
|
||||
if(responseGS.length!==0)
|
||||
{
|
||||
txtGodchilds+=txtInfosAdminNbGodChilds.replace("#NB", responseGS.length);
|
||||
txtGodchilds+=infosAdminGodfather.replace("#NB", responseGS.length);
|
||||
for(let i in responseGS)
|
||||
txtGodchilds+="<a href='/"+configTemplate.usersManagementPage+"?id="+responseGS[i].id+"'>"+responseGS[i].name+"</a>";
|
||||
addElement(divGodchildsInfos, "p", txtGodchilds+".", "", ["info"], "", false);
|
||||
@ -286,7 +278,7 @@ const initialise = async () =>
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 201 && response.id!=undefined)
|
||||
{
|
||||
addElement(divResponse, "p", txtAddOkMessage, "", ["success"]);
|
||||
addElement(divResponse, "p", addOkMessage, "", ["success"]);
|
||||
datas.id=response.id;
|
||||
}
|
||||
else if (this.status === 200 && response.message!=undefined)
|
||||
@ -302,11 +294,11 @@ const initialise = async () =>
|
||||
if(Array.isArray(response.errors))
|
||||
response.errors = response.errors.join("<br>");
|
||||
else
|
||||
response.errors = txtServerError;
|
||||
response.errors = serverError;
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
if(isEmpty(response.errors))
|
||||
{
|
||||
if(datas.deleteOk===undefined)
|
||||
@ -337,7 +329,7 @@ const initialise = async () =>
|
||||
if (this.status === 200 && Array.isArray(response))
|
||||
{
|
||||
if(response.length===0)
|
||||
addElement(divSearchResult, "p", txtNotFound, "", ["info"]);
|
||||
addElement(divSearchResult, "p", searchUsersWithoutResult, "", ["info"]);
|
||||
else
|
||||
{
|
||||
let selectHTML="<option value=''></option>";
|
||||
@ -353,7 +345,7 @@ const initialise = async () =>
|
||||
}
|
||||
}
|
||||
else
|
||||
addElement(divSearchResult, "p", txtServerError, "", ["error"]);
|
||||
addElement(divSearchResult, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhrSearch.setRequestHeader("Content-Type", "application/json");
|
||||
@ -365,7 +357,7 @@ const initialise = async () =>
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divCrash, "p", txtServerError, "", ["error"]);
|
||||
addElement(divCrash, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ import { getUrlParams } from "./tools/url.js";
|
||||
import { checkSession, getConfig, setSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txt = require("../../lang/"+lang+"/general");
|
||||
const txtUsers = require("../../lang/"+lang+"/user");
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { badLinkValidationMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
const divResponse = document.getElementById("response");
|
||||
|
||||
@ -30,7 +30,7 @@ const initialise = async () =>
|
||||
{
|
||||
config = await getConfig();
|
||||
if(!config)
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
else
|
||||
{
|
||||
const datas=getUrlParams();
|
||||
@ -54,11 +54,11 @@ const initialise = async () =>
|
||||
if(Array.isArray(response.errors))
|
||||
response.errors = response.errors.join("<br>");
|
||||
else
|
||||
response.errors = txt.serverError;
|
||||
response.errors = serverError;
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", txtUsers.badLinkValidationMessage.replace("#URL", configFrontEnd.accountPage), "", ["error"]);
|
||||
addElement(divResponse, "p", badLinkValidationMessage.replace("#URL", configFrontEnd.accountPage), "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhr.setRequestHeader("Authorization", "Bearer "+datas.t);
|
||||
@ -68,7 +68,7 @@ const initialise = async () =>
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// -- GESTION DE LA PAGE DU FINANCEMENT PARTICIPATIF (SANS DEVOIR ÊTRE CONNECTÉ)
|
||||
|
||||
/// Permet d'afficher les boutons de paiement WP suivant le choix de l'utilisateur.
|
||||
/// Matomo est également activité son internaute non connecté.
|
||||
/// Matomo est également activé si l'internaute n'est pas connecté.
|
||||
|
||||
// Fichier de configuration tirés du backend :
|
||||
import { availableLangs, theme } from "../../config/instance.js";
|
||||
|
@ -21,8 +21,8 @@ import { loadMatomo } from "./tools/matomo.js";
|
||||
import { checkSession, getTimeDifference } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txtServerError = require("../../lang/"+lang+"/general").serverError;
|
||||
const txtAnswers = require("../../lang/"+lang+"/answer");
|
||||
const { noPreviousAnswer, previousAnswersLine, previousAnswersStats, previousAnswersTitle, responseSavedError, wantToSaveResponses } = require("../../lang/"+lang+"/answer");
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const myForm = document.getElementById("questionnaire");
|
||||
@ -83,7 +83,7 @@ btnShow.addEventListener("click", function(e)
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
});
|
||||
@ -160,7 +160,7 @@ myForm.addEventListener("submit", function(e)
|
||||
checkPreviousResponses(user);
|
||||
}
|
||||
else
|
||||
getOuput+="<br>"+txtAnswers.responseSavedError.replace("#URL", configTemplate.userHomePage);
|
||||
getOuput+="<br>"+responseSavedError.replace("#URL", configTemplate.userHomePage);
|
||||
// on redirige vers le résultat
|
||||
window.location.hash="";
|
||||
const here=window.location;// window.location à ajouter pour ne pas quitter la page en mode "preview"...
|
||||
@ -176,7 +176,7 @@ myForm.addEventListener("submit", function(e)
|
||||
{ // si pas connecté, on enregistre le résultat côté client pour permettre de le retrouver au moment de la création du compte ou de la connexion.
|
||||
if(saveAnswer(answer))
|
||||
{
|
||||
getOuput+="<br><br>"+txtAnswers.wantToSaveResponses;
|
||||
getOuput+="<br><br>"+wantToSaveResponses;
|
||||
addElement(divResponse, "p", getOuput, "", ["info"]);
|
||||
document.querySelector(".subscribeBtns").style.display="block";
|
||||
}
|
||||
@ -197,7 +197,7 @@ myForm.addEventListener("submit", function(e)
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
})
|
||||
@ -217,7 +217,7 @@ const checkPreviousResponses = (user) =>
|
||||
{
|
||||
const nbResponses=response.length;
|
||||
let previousAnswersContent="";
|
||||
addElement(explanationsTitle, "span", txtAnswers.previousAnswersTitle.replace("#NOM", user.name));
|
||||
addElement(explanationsTitle, "span", previousAnswersTitle.replace("#NOM", user.name));
|
||||
if(nbResponses!==0)
|
||||
{
|
||||
let totNbQuestions=0, totNbCorrectAnswers=0, totDuration=0, mapLineContent;
|
||||
@ -233,18 +233,18 @@ const checkPreviousResponses = (user) =>
|
||||
NBQUESTIONS : response[i].nbQuestions,
|
||||
AVGDURATION : response[i].duration
|
||||
};
|
||||
previousAnswersContent+="<li>"+replaceAll(txtAnswers.previousAnswersLine, mapLineContent)+"</li>";
|
||||
previousAnswersContent+="<li>"+replaceAll(previousAnswersLine, mapLineContent)+"</li>";
|
||||
}
|
||||
mapLineContent =
|
||||
{
|
||||
AVGDURATION : Math.round(totDuration/nbResponses),
|
||||
AVGCORRECTANSWERS : Math.round(totNbCorrectAnswers/totNbQuestions*100)
|
||||
};
|
||||
previousAnswersContent="<h5>"+replaceAll(txtAnswers.previousAnswersStats, mapLineContent)+"</h5>"+previousAnswersContent;
|
||||
previousAnswersContent="<h5>"+replaceAll(previousAnswersStats, mapLineContent)+"</h5>"+previousAnswersContent;
|
||||
addElement(explanationsContent, "ul", previousAnswersContent);
|
||||
}
|
||||
else
|
||||
addElement(explanationsContent, "ul", txtAnswers.noPreviousAnswer);
|
||||
addElement(explanationsContent, "ul", noPreviousAnswer);
|
||||
// dans un cas comme dans l'autre, bouton pour revenir à l'accueil du compte
|
||||
addElement(explanationsContent, "p", "<a href=\"/"+configTemplate.userHomePage+"\" class=\"button cardboard\">"+configTemplate.userHomePageTxt+"</a>", "", ["btn"], "", false);
|
||||
|
||||
|
@ -19,9 +19,8 @@ import { loadMatomo } from "./tools/matomo.js";
|
||||
import { checkAnswerDatas, checkSession, getPassword, getTimeDifference } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txtServerError = require("../../lang/"+lang+"/general").serverError;
|
||||
const txtNotRequired = require("../../lang/"+lang+"/general").notRequired;
|
||||
const txtUsers = require("../../lang/"+lang+"/user");
|
||||
const { notRequired, serverError } = require("../../lang/"+lang+"/general");
|
||||
const { alreadyConnected, godfatherFound, godfatherNotFound, needUniqueEmail, passwordCopied } = require("../../lang/"+lang+"/user");
|
||||
|
||||
// Principaux éléments du DOM manipulés :
|
||||
const myForm=document.getElementById("subscription");
|
||||
@ -43,7 +42,7 @@ const initialise = async () =>
|
||||
const isConnected=await checkSession();
|
||||
if(isConnected)
|
||||
{
|
||||
saveLocaly("message", { message: txtUsers.alreadyConnected, color:"info" });// pour l'afficher sur la page suivante
|
||||
saveLocaly("message", { message: alreadyConnected, color:"info" });// pour l'afficher sur la page suivante
|
||||
const user=getLocaly("user", true);
|
||||
const homePage=user.status+"HomePage";
|
||||
window.location.assign("/"+configTemplate[homePage]);
|
||||
@ -57,7 +56,7 @@ const initialise = async () =>
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
@ -72,7 +71,7 @@ passwordLink.addEventListener("click", function(e)
|
||||
// Copie du mot de passe généré dans le "presse-papier" de l'ordinateur :
|
||||
passwordInput.select();
|
||||
document.execCommand("copy");
|
||||
addElement(passwordHelp, "div", txtUsers.passwordCopied, "", ["success"]);
|
||||
addElement(passwordHelp, "div", passwordCopied, "", ["success"]);
|
||||
});
|
||||
|
||||
// Test si l'e-mail saisi est déjà utilisé par un autre compte.
|
||||
@ -95,7 +94,7 @@ emailInput.addEventListener("blur", function(e)
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 200 && response.free!==undefined && response.free === false)
|
||||
{
|
||||
addElement(document.getElementById("emailMessage"), "div", txtUsers.needUniqueEmail.replace("#URL", configTemplate.connectionPage), "", ["error"]);
|
||||
addElement(document.getElementById("emailMessage"), "div", needUniqueEmail.replace("#URL", configTemplate.connectionPage), "", ["error"]);
|
||||
btnSubmit.setAttribute("disabled", true);
|
||||
}
|
||||
else
|
||||
@ -111,7 +110,7 @@ emailInput.addEventListener("blur", function(e)
|
||||
// Vérification que le code/e-mail de parrainage saisi est valide.
|
||||
codeGodfatherInput.addEventListener("focus", function(e)
|
||||
{ // on efface l'éventuel message d'erreur si on revient sur le champ pour tester un autre code.
|
||||
addElement(document.getElementById("codeGodfatherMessage"), "i", txtNotRequired);
|
||||
addElement(document.getElementById("codeGodfatherMessage"), "i", notRequired);
|
||||
});
|
||||
codeGodfatherInput.addEventListener("blur", function(e)
|
||||
{
|
||||
@ -125,9 +124,9 @@ codeGodfatherInput.addEventListener("blur", function(e)
|
||||
if (this.readyState == XMLHttpRequest.DONE)
|
||||
{
|
||||
if (this.status === 204)
|
||||
addElement(document.getElementById("codeGodfatherMessage"), "div", txtUsers.godfatherNotFound, "", ["error"]);
|
||||
addElement(document.getElementById("codeGodfatherMessage"), "div", godfatherNotFound, "", ["error"]);
|
||||
else
|
||||
addElement(document.getElementById("codeGodfatherMessage"), "div", txtUsers.godfatherFound, "", ["success"]);
|
||||
addElement(document.getElementById("codeGodfatherMessage"), "div", godfatherFound, "", ["success"]);
|
||||
}
|
||||
}
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
@ -161,7 +160,7 @@ myForm.addEventListener("submit", function(e)
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
@ -176,7 +175,7 @@ myForm.addEventListener("submit", function(e)
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
console.error(e);
|
||||
}
|
||||
});
|
@ -21,8 +21,8 @@ import { getUrlParams } from "./tools/url.js";
|
||||
import { checkSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txtServerError = require("../../lang/"+lang+"/general").serverError;
|
||||
const txtUsers = require("../../lang/"+lang+"/user");
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { alreadyConnected, badLinkValidationMessage, validationMessage } = require("../../lang/"+lang+"/user");
|
||||
|
||||
const divResponse = document.getElementById("response");
|
||||
|
||||
@ -34,7 +34,7 @@ const initialise = async () =>
|
||||
const isConnected=await checkSession();
|
||||
if(isConnected)
|
||||
{
|
||||
saveLocaly("message", { message: txtUsers.alreadyConnected, color:"info" });
|
||||
saveLocaly("message", { message: alreadyConnected, color:"info" });
|
||||
const user=getLocaly("user", true);
|
||||
const homePage=user.status+"HomePage";// lors de la création d'un compte, seul le statut "user" est possible.
|
||||
window.location.assign("/"+configTemplate[homePage]);
|
||||
@ -54,7 +54,7 @@ const initialise = async () =>
|
||||
let response=JSON.parse(this.responseText);
|
||||
if (this.status === 200 && response.userId != undefined && response.token != undefined)
|
||||
{
|
||||
saveLocaly("message", { message: txtUsers.validationMessage, color:"success" });// pour l'afficher sur la page suivante
|
||||
saveLocaly("message", { message: validationMessage, color:"success" });// pour l'afficher sur la page suivante
|
||||
window.location.assign("/"+configTemplate.connectionPage);
|
||||
}
|
||||
else if ((this.status === 200 || this.status === 404) && response.errors != undefined)
|
||||
@ -63,7 +63,7 @@ const initialise = async () =>
|
||||
addElement(divResponse, "p", response.errors, "", ["error"]);
|
||||
}
|
||||
else
|
||||
addElement(divResponse, "p", txtUsers.badLinkValidationMessage.replace("#URL", configTemplate.connectionPage), "", ["error"]);
|
||||
addElement(divResponse, "p", badLinkValidationMessage.replace("#URL", configTemplate.connectionPage), "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhr.send();
|
||||
@ -73,7 +73,7 @@ const initialise = async () =>
|
||||
catch(e)
|
||||
{
|
||||
console.error(e);
|
||||
addElement(divResponse, "p", txtServerError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
initialise();
|
||||
|
@ -17,9 +17,8 @@ import { getUrlParams } from "./tools/url.js";
|
||||
import { checkSession, getConfig, setSession } from "./tools/users.js";
|
||||
|
||||
// Dictionnaires :
|
||||
const txt = require("../../lang/"+lang+"/general");
|
||||
const txtUsers = require("../../lang/"+lang+"/user");
|
||||
const txtSubscriptions = require("../../lang/"+lang+"/subscription");
|
||||
const { serverError } = require("../../lang/"+lang+"/general");
|
||||
const { unsubscriptionFail } = require("../../lang/"+lang+"/subscription");
|
||||
|
||||
const divResponse = document.getElementById("response");
|
||||
|
||||
@ -32,7 +31,7 @@ const initialise = async () =>
|
||||
{
|
||||
config = await getConfig();
|
||||
if(!config)
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
else
|
||||
{
|
||||
const datas=getUrlParams();
|
||||
@ -48,7 +47,7 @@ const initialise = async () =>
|
||||
if (this.status === 200 && response.message != undefined)
|
||||
addElement(divResponse, "p", response.message.replace("#URL", configFrontEnd.accountPage), "", ["success"]);
|
||||
else
|
||||
addElement(divResponse, "p", txtSubscriptions.unsubscriptionFail.replace("#URL", configFrontEnd.accountPage), "", ["error"]);
|
||||
addElement(divResponse, "p", unsubscriptionFail.replace("#URL", configFrontEnd.accountPage), "", ["error"]);
|
||||
}
|
||||
}
|
||||
xhr.send();
|
||||
@ -57,7 +56,7 @@ const initialise = async () =>
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
addElement(divResponse, "p", txt.serverError, "", ["error"]);
|
||||
addElement(divResponse, "p", serverError, "", ["error"]);
|
||||
}
|
||||
}
|
||||
initialise();
|
@ -28,13 +28,12 @@ module.exports =
|
||||
needUrl: "Merci de fournir l'url à votre quiz.",
|
||||
nextDateWithoutQuestionnaire: "Prochaine date sans quiz programmé : ",
|
||||
nextQuestionnairesList: "Les #NB prochains quizs devant être publiés",
|
||||
notFound : "Aucun quiz n'a pas été trouvé.",
|
||||
questionnairesName: "quiz",
|
||||
questionnaireNeedBeCompleted: "Quiz incomplet",
|
||||
publishedAt: ", le",
|
||||
publishedBy: "Quiz publié par",
|
||||
searchQuestionnaireResultTitle : "Résultat pour votre recherche",
|
||||
searchQuestionnaireWithNoResult : "Aucun quiz n'a été trouvé pour votre recherche.",
|
||||
searchResultTitle : "Résultat pour votre recherche",
|
||||
searchWithResult : "Voici #NB quizs pour votre recherche :",
|
||||
searchQuestionnaireWithResult : "Voici #NB quizs pour votre recherche :",
|
||||
wrongAnswerTxt: "Mauvaise réponse"
|
||||
};
|
@ -70,8 +70,8 @@ module.exports =
|
||||
needUniqueEmail: "L'adresse e-mail que vous avez saisie est déjà utilisée pour un compte utilisateur. Si vous avez déjà un compte, <a href='/#URL'>cliquez-ici pour vous connecter</a>.",
|
||||
needValidationToLogin : "Vous devez d'abord valider votre compte avant de pouvoir vous connecter. Pour ce faire, un nouveau lien vient de vous être envoyé par e-mail.",
|
||||
needValidLastConnectionDate : "La date de dernière connexion n'est pas valide.",
|
||||
notFound: "L'utilisateur n'a pas été trouvé.",
|
||||
passwordCopied: "Le mot de passe généré a été copié dans le presse-papier de votre ordinateur (ou mobile). Vous pouvez le \"coller\" où vous le souhaitez.",
|
||||
searchUsersWithoutResult: "L'utilisateur n'a pas été trouvé.",
|
||||
tooManyLoginFails : "Désolé mais il y a eu trop de tentatives de connexion infructueuses pour cette adresse e-mail. Vous devez attendre MINUTES minutes pour essayer de nouveau.",
|
||||
updatedFailedGodfatherNotFound : "L'identifiant fourni pour le parrain ne correspond à aucun utilisateur.",
|
||||
updatedNeedGoodEmail : "Mais la nouvelle adresse e-mail n'a pu être enregistrée, car elle n'a pas un format correct.",
|
||||
|
Loading…
Reference in New Issue
Block a user