feat: LDAP debug flag

pull/880/head
Nick 6 years ago
parent 3d73ff5d42
commit 922f179a90

@ -17,6 +17,14 @@
span Do NOT enable these flags unless you know what you're doing! span Do NOT enable these flags unless you know what you're doing!
.caption Doing so may result in data loss or broken installation! .caption Doing so may result in data loss or broken installation!
v-card-text 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( v-switch.mt-3(
color='red' color='red'
hint='Log all queries made to the database to console.' hint='Log all queries made to the database to console.'
@ -24,15 +32,6 @@
label='SQL Query Logging' label='SQL Query Logging'
v-model='flags.sqllog' 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> </template>
<script> <script>

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

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

@ -44,6 +44,11 @@ module.exports = {
responseResult: graphHelper.generateSuccess('Login success') responseResult: graphHelper.generateSuccess('Login success')
} }
} catch (err) { } 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) return graphHelper.generateError(err)
} }
}, },

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

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

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

Loading…
Cancel
Save