wikijs-fork/server/helpers/security.js
2017-04-29 11:53:44 -04:00

16 lines
393 B
JavaScript

'use strict'
/* global appdata, appconfig */
const _ = require('lodash')
module.exports = {
sanitizeCommitUser (user) {
let wlist = new RegExp('(?!([^a-zA-Z0-9-_.\',& ]|' + appdata.regex.cjk.source + '))', 'g')
return {
name: _.chain(user.name).replace(wlist, '').trim().value(),
email: appconfig.git.showUserEmail ? user.email : appconfig.git.serverEmail
}
}
}