Browse Source

fixed bug

re-sending contact verification upon login
pull/4/head
Nareshkumar Rao 3 years ago
parent
commit
31ee1c2d3c
  1. 9
      src/routes/LoginRoute.js

9
src/routes/LoginRoute.js

@ -4,8 +4,16 @@ const { addContact, createUser } = require("../db/utils");
function LoginRoute(req, res) { function LoginRoute(req, res) {
const telegramResponse = req.body.telegramResponse; const telegramResponse = req.body.telegramResponse;
authUser(telegramResponse, (success, msg) => { authUser(telegramResponse, (success, msg) => {
if (success) { if (success) {
// User is already logged in
if(req.session.user == telegramResponse.id){
res.send({authorized: success});
return;
}
const verified = req.session.verified; const verified = req.session.verified;
const verifiedBy = req.session.verifiedBy; const verifiedBy = req.session.verifiedBy;
req.session.regenerate(() => { req.session.regenerate(() => {
@ -26,6 +34,7 @@ function LoginRoute(req, res) {
res.status(401).send({ authorized: success, message: msg }); res.status(401).send({ authorized: success, message: msg });
} }
}); });
} }
function authUser(telegramResponse, done) { function authUser(telegramResponse, done) {

Loading…
Cancel
Save