diff --git a/apxtri/routes/articles.js b/apxtri/routes/articles.js index ece966e..2003eaf 100644 --- a/apxtri/routes/articles.js +++ b/apxtri/routes/articles.js @@ -23,13 +23,13 @@ const router = express.Router(); * @apiParam {string} articleid an existing articleid in tribe/objects/articles/itm * @apiParam {string} evaluation a value from 0 to 4 or follow * - * @apiSuccess {object} successfull + * @apiSuccess {object} successfull * @apiSuccessExample {json} successfullmessage * HTTP/1.1 200 OK * {"status":200, "ref":"Articles", "msg":"evaluationsaved", "data":{article}} * - * @apiError {object} notfound - * @apiErrorexampleExample {json} notfound + * @apiError {object} notfound + * @apiErrorExample {json} notfound * HTTP/1.1 200 OK * {"status":404, "ref":"Articles", "msg":"notfound", "data":{articleid}} * @@ -68,7 +68,7 @@ router.get( * HTTP/1.1 404 Not Found {"status":404,"ref":"Articles","msg":"articleidnotfound","data":{}} * - * @apiSuccess {object} + * @apiSuccess {object} success * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK * {"status":200, "ref":"Articles", "msg":"commentsaved", "data":{}} diff --git a/apxtri/routes/notifications.js b/apxtri/routes/notifications.js index 95d2c0d..7d2bdb9 100644 --- a/apxtri/routes/notifications.js +++ b/apxtri/routes/notifications.js @@ -249,6 +249,25 @@ router.get("/contact", checkHeaders, isAuthenticated, (req, res) => { res.status(200).json({ data: {} }); }); +/** + * @api {GET} /adminapi/notifications/checkemail/:email/:digit6 - Check or verify email with code + * @apiName checkemail + * @apiGroup Notifications + * @apiDescription If digit6="0": generate a 6-digit code, store in tmp/{email}, and send email with the code. If digit6!="0": verify the code matches tmp/{email} and remove the file on success. + * @apiParam {string} email The email address to verify + * @apiParam {string} digit6 "0" to request a code, or a 6-digit code to verify + * @apiSuccess {object} success response + * @apiSuccessExample {json} Success-Response (code sent): + * HTTP/1.1 200 OK + * {"status":200,"ref":"Notifications","msg":"emailmanage","data":{"emailsucces":1,"emailfail":0}} + * @apiSuccessExample {json} Success-Response (code verified): + * HTTP/1.1 200 OK + * {"status":200,"ref":"Notifications","msg":"emailverified","data":{"email":"test@example.com","verified":true}} + * @apiError (404) {object} codenotfound - Code file not found (expired or invalid) + * @apiErrorExample {json} 404 Response: + * HTTP/1.1 404 OK + * {"status":404,"ref":"Notifications","msg":"codenotfound","data":{"email":"test@example.com"}} + */ router.get("/checkemail/:email/:digit6", checkHeaders, async (req, res) => { const { email, digit6 } = req.params; const tmpDir = path.join(__dirname, "../../../../tmp");