<commit_before>//var mydata = require('../myGroups.json');
var mydata = require('../JSON/myGroups.json');

exports.view = function(req, res){

  console.log("Log in view");
  var id = req.query.id;
  var password = req.query.password;

  console.log("id and password");
  console.log(id);
  console.log(password);

  console.log("my id and password");
  for(var i=0; i < mydata.length; i++) {
    console.log(mydata[i].id);
    console.log(mydata[i].password);
  }

  console.log("Starting chekcing for loop");
  for(i=0; i < mydata.length; i++) {
    console.log(mydata[i].id);
    console.log(mydata[i].password);

    /* If the user is registered */
    if(mydata[i].id == id) {
      console.log("id check passed");
      if(mydata[i].password == password) {
        console.log("Check passed!");
        res.redirect('main');
        //res.render('main', mydata[i].name);
        return;
      }
    }
  }

  /* If the user input is wrong */
  console.log("The user input is wrong!");
  res.render('index');
  return;
  

  /*
  console.log(mydata.name[0] == name);
  console.log(mydata.password[0] == password);
  if(mydata.name[0] == name) {
    console.log("Inside the if statement")
    if(mydata.password[0] == password) {
      console.log("Check passed!");
      res.redirect('main');
      return;
    }
  }
  else {
    res.render('index');
    return;
  }*/
};

<commit_msg>sign in works<commit_after>//var mydata = require('../myGroups.json');
var mydata = require('../JSON/myGroups.json');
var classes = require('../JSON/allClasses.json');

exports.view = function(req, res){

  console.log("Log in view");
  var id = req.query.id;
  var password = req.query.password;

  console.log("id and password");
  console.log(id);
  console.log(password);

  console.log("my id and password");
  for(var i=0; i < mydata.length; i++) {
    console.log(mydata[i].id);
    console.log(mydata[i].password);
  }

  console.log("Starting chekcing for loop");
  for(i=0; i < mydata.length; i++) {
    console.log(mydata[i].id);
    console.log(mydata[i].password);

    /* If the user is registered */
    if(mydata[i].id == id) {
      console.log("id check passed");
      if(mydata[i].password == password) {
        console.log("Check passed!");

        var resultdata = mydata[i];

        var resultdata2 = {
            classes : classes,
            mydata : resultdata,
            groupNum : resultdata.group_own.length,
        };

        res.render('main', resultdata2);
        return;
      }
    }
  }

  /* If the user input is wrong */
  console.log("The user input is wrong!");
  res.render('index');
  return;
  

  /*
  console.log(mydata.name[0] == name);
  console.log(mydata.password[0] == password);
  if(mydata.name[0] == name) {
    console.log("Inside the if statement")
    if(mydata.password[0] == password) {
      console.log("Check passed!");
      res.redirect('main');
      return;
    }
  }
  else {
    res.render('index');
    return;
  }*/
};


{'fraction_non_alphanumeric': 0.18212253096752595, 'fraction_numerical': 0.004686976899899564, 'mean_word_length': 2.7256857855361596, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '1405317', 'n_tokens_mistral': 1032, 'n_tokens_neox': 1009, 'n_words': 203}