Fix authentication
[vchess.git] / server / routes / users.js
index 4b142d7..d633d81 100644 (file)
@@ -17,7 +17,6 @@ router.get("/whoami", access.ajax, (req,res) => {
     });
   };
   const anonymous = {name:"", email:"", id:0, notify:false};
-  console.log(req.cookies); //TODO: cookie not found after authenticate ?
        if (!req.cookies.token)
     return callback(anonymous);
   UserModel.getOne("sessionToken", req.cookies.token, function(err, user) {
@@ -42,9 +41,7 @@ function setAndSendLoginToken(subject, to, res)
                        params.siteURL + "/#/authenticate/" + token + "\\n" +
                        "Token will expire in " + params.token.expire/(1000*60) + " minutes."
                sendEmail(params.mail.noreply, to.email, subject, body, err => {
-      // "id" is generally the only info missing on client side,
-                       // but the name is also unknown if log-in with the email.
-                       res.json(err || {id: to.id, name: to.name});
+                       res.json(err || {});
                });
        });
 }