mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-08 23:18:05 -05:00
Make credential optional
This commit is contained in:
@@ -25,8 +25,17 @@ export const RedisResourceConnectionDetailsSchema = z.object({
|
||||
});
|
||||
|
||||
export const RedisAccountCredentialsSchema = z.object({
|
||||
username: z.string().trim().min(1).max(63),
|
||||
password: z.string().trim().min(1).max(256)
|
||||
username: z
|
||||
.string()
|
||||
.trim()
|
||||
.max(256, "Username must be 255 characters or less")
|
||||
.transform((value) => (value === "" ? undefined : value))
|
||||
.optional(),
|
||||
password: z
|
||||
.string()
|
||||
.max(256, "Password must be 256 characters or less")
|
||||
.transform((value) => (value === "" ? undefined : value))
|
||||
.optional()
|
||||
});
|
||||
|
||||
const BaseRedisResourceSchema = BasePamResourceSchema.extend({ resourceType: z.literal(PamResource.Redis) });
|
||||
|
||||
@@ -18,8 +18,17 @@ type Props = {
|
||||
|
||||
const formSchema = genericAccountFieldsSchema.extend({
|
||||
credentials: z.object({
|
||||
username: z.string().trim().max(256, "Username must be 255 characters or less"),
|
||||
password: z.string().max(256, "Password must be 256 characters or less")
|
||||
username: z
|
||||
.string()
|
||||
.trim()
|
||||
.max(256, "Username must be 255 characters or less")
|
||||
.transform((value) => (value === "" ? undefined : value))
|
||||
.optional(),
|
||||
password: z
|
||||
.string()
|
||||
.max(256, "Password must be 256 characters or less")
|
||||
.transform((value) => (value === "" ? undefined : value))
|
||||
.optional()
|
||||
}),
|
||||
// We don't support rotation for now, just feed a false value to
|
||||
// make the schema happy
|
||||
|
||||
@@ -26,6 +26,7 @@ export const UsernamePasswordFields = ({ isUpdate }: { isUpdate: boolean }) => {
|
||||
errorText={error?.message}
|
||||
isError={Boolean(error?.message)}
|
||||
label="Username"
|
||||
isOptional
|
||||
>
|
||||
<Input {...field} autoComplete="off" />
|
||||
</FormControl>
|
||||
@@ -40,6 +41,7 @@ export const UsernamePasswordFields = ({ isUpdate }: { isUpdate: boolean }) => {
|
||||
errorText={error?.message}
|
||||
isError={Boolean(error?.message)}
|
||||
label="Password"
|
||||
isOptional
|
||||
>
|
||||
<Input
|
||||
{...field}
|
||||
|
||||
Reference in New Issue
Block a user