diff --git a/src/client/actions/db.js b/src/client/actions/db.js index 9128d450..3fa3088d 100644 --- a/src/client/actions/db.js +++ b/src/client/actions/db.js @@ -58,7 +58,7 @@ function updateGroup(groupName, type, value, method) { type: UPDATE_GROUP, meta: groupName, payload: apiFetchJSON(url, {method}).then(() => apiFetchJSON(groupUrl)) - } + }; } export const CREATE_GROUP = 'CREATE_GROUP'; @@ -105,7 +105,7 @@ async function doLdapSync(groupName) { const groupUrl = `db/${dbManager.currentDb}/group/${groupName}`; const syncUrl = `${groupUrl}/ldap/sync`; let res = await apiFetchJSON(syncUrl); - if(!res.error) { + if (!res.error) { res = await apiFetchJSON(groupUrl); } return res; diff --git a/src/client/components/Ephemere.js b/src/client/components/Ephemere.js index 8552cede..f4b02cda 100644 --- a/src/client/components/Ephemere.js +++ b/src/client/components/Ephemere.js @@ -10,10 +10,10 @@ class Ephemere extends Component { } componentWillUpdate() { - if(this.refs.ephemere) { + if (this.refs.ephemere) { this.refs.ephemere.style.display = 'block'; } - if(this.timeout) { + if (this.timeout) { clearTimeout(this.timeout); } } @@ -21,7 +21,7 @@ class Ephemere extends Component { componentDidUpdate() { this.timeout = setTimeout(() => { this.refs.ephemere.style.display = 'none'; - }, this.props.timeout || 3000) + }, this.props.timeout || 3000); } } diff --git a/src/client/reducers/db.js b/src/client/reducers/db.js index 6bd9b6e6..0b94e928 100644 --- a/src/client/reducers/db.js +++ b/src/client/reducers/db.js @@ -35,18 +35,18 @@ const dbReducer = (state = initialState, action) => { } case `${UPDATE_GROUP}_FULFILLED`: { const index = state.userGroups.findIndex(group => group.name === action.meta); - if(index === -1) { + if (index === -1) { throw new Error('should not happen'); } const newGroupList = state.userGroups.slice(); - if(action.payload.error) { + if (action.payload.error) { newGroupList[index] = Object.assign({}, newGroupList[index], {error: action.payload.error, success: null}); return Object.assign({}, state, { userGroups: newGroupList }); } else { - if(action.payload.name !== action.meta) { - throw new Error('should not happen') + if (action.payload.name !== action.meta) { + throw new Error('should not happen'); } newGroupList[index] = action.payload; newGroupList[index].success = 'Group sucessfully updated'; diff --git a/src/util/LDAP.js b/src/util/LDAP.js index a725e810..356ac874 100644 --- a/src/util/LDAP.js +++ b/src/util/LDAP.js @@ -21,16 +21,16 @@ function search(ldapOptions, searchOptions) { // if client could know when it is ready // promises would be much easier to handle :-( const client = ldapjs.createClient(ldapOptions); - client.on('error', function(e) { + client.on('error', function (e) { reject(e); }); - client.__resolve__ = function(value) { + client.__resolve__ = function (value) { client.destroy(); resolve(value); }; - client.__reject__ = function(err) { + client.__reject__ = function (err) { client.destroy(); reject(err); }; @@ -52,23 +52,23 @@ function search(ldapOptions, searchOptions) { client.__resolve__(entries); }); }); - } catch(e) { + } catch (e) { // LIBRARY!!! WHY DON'T YOU PASS ALL YOUR ERRORS IN THE CALLBACK!!! client.__reject__(e); } - }).catch(e => {/* Error should be handled by __reject__ */}); + }).catch(() => {/* Error should be handled by __reject__ */}); }); } function bind(client, DN, password) { - if(!DN || !password) { - debug(`ldap search: bypass authentication`); + if (!DN || !password) { + debug('ldap search: bypass authentication'); return Promise.resolve(); } return new Promise((resolve, reject) => { - client.bindDN(DN, password, function(err) { - if(err) { + client.bindDN(DN, password, function (err) { + if (err) { client.__reject__(err); reject(err); return;