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:
Julian Lam
2019-03-13 12:38:30 -04:00
committed by GitHub
parent d8486e887a
commit d2cfe6b946
3 changed files with 43 additions and 8 deletions

View File

@@ -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;
}
});
};