mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 11:27:33 +00:00
link property for ldap
This commit is contained in:
@@ -46,7 +46,10 @@ export default async function Page(props: {
|
|||||||
<Translated i18nKey="description" namespace="ldap" />
|
<Translated i18nKey="description" namespace="ldap" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<LDAPUsernamePasswordForm idpId={idpId}></LDAPUsernamePasswordForm>
|
<LDAPUsernamePasswordForm
|
||||||
|
idpId={idpId}
|
||||||
|
link={link === "true"}
|
||||||
|
></LDAPUsernamePasswordForm>
|
||||||
</div>
|
</div>
|
||||||
</DynamicTheme>
|
</DynamicTheme>
|
||||||
);
|
);
|
||||||
|
@@ -18,9 +18,10 @@ type Inputs = {
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
idpId: string;
|
idpId: string;
|
||||||
|
link?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function LDAPUsernamePasswordForm({ idpId }: Props) {
|
export function LDAPUsernamePasswordForm({ idpId, link }: Props) {
|
||||||
const { register, handleSubmit, formState } = useForm<Inputs>({
|
const { register, handleSubmit, formState } = useForm<Inputs>({
|
||||||
mode: "onBlur",
|
mode: "onBlur",
|
||||||
});
|
});
|
||||||
@@ -39,6 +40,7 @@ export function LDAPUsernamePasswordForm({ idpId }: Props) {
|
|||||||
idpId: idpId,
|
idpId: idpId,
|
||||||
username: values.loginName,
|
username: values.loginName,
|
||||||
password: values.password,
|
password: values.password,
|
||||||
|
link: link,
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
setError("Could not start LDAP flow");
|
setError("Could not start LDAP flow");
|
||||||
|
@@ -34,9 +34,6 @@ export async function redirectToIdp(
|
|||||||
const idpId = formData.get("id") as string;
|
const idpId = formData.get("id") as string;
|
||||||
const provider = formData.get("provider") as string;
|
const provider = formData.get("provider") as string;
|
||||||
|
|
||||||
// const username = formData.get("username") as string;
|
|
||||||
// const password = formData.get("password") as string;
|
|
||||||
|
|
||||||
if (linkOnly) params.set("link", "true");
|
if (linkOnly) params.set("link", "true");
|
||||||
if (requestId) params.set("requestId", requestId);
|
if (requestId) params.set("requestId", requestId);
|
||||||
if (organization) params.set("organization", organization);
|
if (organization) params.set("organization", organization);
|
||||||
@@ -194,6 +191,7 @@ type createNewSessionForLDAPCommand = {
|
|||||||
username: string;
|
username: string;
|
||||||
password: string;
|
password: string;
|
||||||
idpId: string;
|
idpId: string;
|
||||||
|
link: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function createNewSessionForLDAP(
|
export async function createNewSessionForLDAP(
|
||||||
@@ -229,13 +227,17 @@ export async function createNewSessionForLDAP(
|
|||||||
|
|
||||||
const { userId, idpIntentId, idpIntentToken } = response.nextStep.value;
|
const { userId, idpIntentId, idpIntentToken } = response.nextStep.value;
|
||||||
|
|
||||||
|
const params = new URLSearchParams({
|
||||||
|
userId,
|
||||||
|
id: idpIntentId,
|
||||||
|
token: idpIntentToken,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (command.link) {
|
||||||
|
params.set("link", "true");
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
redirect:
|
redirect: `/idp/ldap/success?` + params.toString(),
|
||||||
`/idp/ldap/success?` +
|
|
||||||
new URLSearchParams({
|
|
||||||
userId,
|
|
||||||
id: idpIntentId,
|
|
||||||
token: idpIntentToken,
|
|
||||||
}).toString(),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user