Update Redirect URI when alias changes (#22771)

Closes #22549
This commit is contained in:
I G Prasad 2023-09-02 05:26:25 -06:00 committed by GitHub
parent a317f78e65
commit f99c82cd43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 13 deletions

View file

@ -77,7 +77,7 @@ export default function AddOpenIdConnect() {
isHorizontal
onSubmit={handleSubmit(onSubmit)}
>
<OIDCGeneralSettings id={id} />
<OIDCGeneralSettings />
<OpenIdConnectSettings />
<OIDCAuthentication />
<ActionGroup>

View file

@ -70,7 +70,7 @@ export default function AddSamlConnect() {
isHorizontal
onSubmit={handleSubmit(onSubmit)}
>
<SamlGeneralSettings id={id} />
<SamlGeneralSettings />
<SamlConnectSettings />
<ActionGroup>
<Button

View file

@ -344,8 +344,8 @@ export default function DetailSettings() {
)}
</>
)}
{isOIDC && <OIDCGeneralSettings id={alias} />}
{isSAML && <SamlGeneralSettings id={alias} isAliasReadonly />}
{isOIDC && <OIDCGeneralSettings />}
{isSAML && <SamlGeneralSettings isAliasReadonly />}
</FormAccess>
),
},

View file

@ -1,5 +1,5 @@
import { FormGroup, ValidatedOptions } from "@patternfly/react-core";
import { useFormContext } from "react-hook-form";
import { useWatch, useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom";
@ -10,18 +10,21 @@ import { RedirectUrl } from "../component/RedirectUrl";
import { TextField } from "../component/TextField";
import type { IdentityProviderParams } from "../routes/IdentityProvider";
export const OIDCGeneralSettings = ({ id }: { id: string }) => {
export const OIDCGeneralSettings = () => {
const { t } = useTranslation("identity-providers");
const { tab } = useParams<IdentityProviderParams>();
const {
register,
control,
formState: { errors },
} = useFormContext();
const alias = useWatch({ control, name: "alias" });
return (
<>
<RedirectUrl id={id} />
<RedirectUrl id={alias} />
<FormGroup
label={t("alias")}

View file

@ -1,5 +1,5 @@
import { FormGroup, ValidatedOptions } from "@patternfly/react-core";
import { useFormContext } from "react-hook-form";
import { useWatch, useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { FormattedLink } from "../../components/external-link/FormattedLink";
@ -14,12 +14,10 @@ import { TextField } from "../component/TextField";
import "./saml-general-settings.css";
type SamlGeneralSettingsProps = {
id: string;
isAliasReadonly?: boolean;
};
export const SamlGeneralSettings = ({
id,
isAliasReadonly = false,
}: SamlGeneralSettingsProps) => {
const { t } = useTranslation("identity-providers");
@ -27,15 +25,15 @@ export const SamlGeneralSettings = ({
const {
register,
watch,
control,
formState: { errors },
} = useFormContext();
const alias = watch("alias");
const alias = useWatch({ control, name: "alias" });
return (
<>
<RedirectUrl id={id} />
<RedirectUrl id={alias} />
<FormGroup
label={t("alias")}