<commit_before>const router = require('express').Router();
const Ngo = require('../../models/Ngo/ngo.js');
const jwt = require('jsonwebtoken');
var bcrypt = require('bcrypt');
var status  = require('../../stubs/status');
var validateToken = require('../../middleware/JsonToken.js');
var nodemailer = require('nodemailer')
const cryptoRandomString = require('crypto-random-string');

router.get('/about',validateToken, (req, res, next)=>{
    return res.json({
        Message: 'This is a test Route'
    })
})




const selfSignedConfigOptions = {
    host: 'smtp.wedonate.com',
    service: 'gmail',
    port: 465,
    auth: {
        user: '<EMAIL>',
        pass: '<PASSWORD>'
    }
};

var transporter = nodemailer.createTransport(selfSignedConfigOptions);



router.post('/login',(req,res,next)=>{
    var regNo = req.body.regNo;
    console.log(regNo);
    Ngo.findOne( {'regNo':regNo}, function (err , result) {
        if(err){
            console.log(err);
        }else if(result==null){
            res.json("does not exits")
        }else{
            var passwordIsValid = bcrypt.compareSync(req.body.password, result.password);
            if (!passwordIsValid) return res.status(401).send({ auth: false, token: null });
            jwt.sign({
                username: req.body.regNo,
            },   process.env.secretKey, {
                expiresIn: 60*2
            },(err, token)=>{
                if(err){
                    throw err;
                }
                else{
                    res.json({
                        'token' : token ,
                        'success' : true
                    })
                }
            });
<commit_msg>bug fix<commit_after>const router = require('express').Router();
const Ngo = require('../../models/Ngo/ngo.js');
const jwt = require('jsonwebtoken');
var bcrypt = require('bcrypt');
var status  = require('../../stubs/status');
var validateToken = require('../../middleware/JsonToken.js');
var nodemailer = require('nodemailer')
const cryptoRandomString = require('crypto-random-string');

router.get('/about',validateToken, (req, res, next)=>{
    return res.json({
        Message: 'This is a test Route'
    })
})




const selfSignedConfigOptions = {
    host: 'smtp.wedonate.com',
    service: 'gmail',
    port: 465,
    auth: {
        user: '<EMAIL>',
        pass: '<PASSWORD>'
    }
};

var transporter = nodemailer.createTransport(selfSignedConfigOptions);



router.post('/login',(req,res,next)=>{
    var regNo = req.body.regNo;
    console.log(regNo);
    Ngo.findOne( {'regNo':regNo}, function (err , result) {
        if(err){
            console.log(err);
        }else if(result==null){
            res.json("does not exits")
        }else{
            var passwordIsValid = <PASSWORD>.compareSync(req.body.password, result.password);
            if (!passwordIsValid) return res.json("Wrong Password");
            jwt.sign({
                username: req.body.regNo,
            },   process.env.secretKey, {
                expiresIn: 60*2
            },(err, token)=>{
                if(err){
                    throw err;
                }
                else{
                    res.json({
                        token : token ,
                        ngo   : result
                    })
                }
            });

{'fraction_non_alphanumeric': 0.15347721822541965, 'fraction_numerical': 0.0044964028776978415, 'mean_word_length': 1.8693035253654342, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5178258', 'n_tokens_mistral': 1008, 'n_tokens_neox': 951, 'n_words': 196}