Skip to content

Node.js based forum software built for the modern web

fix: onSuccessfulLogin not working

Julian Lam111ed802cfd7
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js
index 56a0a11f20..7bf27139fd 100644
--- a/src/controllers/authentication.js
+++ b/src/controllers/authentication.js
@@ -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;
}