fix substring

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

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;