mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-09 15:38:03 -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({
|
body: z.object({
|
||||||
organizationId: z.string().trim(),
|
organizationId: z.string().trim(),
|
||||||
description: z.string().trim().default(""),
|
description: z.string().trim().default(""),
|
||||||
ttlDays: z.number().min(0).default(0)
|
ttlDays: z.number().min(0).max(730).default(0)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
|
|||||||
@@ -245,15 +245,22 @@ export const ScimTokenModal = ({ popUp, handlePopUpOpen, handlePopUpToggle }: Pr
|
|||||||
data &&
|
data &&
|
||||||
data.length > 0 &&
|
data.length > 0 &&
|
||||||
data.map(({ id, description, ttlDays, createdAt }) => {
|
data.map(({ id, description, ttlDays, createdAt }) => {
|
||||||
|
const isInvalidTTLDays = ttlDays > 9999; // added validation later so some users would still be using this
|
||||||
let expiresAt;
|
let expiresAt;
|
||||||
if (ttlDays > 0) {
|
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 (
|
return (
|
||||||
<Tr className="h-10 items-center" key={`mi-client-secret-${id}`}>
|
<Tr className="h-10 items-center" key={`mi-client-secret-${id}`}>
|
||||||
<Td>{description === "" ? "-" : description}</Td>
|
<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>{format(new Date(createdAt), "yyyy-MM-dd HH:mm:ss")}</Td>
|
||||||
<Td>
|
<Td>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
|||||||
Reference in New Issue
Block a user