feat: LDAP debug flag

This commit is contained in:
Nick 2019-06-04 22:23:32 -04:00
parent 3d73ff5d42
commit 922f179a90
7 changed files with 18 additions and 12 deletions

View File

@ -17,6 +17,14 @@
span Do NOT enable these flags unless you know what you're doing!
.caption Doing so may result in data loss or broken installation!
v-card-text
v-switch.mt-3(
color='primary'
hint='Log detailed debug info on LDAP/AD login attempts.'
persistent-hint
label='LDAP Debug'
v-model='flags.ldapdebug'
)
v-divider.mt-3
v-switch.mt-3(
color='red'
hint='Log all queries made to the database to console.'
@ -24,15 +32,6 @@
label='SQL Query Logging'
v-model='flags.sqllog'
)
//- v-divider.mt-3
//- v-switch.mt-3(
//- color='primary'
//- hint='Log all queries made to the database to console.'
//- persistent-hint
//- label='SQL Query Log'
//- v-model='flags.sqllog'
//- )
</template>
<script>

View File

@ -39,6 +39,7 @@ defaults:
theme: 'default'
darkMode: false
flags:
ldapdebug: false
sqllog: false
# System defaults
setup: false

View File

@ -1,6 +1,5 @@
const passport = require('passport')
const passportJWT = require('passport-jwt')
const fs = require('fs-extra')
const _ = require('lodash')
const path = require('path')
const jwt = require('jsonwebtoken')

View File

@ -44,6 +44,11 @@ module.exports = {
responseResult: graphHelper.generateSuccess('Login success')
}
} catch (err) {
// LDAP Debug Flag
if (args.strategy === 'ldap' && WIKI.config.flags.ldapdebug) {
WIKI.logger.warn('LDAP LOGIN ERROR (c1): ', err)
}
return graphHelper.generateError(err)
}
},

View File

@ -1,4 +1,3 @@
const _ = require('lodash')
const graphHelper = require('../../helpers/graph')
/* global WIKI */

View File

@ -13,7 +13,7 @@ module.exports = {
generateError (err, complete = true) {
const error = {
succeeded: false,
errorCode: err.code || 1,
errorCode: _.isFinite(err.code) ? err.code : 1,
slug: err.name,
message: err.message || 'An unexpected error occured.'
}

View File

@ -45,6 +45,9 @@ module.exports = {
})
cb(null, user)
} catch (err) {
if (WIKI.config.flags.ldapdebug) {
WIKI.logger.warn('LDAP LOGIN ERROR (c2): ', err)
}
cb(err, null)
}
}