mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-08 15:13:55 -05:00
fix(ui): resolves range error that happaned when providing a large ttl in scim
This commit is contained in:
@@ -57,7 +57,7 @@ export const registerScimRouter = async (server: FastifyZodProvider) => {
|
||||
body: z.object({
|
||||
organizationId: z.string().trim(),
|
||||
description: z.string().trim().default(""),
|
||||
ttlDays: z.number().min(0).default(0)
|
||||
ttlDays: z.number().min(0).max(730).default(0)
|
||||
}),
|
||||
response: {
|
||||
200: z.object({
|
||||
|
||||
@@ -245,15 +245,22 @@ export const ScimTokenModal = ({ popUp, handlePopUpOpen, handlePopUpToggle }: Pr
|
||||
data &&
|
||||
data.length > 0 &&
|
||||
data.map(({ id, description, ttlDays, createdAt }) => {
|
||||
const isInvalidTTLDays = ttlDays > 9999; // added validation later so some users would still be using this
|
||||
let expiresAt;
|
||||
if (ttlDays > 0) {
|
||||
expiresAt = new Date(new Date(createdAt).getTime() + ttlDays * 86400 * 1000);
|
||||
expiresAt = isInvalidTTLDays
|
||||
? new Date()
|
||||
: new Date(new Date(createdAt).getTime() + ttlDays * 86400 * 1000);
|
||||
}
|
||||
|
||||
return (
|
||||
<Tr className="h-10 items-center" key={`mi-client-secret-${id}`}>
|
||||
<Td>{description === "" ? "-" : description}</Td>
|
||||
<Td>{expiresAt ? format(expiresAt, "yyyy-MM-dd HH:mm:ss") : "-"}</Td>
|
||||
<Td>
|
||||
{expiresAt && !isInvalidTTLDays
|
||||
? format(expiresAt, "yyyy-MM-dd HH:mm:ss")
|
||||
: "-"}
|
||||
</Td>
|
||||
<Td>{format(new Date(createdAt), "yyyy-MM-dd HH:mm:ss")}</Td>
|
||||
<Td>
|
||||
<IconButton
|
||||
|
||||
Reference in New Issue
Block a user