<commit_before>var _        = require('lodash');
var express  = require('express');
var mongoose = require('mongoose');

var utils      = require('../utils');
var config     = require('../config');
var middleware = require('../middleware');

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

var Router   = express.Router();
var ObjectId = mongoose.Types.ObjectId;

Router.route('/user/edit')

    /**
     * Change user name, with optional password and email for basic provider
     *
     * {
     *   'name'        : '<NAME>'
     * }
     */
    .put(middleware.authenticate('user'))
    .put(function(req, res, next) {
        var payload = req.body;

        User.findOne({ '_id': req.user.id }, function(err, user) {
            if(err) {
                return next(utils.error(500, err));
            }

            if(!user) {<commit_msg>fix misleading comment<commit_after>var _        = require('lodash');
var express  = require('express');
var mongoose = require('mongoose');

var utils      = require('../utils');
var config     = require('../config');
var middleware = require('../middleware');

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

var Router   = express.Router();
var ObjectId = mongoose.Types.ObjectId;

Router.route('/user/edit')

    /**
     * Change user name
     *
     * {
     *   'name'        : '<NAME>'
     * }
     */
    .put(middleware.authenticate('user'))
    .put(function(req, res, next) {
        var payload = req.body;

        User.findOne({ '_id': req.user.id }, function(err, user) {
            if(err) {
                return next(utils.error(500, err));
            }

            if(!user) {
{'fraction_non_alphanumeric': 0.16891891891891891, 'fraction_numerical': 0.0036855036855036856, 'mean_word_length': 2.21301775147929, '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': '1623954', 'n_tokens_mistral': 507, 'n_tokens_neox': 499, 'n_words': 108}