<commit_before>'use strict'

var Crypto = require('crypto')

var appSettings = require('../../db/appSettings')
var appLogger = require('../../utils/appLogger')

var randomCryptoLength = 256

function resetJWTsecret(req, res) {
  appSettings
    .update({
      JWTsecret: Crypto.randomBytes(randomCryptoLength).toString('hex')
    })
    .then(() => res.status(200).end())
    .catch(err => {
      global.devMode && console.error(err)
      appLogger.log.error({err, req, res})
      res.status(500).json({
        errorMessage: 'There was an error resetting JWT secret.'
      })
    })
}

module.exports = resetJWTsecret<commit_msg>magic numbers!<commit_after>'use strict'

var Crypto = require('crypto')

var appSettings = require('../../db/appSettings')
var appLogger = require('../../utils/appLogger')

function resetJWTsecret(req, res) {
  appSettings
    .update({
      JWTsecret: Crypto.randomBytes(256).toString('hex')
    })
    .then(() => res.status(200).end())
    .catch(err => {
      global.devMode && console.error(err)
      appLogger.log.error({err, req, res})
      res.status(500).json({
        errorMessage: 'There was an error resetting JWT secret.'
      })
    })
}

module.exports = resetJWTsecret
{'fraction_non_alphanumeric': 0.16639477977161501, 'fraction_numerical': 0.01468189233278956, 'mean_word_length': 3.216494845360825, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '116745', 'n_tokens_mistral': 399, 'n_tokens_neox': 384, 'n_words': 77}