fix: Improve handling of suspended users signing in with email (#2012)

* chore: Separate signin/auth middleware
fix: Email signin token parsed by JWT middleware
fix: Email signin marked as active when logging in as suspended
fix: Suspended email signin correctly redirected to login screen
closes #1740

* refactor middleware -> lib

* lint
This commit is contained in:
Tom Moor
2021-04-08 20:40:04 -07:00
committed by GitHub
parent 1a889e9913
commit 190f0b6dc5
8 changed files with 96 additions and 109 deletions

View File

@@ -9,7 +9,6 @@ import {
GoogleWorkspaceRequiredError,
GoogleWorkspaceInvalidError,
} from "../../errors";
import auth from "../../middlewares/authentication";
import passportMiddleware from "../../middlewares/passport";
import { getAllowedDomains } from "../../utils/authentication";
import { StateStore } from "../../utils/passport";
@@ -90,11 +89,7 @@ if (GOOGLE_CLIENT_ID) {
router.get("google", passport.authenticate(providerName));
router.get(
"google.callback",
auth({ required: false }),
passportMiddleware(providerName)
);
router.get("google.callback", passportMiddleware(providerName));
}
export default router;