2
0

security.js 393 B

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