- Joined
 - Dec 31, 2016
 
- Messages
 - 23
 
- Likes
 - 13
 
- Degree
 - 0
 
Right I know this is simple but its driving me potty and Im clearly missing something object related.
Im trying to sanitize the user input as it comes in from a post request the sanitization functions I'm using are;
	
	
	
		
the route file looks like
	
	
	
		
This is basic i get that but what am i doing wrong!
				
			Im trying to sanitize the user input as it comes in from a post request the sanitization functions I'm using are;
		Code:
	
	function sanitizeUsername(userS) {
    return userS = userS.replace(/[^a-zA-Z0-9 .@-]/gim, "");
};
function sanitizePassword(passS) {
   return passS = passS.replace(/[^a-zA-Z0-9 ]/gim, " ");
};
	the route file looks like
		Code:
	
	var express = require('express');
var router = express.Router();
var user = require("../models/users");
// sanitize functions
function sanitizeUsername(userS) {
   return userS = userS.replace(/[^a-zA-Z0-9 .@-]/gim, "");
};
function sanitizePassword(passS) {
   return passS = passS.replace(/[^a-zA-Z0-9 ]/gim, " ");
};
/* GET home page. */
router.get('/', function (req, res) {
    res.render('index', { title: 'Express' });
});
/* GET login page. */
router.get('/login', function (req, res, next) {
    res.render('login', { title: 'Express' });
});
/* POST login page. */
router.post('/login', function (req, res, next) {
        
   sanitizeUsername =  sanitizeUsername(req.body.username);
    sanitizePassword = sanitizePassword(req.body.password);
console.log(sanitizeUsername);
console.log(sanitizePassword);
module.exports = router;
	This is basic i get that but what am i doing wrong!