diff --git a/server/server.js b/server/server.js index e8132cb90..6baf343e2 100644 --- a/server/server.js +++ b/server/server.js @@ -299,12 +299,12 @@ let needSetup = false; decoded.username, ]); - // Check if the password changed - if (decoded.h !== shake256(user.password, SHAKE256_LENGTH)) { - throw new Error("The token is invalid due to password change or old token"); - } - if (user) { + // Check if the password changed + if (decoded.h !== shake256(user.password, SHAKE256_LENGTH)) { + throw new Error("The token is invalid due to password change or old token"); + } + log.debug("auth", "afterLogin"); afterLogin(socket, user); log.debug("auth", "afterLogin ok");