mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 20:27:12 +00:00
feat: add password input
This commit is contained in:
@@ -32,6 +32,7 @@ const viewLimitOptions = [
|
|||||||
|
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
name: z.string().optional(),
|
name: z.string().optional(),
|
||||||
|
password: z.string().optional(),
|
||||||
secret: z.string(),
|
secret: z.string(),
|
||||||
expiresIn: z.string(),
|
expiresIn: z.string(),
|
||||||
viewLimit: z.string(),
|
viewLimit: z.string(),
|
||||||
@@ -67,7 +68,7 @@ export const ShareSecretForm = ({ isPublic, value }: Props) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const onFormSubmit = async ({ name, secret, expiresIn, viewLimit, accessType }: FormData) => {
|
const onFormSubmit = async ({ name, password, secret, expiresIn, viewLimit, accessType }: FormData) => {
|
||||||
try {
|
try {
|
||||||
const expiresAt = new Date(new Date().getTime() + Number(expiresIn));
|
const expiresAt = new Date(new Date().getTime() + Number(expiresIn));
|
||||||
|
|
||||||
@@ -80,6 +81,7 @@ export const ShareSecretForm = ({ isPublic, value }: Props) => {
|
|||||||
|
|
||||||
const { id } = await createSharedSecret.mutateAsync({
|
const { id } = await createSharedSecret.mutateAsync({
|
||||||
name,
|
name,
|
||||||
|
password,
|
||||||
encryptedValue: ciphertext,
|
encryptedValue: ciphertext,
|
||||||
hashedHex,
|
hashedHex,
|
||||||
iv,
|
iv,
|
||||||
@@ -149,6 +151,19 @@ export const ShareSecretForm = ({ isPublic, value }: Props) => {
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="password"
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="Password (Optional)"
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
>
|
||||||
|
<Input {...field} placeholder="Password" type="text" />
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
<Controller
|
<Controller
|
||||||
control={control}
|
control={control}
|
||||||
name="expiresIn"
|
name="expiresIn"
|
||||||
|
|||||||
Reference in New Issue
Block a user