fix: onSuccessfulLogin not working

In scenarios where onSuccessfulLogin was not called in the SSO plugin,
core's calling of onSuccessfulLogin was prematurely returning, because
it was checking the wrong value.

This commit fixes the issue by checking a different value.
This commit is contained in:
Julian Lam
2020-01-29 12:47:48 -05:00
parent 0ae1eb4f6e
commit 111ed802cf

View File

@@ -316,8 +316,12 @@ authenticationController.doLogin = async function (req, uid) {
};
authenticationController.onSuccessfulLogin = async function (req, uid) {
// If already called once, return prematurely
if (req.res.locals.user) {
/*
* Older code required that this method be called from within the SSO plugin.
* That behaviour is no longer required, onSuccessfulLogin is now automatically
* called in NodeBB core. However, if already called, return prematurely
*/
if (req.loggedIn) {
return true;
}