1
0
forked from apxtri/apxtri

fix substring

This commit is contained in:
philc 2024-04-16 15:37:33 +02:00
parent 063df74b14
commit 9651b2b3d2
3 changed files with 15 additions and 30 deletions

View File

@ -16,7 +16,16 @@ const log = conf.api.activelog.includes(currentmod)
* @apiHeader {array[]} xprofils list of string profil apply into xtribe for xapp
* @apiHeader {string} xuuid a unique number uuid.v4 created the fisrt time a domain is visited on a device
* @apiHeader {integer} xtrkversion a version number link to tracking system
*
* @apiHeaderExample {json} Header-Example for anonymous:
* {
* "xtrkversion":1,
* "xtribe":"smatchit",
* "xapp":"presentation",
* "xlang":"fr",
* "xalias":"anonymous",
* "xhash":"anonymous",
* "xdays":0
* }
* @apiHeaderExample {json} Header-Example:
* {
* Cache-Control: "no-cache",

View File

@ -88,13 +88,13 @@ Pagans.sendmailkey = (data) => {
if (log) console.log(currentmod,
data.alias,
"-",
data.privatekey.substring(0,10),
(data.privatekey)?data.privatekey.substring(0,10):"",
"-",
data.tribe,
"-",
data.passphrase,
"-",
data.publickey.substring(0,10),
(data.publickey)? data.publickey.substring(0,10):"",
"-",
data.email,
"-",

View File

@ -219,7 +219,7 @@ router.delete("/alias/:alias", checkHeaders, isAuthenticated, (req, res) => {
* @apiName deleteperson
* @apiGroup Pagans
* @apiDescription
* Unsubscribe a person to a tribe => remove a person item and all data link to this alias
* Unsubscribe a person to a tribe => remove a person item and all data link to this alias. An asynchrone process turn each day to clean data in tribe, if a persons does not exist anymore in the tribe. Pagans alias is still existing as it is autonomous. It is possible to delete pagans see "pagan Delete".
* @apiHeader {array} xprofils list of profil of authenticated user
* @apiHeader {string} xalias current user
* @apiParam {string} tribe where person alias exist
@ -302,7 +302,7 @@ router.put("/person/:tribe", checkHeaders, isAuthenticated, (req, res) => {
* HTTP/1.1 200 OK
* {"status":200, "ref":"Pagans", "msg":"recoveryemailsent", "data":{email,tribe,numberemailsent'}}
*
* @apiError (404) {string} emailnotfound email does not exist for this tribe
* @apiError (404) {string} recoveryemailnotfound email does not exist for this tribe
* @apiErrorExample {json}
* {status: 404, ref:"pagans",msg:"recoveryemailnotfound",data: { tribe,email } }
*
@ -340,29 +340,5 @@ router.post("/keyrecovery", checkHeaders, (req, res) => {
res.status(404).json({status:404,ref:"Pagans",msg:"recoveryemailnotfound",data:{tribe:req.body.tribe}});
}
});
/**
* @api {get} adminapi/pagans/keyrecovery/:tribe/:alias - recovery keys by alias
* @apiName recoveryKey
* @apiGroup Pagans
* @apiDescription Send to email recovery if exist key files
*
* @apiSuccess {object} send recovery mail for alias
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* {"status":200, "ref":"Pagans", "msg":"recoveryemailsent", "data":{email,tribe,nbalias:1, nbqent:1 or 0}}
*
* @apiError (404) {string} emailnotfound email does not exist for this tribe
* @apiErrorExample {json}
* {status: 404, ref:"pagans",msg:"emailnotfound",data: { tribe,email } }
*
*/
router.get("/keyrecovery/:tribe/:alias", checkHeaders, (req, res) => {
// a tester et revoir
const ret = Pagans.sendmailkey({alias:req.params.alias,tribe:req.params.tribe,lg:req.session.header.xlang})
if (ret.status==200){
return {status:200,ref:"Pagans",msg:"recoveryemailsent",data:{email:"",tribe:req.params.tribe,nbalias:1, nbsent:1}}
}else{
return {status:404,ref:"Pagans",msg:"emailnotfound",data:{tribe:req.params.tribe,email:req.params.email}}
}
});
module.exports = router;