Merge pull request #6 from Mailtrain-org/development

Development
This commit is contained in:
Carlos Zamora Sanz 2019-08-21 08:08:22 +02:00 committed by GitHub
commit 3e374db722
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 7 deletions

View file

@ -90,7 +90,7 @@ export default class CUD extends Component {
} else if (usernameServerValidation && usernameServerValidation.exists) { } else if (usernameServerValidation && usernameServerValidation.exists) {
state.setIn(['username', 'error'], t('theUserNameAlreadyExistsInTheSystem')); state.setIn(['username', 'error'], t('theUserNameAlreadyExistsInTheSystem'));
} else if (!usernameServerValidation) { } else if (!usernameServerValidation) {
state.setIn(['email', 'error'], t('validationIsInProgress')); state.setIn(['username', 'error'], t('validationIsInProgress'));
} else { } else {
state.setIn(['username', 'error'], null); state.setIn(['username', 'error'], null);
} }

View file

@ -147,6 +147,8 @@ ldap:
uidTag: username uidTag: username
# nameTag identifies the attribute to be used for user's full name # nameTag identifies the attribute to be used for user's full name
nameTag: username nameTag: username
# mailTag identifies the attribute to be used for user's email address
mailTag: mail
passwordresetlink: passwordresetlink:
newUserRole: master newUserRole: master
# Global namespace id # Global namespace id

View file

@ -24,7 +24,7 @@ if (config.ldap.enabled) {
if (!config.ldap.method || config.ldap.method === 'ldapjs') { if (!config.ldap.method || config.ldap.method === 'ldapjs') {
try { try {
LdapStrategy = require('passport-ldapjs').Strategy; // eslint-disable-line global-require LdapStrategy = require('passport-ldapjs').Strategy; // eslint-disable-line global-require
authMode = 'ldapjs'; authMode = 'ldap';
log.info('LDAP', 'Found module "passport-ldapjs". It will be used for LDAP auth.'); log.info('LDAP', 'Found module "passport-ldapjs". It will be used for LDAP auth.');
ldapStrategyOpts = { ldapStrategyOpts = {
@ -34,7 +34,7 @@ if (config.ldap.enabled) {
base: config.ldap.baseDN, base: config.ldap.baseDN,
search: { search: {
filter: config.ldap.filter, filter: config.ldap.filter,
attributes: [config.ldap.uidTag, config.ldap.nameTag, 'mail'], attributes: [config.ldap.uidTag, config.ldap.nameTag, config.ldap.mailTag],
scope: 'sub' scope: 'sub'
}, },
uidTag: config.ldap.uidTag, uidTag: config.ldap.uidTag,
@ -58,7 +58,7 @@ if (config.ldap.enabled) {
url: ldapProtocol + '://' + config.ldap.host + ':' + config.ldap.port, url: ldapProtocol + '://' + config.ldap.host + ':' + config.ldap.port,
searchBase: config.ldap.baseDN, searchBase: config.ldap.baseDN,
searchFilter: config.ldap.filter, searchFilter: config.ldap.filter,
searchAttributes: [config.ldap.uidTag, config.ldap.nameTag, 'mail'], searchAttributes: [config.ldap.uidTag, config.ldap.nameTag, config.ldap.mailTag],
bindDN: config.ldap.bindUser, bindDN: config.ldap.bindUser,
bindCredentials: config.ldap.bindPassword bindCredentials: config.ldap.bindPassword
}, },
@ -177,7 +177,7 @@ module.exports.restLogin = (req, res, next) => {
}; };
if (LdapStrategy) { if (LdapStrategy) {
log.info('Using LDAP auth (passport-' + authMode + ')'); log.info('Using LDAP auth (passport-' + authMode === 'ldap' ? 'ldapjs' : authMode + ')');
module.exports.authMethod = 'ldap'; module.exports.authMethod = 'ldap';
module.exports.isAuthMethodLocal = false; module.exports.isAuthMethodLocal = false;

View file

@ -592,7 +592,7 @@ async function scheduleQueued() {
const expiredCount = await knex('queued') const expiredCount = await knex('queued')
.whereNotIn('send_configuration', sendConfigurationsIdsInProcessing) .whereNotIn('send_configuration', sendConfigurationsIdsInProcessing)
.where('type', type) .where('type', type)
.where('created', '<', expirationThreshold.threshold) .where('created', '<', new Date(expirationThreshold.threshold))
.del(); .del();
if (expiredCount) { if (expiredCount) {
@ -731,4 +731,3 @@ async function init() {
// noinspection JSIgnoredPromiseFromCall // noinspection JSIgnoredPromiseFromCall
init(); init();