mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
refactored plugin and auth init a bit, and fixed issue where successive reloads caused old login strategies to be inadvertently preserved
This commit is contained in:
@@ -138,25 +138,26 @@
|
||||
});
|
||||
}
|
||||
|
||||
Auth.initialize = function(app) {
|
||||
Auth.initialize = function(app, middleware) {
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
|
||||
Auth.app = app;
|
||||
Auth.middleware = middleware;
|
||||
};
|
||||
|
||||
Auth.get_login_strategies = function() {
|
||||
return login_strategies;
|
||||
};
|
||||
|
||||
Auth.registerApp = function(app, middleware) {
|
||||
Auth.app = app;
|
||||
Auth.middleware = middleware;
|
||||
};
|
||||
|
||||
Auth.reloadRoutes = function(callback) {
|
||||
var router = express.Router();
|
||||
router.hotswapId = 'auth';
|
||||
|
||||
plugins.ready(function() {
|
||||
// Reset the registered login strategies
|
||||
login_strategies.length = 0;
|
||||
|
||||
plugins.fireHook('filter:auth.init', login_strategies, function(err) {
|
||||
if (err) {
|
||||
winston.error('filter:auth.init - plugin failure');
|
||||
|
||||
Reference in New Issue
Block a user