diff --git a/models/Pagans.js b/models/Pagans.js
index eaa177e..fdfcfbe 100644
--- a/models/Pagans.js
+++ b/models/Pagans.js
@@ -123,10 +123,22 @@ Pagans.sendmailkey = (data) => {
}
person.avecpassphrase=(person.passphrase!="")
console.log("person:", person);
-
- const tplemail = require(`../../nationchains/tribes/adminapi/template/createidentity_${data.lg}.js`)
- person.message
+
+ let tplfile=`../../nationchains/tribes/${data.tribe}/template/createidentity_${data.lg}.js`;
+ if (!existsSync(tpfile)){
+ tplfile=`../../nationchains/tribes/adminapi/template/createidentity_${data.lg}.js`;
+ if (!existsSync(tplfile)){
+ return {
+ status:406,
+ ref:"Pagans",
+ msg:"templatedoesnotexist",
+ data:{tplfile}
+ }
+ }
+ }
+ const tplemail = require(tplfile)
+
const maildata = {
to: person.email,
subject: Mustache.render(tplemail.subject, person),
diff --git a/models/lg/Pagans_fr.json b/models/lg/Pagans_fr.json
index d868d47..3ec4113 100644
--- a/models/lg/Pagans_fr.json
+++ b/models/lg/Pagans_fr.json
@@ -10,5 +10,6 @@
"errcreate": "Desolé, un probléme inconnu empeche la creation",
"logout": "Votre token a été supprimé du server",
"emailnotfound":"Auncune identité n'a été enregistrée sur {{tribe}} avec l'email {{email}} ",
- "recoveryemailsent":"Votre email: {{email}} dispose de {{nbalias}} identitées sur {{tribe}}, nous avons envoyés {{nbsent}} messages sans problèmes."
+ "recoveryemailsent":"Votre email: {{email}} dispose de {{nbalias}} identitées sur {{tribe}}, nous avons envoyés {{nbsent}} messages sans problèmes.",
+ "templatedoesnotexist":"Le template {{tplfile}} n'existe pas"
}
diff --git a/routes/pagans.js b/routes/pagans.js
index 2af83cc..8f28352 100755
--- a/routes/pagans.js
+++ b/routes/pagans.js
@@ -111,7 +111,7 @@ router.get("/isauth", checkHeaders, isAuthenticated, (req, res) => {
* @apiBody {string} [privatekey]
* @apiBody {string} [passphrase] if not specidied => passphrase=""
* @apiBody {string} [trustedtribe] the tribename if not specified then the process will only create a pagan identity, else an item person is create for trustedtribe (that must exist with profil 'person'). To create a person with an existing pagan identity use put /api/person/:alias after authenticated you (headers). In case a person is created then we use all valid other apiBody respecting the persons schema (see put persons)
- * @apiBody {object} schema:pagans https://wall-ants.ndda.fr/nationchains/schema/pagans.json
+ * @apiBody {object} schema:pagans /nationchains/schema/pagans.json
*
* @apiError {json} objectNotfound the file does not exist
* @apiErrorExample {json}
@@ -321,7 +321,7 @@ router.get("/keyrecovery/:tribe/:email", checkHeaders, (req, res) => {
}
});
/**
- * @api {get} /pagans/keyrecovery/tribe/alias - recovery keys by alias
+ * @api {get} /pagans/keyrecovery/:tribe/:alias - recovery keys by alias
* @apiName recoveryKey
* @apiGroup Pagans
* @apiDescription Send to email recovery if exist key files