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" />
|
||||
</p>
|
||||
|
||||
<LDAPUsernamePasswordForm idpId={idpId}></LDAPUsernamePasswordForm>
|
||||
<LDAPUsernamePasswordForm
|
||||
idpId={idpId}
|
||||
link={link === "true"}
|
||||
></LDAPUsernamePasswordForm>
|
||||
</div>
|
||||
</DynamicTheme>
|
||||
);
|
||||
|
@@ -18,9 +18,10 @@ type Inputs = {
|
||||
|
||||
type Props = {
|
||||
idpId: string;
|
||||
link?: boolean;
|
||||
};
|
||||
|
||||
export function LDAPUsernamePasswordForm({ idpId }: Props) {
|
||||
export function LDAPUsernamePasswordForm({ idpId, link }: Props) {
|
||||
const { register, handleSubmit, formState } = useForm<Inputs>({
|
||||
mode: "onBlur",
|
||||
});
|
||||
@@ -39,6 +40,7 @@ export function LDAPUsernamePasswordForm({ idpId }: Props) {
|
||||
idpId: idpId,
|
||||
username: values.loginName,
|
||||
password: values.password,
|
||||
link: link,
|
||||
})
|
||||
.catch(() => {
|
||||
setError("Could not start LDAP flow");
|
||||
|
@@ -34,9 +34,6 @@ export async function redirectToIdp(
|
||||
const idpId = formData.get("id") 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 (requestId) params.set("requestId", requestId);
|
||||
if (organization) params.set("organization", organization);
|
||||
@@ -194,6 +191,7 @@ type createNewSessionForLDAPCommand = {
|
||||
username: string;
|
||||
password: string;
|
||||
idpId: string;
|
||||
link: boolean;
|
||||
};
|
||||
|
||||
export async function createNewSessionForLDAP(
|
||||
@@ -229,13 +227,17 @@ export async function createNewSessionForLDAP(
|
||||
|
||||
const { userId, idpIntentId, idpIntentToken } = response.nextStep.value;
|
||||
|
||||
return {
|
||||
redirect:
|
||||
`/idp/ldap/success?` +
|
||||
new URLSearchParams({
|
||||
const params = new URLSearchParams({
|
||||
userId,
|
||||
id: idpIntentId,
|
||||
token: idpIntentToken,
|
||||
}).toString(),
|
||||
});
|
||||
|
||||
if (command.link) {
|
||||
params.set("link", "true");
|
||||
}
|
||||
|
||||
return {
|
||||
redirect: `/idp/ldap/success?` + params.toString(),
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user