2017-04-28 22:22:03 +00:00
|
|
|
'use strict'
|
|
|
|
|
2017-04-29 15:53:44 +00:00
|
|
|
/* global appdata, appconfig */
|
|
|
|
|
|
|
|
const _ = require('lodash')
|
|
|
|
|
2017-04-28 22:22:03 +00:00
|
|
|
module.exports = {
|
|
|
|
sanitizeCommitUser (user) {
|
2017-05-14 15:24:05 +00:00
|
|
|
let wlist = new RegExp('[^a-zA-Z0-9-_.\',& ' + appdata.regex.cjk + appdata.regex.arabic + ']', 'g')
|
2017-04-29 15:53:44 +00:00
|
|
|
return {
|
|
|
|
name: _.chain(user.name).replace(wlist, '').trim().value(),
|
|
|
|
email: appconfig.git.showUserEmail ? user.email : appconfig.git.serverEmail
|
|
|
|
}
|
2017-04-28 22:22:03 +00:00
|
|
|
}
|
|
|
|
}
|