mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 19:55:53 +02:00
Moved onSuccessfulLogin call from plugins to core, + auth verification hook (#7416)
* fix: #7412, calling controllers.onSuccessfulLogin in core * feat: added plugin hook for auth validation
This commit is contained in:
@@ -331,6 +331,15 @@ authenticationController.doLogin = function (req, uid, callback) {
|
||||
};
|
||||
|
||||
authenticationController.onSuccessfulLogin = function (req, uid, callback) {
|
||||
// If already called once, return prematurely
|
||||
if (req.res.locals.user) {
|
||||
if (typeof callback === 'function') {
|
||||
return setImmediate(callback);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
var uuid = utils.generateUUID();
|
||||
|
||||
req.uid = uid;
|
||||
@@ -392,7 +401,7 @@ authenticationController.onSuccessfulLogin = function (req, uid, callback) {
|
||||
if (typeof callback === 'function') {
|
||||
callback(err);
|
||||
} else {
|
||||
return false;
|
||||
return !!err;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user