feat: modular auth + logging changes
This commit is contained in:
@@ -8,21 +8,19 @@
|
||||
|
||||
const GitHubStrategy = require('passport-github2').Strategy
|
||||
|
||||
module.exports = (passport) => {
|
||||
if (wiki.config.auth.github && wiki.config.auth.github.enabled) {
|
||||
passport.use('github',
|
||||
new GitHubStrategy({
|
||||
clientID: wiki.config.auth.github.clientId,
|
||||
clientSecret: wiki.config.auth.github.clientSecret,
|
||||
callbackURL: wiki.config.host + '/login/github/callback',
|
||||
scope: ['user:email']
|
||||
}, (accessToken, refreshToken, profile, cb) => {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
})
|
||||
}
|
||||
))
|
||||
}
|
||||
module.exports = (passport, conf) => {
|
||||
passport.use('github',
|
||||
new GitHubStrategy({
|
||||
clientID: conf.clientId,
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL,
|
||||
scope: ['user:email']
|
||||
}, (accessToken, refreshToken, profile, cb) => {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
})
|
||||
}
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user