Browse Source

verified users sent success on login

feature/telegramLogin
Nareshkumar Rao 3 years ago
parent
commit
3866148894
  1. 10
      app.js

10
app.js

@ -195,10 +195,18 @@ app.post('/login', (req, res) => {
reqTelegram = req.body.telegram.toLowerCase(); reqTelegram = req.body.telegram.toLowerCase();
const auth = authUser(reqTelegram, req.body.password, (success, msg) => { const auth = authUser(reqTelegram, req.body.password, (success, msg) => {
if (success) { if (success) {
const verified = req.session.verified;
const verifiedBy = req.session.verifiedBy;
req.session.regenerate(() => { req.session.regenerate(() => {
cookieExpiry = getCookieExpiry(); cookieExpiry = getCookieExpiry();
req.session.user = reqTelegram; 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 { } else {
res.status(401).send({ authorized: success, message: msg }); res.status(401).send({ authorized: success, message: msg });

Loading…
Cancel
Save