fix: No need to validate SSO access immediately after sign-in

This commit is contained in:
Tom Moor
2023-06-29 21:06:56 -04:00
parent 73c2a67fa5
commit 92c8eff61d

View File

@@ -1,3 +1,4 @@
import { subHours } from "date-fns";
import Router from "koa-router";
import { uniqBy } from "lodash";
import { TeamPreference } from "@shared/types";
@@ -126,7 +127,11 @@ router.post("auth.info", auth(), async (ctx: APIContext<T.AuthInfoReq>) => {
user.availableTeams(),
]);
await ValidateSSOAccessTask.schedule({ userId: user.id });
// If the user did not _just_ sign in then we need to check if they continue
// to have access to the workspace they are signed into.
if (user.lastSignedInAt && user.lastSignedInAt < subHours(new Date(), 1)) {
await ValidateSSOAccessTask.schedule({ userId: user.id });
}
ctx.body = {
data: {