checkemail end point notification
This commit is contained in:
@@ -29,7 +29,7 @@ const router = express.Router();
|
|||||||
* {"status":200, "ref":"Articles", "msg":"evaluationsaved", "data":{article}}
|
* {"status":200, "ref":"Articles", "msg":"evaluationsaved", "data":{article}}
|
||||||
*
|
*
|
||||||
* @apiError {object} notfound
|
* @apiError {object} notfound
|
||||||
* @apiErrorexampleExample {json} notfound
|
* @apiErrorExample {json} notfound
|
||||||
* HTTP/1.1 200 OK
|
* HTTP/1.1 200 OK
|
||||||
* {"status":404, "ref":"Articles", "msg":"notfound", "data":{articleid}}
|
* {"status":404, "ref":"Articles", "msg":"notfound", "data":{articleid}}
|
||||||
*
|
*
|
||||||
@@ -68,7 +68,7 @@ router.get(
|
|||||||
* HTTP/1.1 404 Not Found
|
* HTTP/1.1 404 Not Found
|
||||||
{"status":404,"ref":"Articles","msg":"articleidnotfound","data":{}}
|
{"status":404,"ref":"Articles","msg":"articleidnotfound","data":{}}
|
||||||
*
|
*
|
||||||
* @apiSuccess {object}
|
* @apiSuccess {object} success
|
||||||
* @apiSuccessExample {json} Success-Response:
|
* @apiSuccessExample {json} Success-Response:
|
||||||
* HTTP/1.1 200 OK
|
* HTTP/1.1 200 OK
|
||||||
* {"status":200, "ref":"Articles", "msg":"commentsaved", "data":{}}
|
* {"status":200, "ref":"Articles", "msg":"commentsaved", "data":{}}
|
||||||
|
|||||||
@@ -249,6 +249,25 @@ router.get("/contact", checkHeaders, isAuthenticated, (req, res) => {
|
|||||||
res.status(200).json({ data: {} });
|
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) => {
|
router.get("/checkemail/:email/:digit6", checkHeaders, async (req, res) => {
|
||||||
const { email, digit6 } = req.params;
|
const { email, digit6 } = req.params;
|
||||||
const tmpDir = path.join(__dirname, "../../../../tmp");
|
const tmpDir = path.join(__dirname, "../../../../tmp");
|
||||||
|
|||||||
Reference in New Issue
Block a user