From 38661488943d722e755af942a6578c71b57ceccc Mon Sep 17 00:00:00 2001 From: Nareshkumar Rao Date: Tue, 27 Jul 2021 18:18:25 +0200 Subject: [PATCH] verified users sent success on login --- app.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index e9defa0..0ba3c71 100644 --- a/app.js +++ b/app.js @@ -195,10 +195,18 @@ app.post('/login', (req, res) => { reqTelegram = req.body.telegram.toLowerCase(); const auth = authUser(reqTelegram, req.body.password, (success, msg) => { if (success) { + const verified = req.session.verified; + const verifiedBy = req.session.verifiedBy; req.session.regenerate(() => { cookieExpiry = getCookieExpiry(); req.session.user = reqTelegram; - res.send({ authorized: success, message: msg }) + if (verified) { + addContact(reqTelegram, verifiedBy, (contactSuccess) => { + res.send({ authorized: success, message: msg, contactSuccess: contactSuccess }); + }); + } else { + res.send({ authorized: success, message: msg }); + } }); } else { res.status(401).send({ authorized: success, message: msg });