Skip to content

Commit

Permalink
fix: revert back loose requirements on text based fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mistahj67 committed Nov 27, 2024
1 parent 0fd3fc9 commit d9dbfa0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { FC } from 'react';
import { Controller, useForm } from 'react-hook-form';
import { OIDCProviderInfo, SSOProvider, UpsertOIDCProviderRequest } from 'js-client-library';

const UpsertOIDCProviderDialog: FC<{
const UpsertOIDCProviderForm: FC<{
error?: string;
oldSSOProvider?: SSOProvider;
onClose: () => void;
Expand Down Expand Up @@ -53,7 +53,7 @@ const UpsertOIDCProviderDialog: FC<{
control={control}
name='name'
rules={{
required: !oldSSOProvider && 'OIDC Provider Name is required',
required: 'OIDC Provider Name is required',
pattern: {
value: /^[A-z0-9 ]+$/,
message: 'OIDC Provider Name must be alphanumeric.',
Expand All @@ -79,9 +79,7 @@ const UpsertOIDCProviderDialog: FC<{
<Controller
control={control}
name='client_id'
rules={{
required: !oldSSOProvider && 'Client ID is required',
}}
rules={{ required: 'Client ID is required' }}
render={({ field }) => (
<TextField
{...field}
Expand All @@ -100,9 +98,7 @@ const UpsertOIDCProviderDialog: FC<{
<Controller
control={control}
name='issuer'
rules={{
required: !oldSSOProvider && 'Issuer is required',
}}
rules={{ required: 'Issuer is required' }}
render={({ field }) => (
<TextField
{...field}
Expand Down Expand Up @@ -140,4 +136,4 @@ const UpsertOIDCProviderDialog: FC<{
);
};

export default UpsertOIDCProviderDialog;
export default UpsertOIDCProviderForm;
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const UpsertSAMLProviderForm: FC<{
control={control}
name='name'
rules={{
required: !oldSSOProvider && 'SAML Provider Name is required',
required: 'SAML Provider Name is required',
pattern: {
value: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,
message:
Expand All @@ -92,9 +92,7 @@ const UpsertSAMLProviderForm: FC<{
<Controller
control={control}
name='metadata'
rules={{
required: !oldSSOProvider && 'Metadata is required',
}}
rules={{ required: !oldSSOProvider && 'Metadata is required' }}
render={({ field }) => (
<Box p={1} borderRadius={4} bgcolor={theme.palette.neutral.tertiary}>
<Box display='flex' flexDirection='row' alignItems='center'>
Expand Down

0 comments on commit d9dbfa0

Please sign in to comment.