<commit_before>// routes/login.js
var config = require('../config');
var mongoose = require('mongoose');

var User = mongoose.model('User');

exports.get_url = '/register';

exports.get = function(req, res){
  var error = req.flash('error');
  res.render('register', {
    title: process.env.MD_TITLE || "Markdown Chat",
    error: error,
    logged_in: false
  });
};

exports.post_url = '/register';
exports.post = function(req, res, nex) {
  // creating user
  var nickname = req.param('nickname');
  var email = req.param('email');
  var pass = req.param('password');
  var repass = req.param('repassword');
  // check the arguments
  if (!nickname) {
    req.flash('error', 'You need to fill nickname');
    res.redirect('/register');
  }
  else if (!pass) {
    req.flash('error', 'You need to fill password');
    res.redirect('/register');
  }
  else if (!repass) {
    req.flash('error', 'You need to re-fill password');
    res.redirect('/register');
  }
  else if (pass.toString() !== repass.toString()) {
    req.flash('error', 'password does not match');
    res.redirect('/register');
  }
  else {
    var user = new User({
      nickname: nickname,
      password: <PASSWORD>,
      email: email
    });
    user.save(function(error) {
      if (error) {
        req.flash('error', error.message);
        res.redirect('/register');
      }
      else {
        // success to create new account, force to login automatically
        req.login(user, function(err) {
          if (err) next(err);
          else res.redirect('/');
        });
      }
    });<commit_msg>#50: fix coding style of register.js according to jshint<commit_after>// routes/login.js
var config = require('../config');
var mongoose = require('mongoose');

var User = mongoose.model('User');

exports.get_url = '/register';

exports.get = function(req, res){
  var error = req.flash('error');
  res.render('register', {
    title: process.env.MD_TITLE || 'Markdown Chat',
    error: error,
    logged_in: false
  });
};

exports.post_url = '/register';
exports.post = function(req, res, next) {
  // creating user
  var nickname = req.param('nickname');
  var email = req.param('email');
  var pass = req.param('password');
  var repass = req.param('repassword');
  // check the arguments
  if (!nickname) {
    req.flash('error', 'You need to fill nickname');
    res.redirect('/register');
  }
  else if (!pass) {
    req.flash('error', 'You need to fill password');
    res.redirect('/register');
  }
  else if (!repass) {
    req.flash('error', 'You need to re-fill password');
    res.redirect('/register');
  }
  else if (pass.toString() !== repass.toString()) {
    req.flash('error', 'password does not match');
    res.redirect('/register');
  }
  else {
    var user = new User({
      nickname: nickname,
      password: <PASSWORD>,
      email: email
    });
    user.save(function(error) {
      if (error) {
        req.flash('error', error.message);
        res.redirect('/register');
      }
      else {
        // success to create new account, force to login automatically
        req.login(user, function(err) {
          if (err) {
            next(err);
          }
          else {
            res.redirect('/');
          }
        });
      }
    });
{'fraction_non_alphanumeric': 0.17075413856529736, 'fraction_numerical': 0.0006131207847946045, 'mean_word_length': 2.6662921348314605, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5351675', 'n_tokens_mistral': 1009, 'n_tokens_neox': 1008, 'n_words': 256}