clean code
This commit is contained in:
		| @@ -124,9 +124,21 @@ Pagans.sendmailkey = (data) => { | |||||||
|   person.avecpassphrase=(person.passphrase!="") |   person.avecpassphrase=(person.passphrase!="") | ||||||
|   console.log("person:", person); |   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 = { |   const maildata = { | ||||||
|     to: person.email, |     to: person.email, | ||||||
|     subject: Mustache.render(tplemail.subject, person), |     subject: Mustache.render(tplemail.subject, person), | ||||||
|   | |||||||
| @@ -10,5 +10,6 @@ | |||||||
|   "errcreate": "Desolé, un probléme inconnu empeche la creation", |   "errcreate": "Desolé, un probléme inconnu empeche la creation", | ||||||
|   "logout": "Votre token a été supprimé du server", |   "logout": "Votre token a été supprimé du server", | ||||||
|   "emailnotfound":"Auncune identité n'a été enregistrée sur {{tribe}} avec l'email {{email}} ", |   "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" | ||||||
| } | } | ||||||
|   | |||||||
| @@ -111,7 +111,7 @@ router.get("/isauth", checkHeaders, isAuthenticated, (req, res) => { | |||||||
|  * @apiBody {string} [privatekey] |  * @apiBody {string} [privatekey] | ||||||
|  * @apiBody {string} [passphrase] if not specidied => passphrase="" |  * @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 {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 <a href='https://wall-ants.ndda.fr/nationchains/schema/pagans.json' target='_blank'>https://wall-ants.ndda.fr/nationchains/schema/pagans.json</a> |  *  @apiBody {object} schema:pagans <a href='/nationchains/schema/pagans.json' target='_blank'>/nationchains/schema/pagans.json</a> | ||||||
|  *  |  *  | ||||||
|  * @apiError {json} objectNotfound the file does not exist  |  * @apiError {json} objectNotfound the file does not exist  | ||||||
|  * @apiErrorExample {json} |  * @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 |  * @apiName  recoveryKey | ||||||
|  * @apiGroup Pagans |  * @apiGroup Pagans | ||||||
|  * @apiDescription Send to email recovery if exist key files  |  * @apiDescription Send to email recovery if exist key files  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user