Skip to content

Commit

Permalink
Bug/OIDC wizard (#173)
Browse files Browse the repository at this point in the history
* accept more formats for file input

* use custom URL regex rather than built in Yup validation

* pass error back through correctly
  • Loading branch information
pnzrr authored Feb 20, 2024
1 parent 423b05a commit 2a6a4b6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,12 @@ export const GenericOIDC: FC = () => {
};
}
} catch (e) {
console.log(err);
console.log(e);
return {
status: API_STATUS.ERROR,
message:
"Configuration validation failed with OIDC. Check URL and try again.",
};
}

return {
Expand Down Expand Up @@ -253,9 +258,9 @@ export const GenericOIDC: FC = () => {
};

try {
await CreateIdp({createIdPUrl, payload, featureFlags});
await CreateIdp({ createIdPUrl, payload, featureFlags });
// TODO emailAsUsername, Mapper?

setResults(`${idpCommonName} created successfully. Click finish.`);
setStepIdReached(finishStep);
setError(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const MetadataFile: FC<Props> = ({
browseButtonText="Select"
onChange={(val) => setFieldValue("metadataFile", val)}
dropzoneProps={{
accept: "text/xml",
accept: "text/xml, application/json",
}}
isLoading={isSubmitting}
isDisabled={!formActive}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ import {
API_STATUS,
} from "@app/configurations/api-status";

const URL_REGEX =
/^(https?:\/\/)(localhost|([-\w]+\.)*\w+)(:\d+)?(\/[-\w@:%._\+~#=]+)*(\/[\w\/]*)*(\?.*)?(#.*)?$/;

const UrlSchema = Yup.object().shape({
url: Yup.string()
.url("Url should be a valid Url.")
.required("Url is a required field."),
.matches(URL_REGEX, "URL should be a valid URL.")
.required("URL is a required field."),
});

type Props = {
Expand Down

0 comments on commit 2a6a4b6

Please sign in to comment.