Fixed parameter and token issues

This commit is contained in:
Kasper Rynning-Tønnesen
2018-02-06 15:15:07 +01:00
parent 69b4aa4b33
commit b047ccd9ef
2 changed files with 27 additions and 25 deletions

View File

@@ -71,7 +71,7 @@ function(req, username, password, done) {
// find a user whose username is the same as the forms username
// we are checking to see if the user trying to login already exists
var token = req.param("token");
var token = req.body.token;
token_db.collection("tokens").find({token: token}, function(err, docs){
if(docs.length == 1){
token_db.collection("tokens").remove({token: token}, function(err, docs){
@@ -186,17 +186,6 @@ app.use('/', isLoggedIn, function(req, res) {
res.render('layouts/admin/authenticated', data);
});
function makeid()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 20; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
function isLoggedInTryingToLogIn(req, res, next){
if(!req.isAuthenticated()){
return next();