<commit_before>'use strict';

/**
 * Module dependencies.
 */
var path = require('path'),
  config = require(path.resolve('./config/config')),
  mail = require(path.resolve('./config/lib/mail')),
  errorHandler = require(path.resolve('./modules/core/server/controllers/errors.server.controller')),
  mongoose = require('mongoose'),
  User = mongoose.model('User'),
  async = require('async'),
  crypto = require('crypto'),
  validator = require('validator');

/**
 * Forgot for reset password (forgot POST)
 */
exports.forgot = function (req, res, next) {
  var email = req.body.email || '';
  var user;
  validEmail(email)
    .then(_user => {
      user = _user;
      return getToken();
    })
    .then(token => {
      user.resetPasswordToken = <PASSWORD>;
      user.resetPasswordExpires = Date.now() + 3600000; // 1 hour
      return saveUser(user);
    })
    .then(_user => {
      var url = config.http + '://' + req.headers.host + '/api/auth/reset/' + _user.activeAccountToken;
      var mailTemplate = 'resetpass';
      var mailContent = {
        name: _user.displayName,
        appName: config.app.title,
        url: url
      };<commit_msg>Commited from lenh at Wed, Sep 06, 2017  1:19:18 PM<commit_after>'use strict';

/**
 * Module dependencies.
 */
var path = require('path'),
  config = require(path.resolve('./config/config')),
  mail = require(path.resolve('./config/lib/mail')),
  errorHandler = require(path.resolve('./modules/core/server/controllers/errors.server.controller')),
  mongoose = require('mongoose'),
  User = mongoose.model('User'),
  async = require('async'),
  crypto = require('crypto'),
  validator = require('validator');

/**
 * Forgot for reset password (forgot POST)
 */
exports.forgot = function (req, res, next) {
  var email = req.body.email || '';
  var user;
  validEmail(email)
    .then(_user => {
      user = _user;
      return getToken();
    })
    .then(token => {
      user.resetPasswordToken = <PASSWORD>;
      user.resetPasswordExpires = Date.now() + 3600000; // 1 hour
      return saveUser(user);
    })
    .then(_user => {
      var url = config.http + '://' + req.headers.host + '/api/auth/reset/' + _user.resetPasswordToken;
      var mailTemplate = 'resetpass';
      var mailContent = {
        name: _user.displayName,
        appName: config.app.title,
        url: url
      };
{'fraction_non_alphanumeric': 0.16822429906542055, 'fraction_numerical': 0.011469838572642312, 'mean_word_length': 2.99830220713073, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1795122', 'n_tokens_mistral': 749, 'n_tokens_neox': 732, 'n_words': 155}