linking failed page

This commit is contained in:
Max Peintner
2024-12-20 12:08:02 +01:00
parent 3887e26896
commit 09dbaf4106
9 changed files with 39 additions and 8 deletions

View File

@@ -183,7 +183,8 @@
"title": "Authentifizierungsmethode auswählen",
"description": "Wählen Sie die Methode, mit der Sie sich authentifizieren möchten.",
"noMethodsAvailable": "Keine Authentifizierungsmethoden verfügbar",
"allSetup": "Sie haben bereits einen Authentifikator eingerichtet!"
"allSetup": "Sie haben bereits einen Authentifikator eingerichtet!",
"linkWithIDP": "oder verknüpfe mit einem Identitätsanbieter"
},
"error": {
"unknownContext": "Der Kontext des Benutzers konnte nicht ermittelt werden. Stellen Sie sicher, dass Sie zuerst den Benutzernamen eingeben oder einen loginName als Suchparameter angeben.",

View File

@@ -183,7 +183,8 @@
"title": "Choose authentication method",
"description": "Select the method you would like to authenticate",
"noMethodsAvailable": "No authentication methods available",
"allSetup": "You have already setup an authenticator!"
"allSetup": "You have already setup an authenticator!",
"linkWithIDP": "or link with an Identity Provider"
},
"error": {
"unknownContext": "Could not get the context of the user. Make sure to enter the username first or provide a loginName as searchParam.",

View File

@@ -183,7 +183,8 @@
"title": "Seleccionar método de autenticación",
"description": "Selecciona el método con el que deseas autenticarte",
"noMethodsAvailable": "No hay métodos de autenticación disponibles",
"allSetup": "¡Ya has configurado un autenticador!"
"allSetup": "¡Ya has configurado un autenticador!",
"linkWithIDP": "o vincúlalo con un proveedor de identidad"
},
"error": {
"unknownContext": "No se pudo obtener el contexto del usuario. Asegúrate de ingresar primero el nombre de usuario o proporcionar un loginName como parámetro de búsqueda.",

View File

@@ -183,7 +183,8 @@
"title": "Seleziona metodo di autenticazione",
"description": "Seleziona il metodo con cui desideri autenticarti",
"noMethodsAvailable": "Nessun metodo di autenticazione disponibile",
"allSetup": "Hai già configurato un autenticatore!"
"allSetup": "Hai già configurato un autenticatore!",
"linkWithIDP": "o collega con un Identity Provider"
},
"error": {
"unknownContext": "Impossibile ottenere il contesto dell'utente. Assicurati di inserire prima il nome utente o di fornire un loginName come parametro di ricerca.",

View File

@@ -183,7 +183,8 @@
"title": "选择认证方式",
"description": "选择您想使用的认证方法",
"noMethodsAvailable": "没有可用的认证方法",
"allSetup": "您已经设置好了一个认证器!"
"allSetup": "您已经设置好了一个认证器!",
"linkWithIDP": "或将其与身份提供者关联"
},
"error": {
"unknownContext": "无法获取用户的上下文。请先输入用户名或提供 loginName 作为搜索参数。",

View File

@@ -133,9 +133,9 @@ export default async function Page(props: {
></ChooseAuthenticatorToSetup>
)}
<p className="ztdl-p text-center">
or sign in with an Identity Provider
</p>
<div className="py-3 flex flex-col">
<p className="ztdl-p text-center">{t("linkWithIDP")}</p>
</div>
{loginSettings?.allowExternalIdp && identityProviders && (
<SignInWithIdp

View File

@@ -159,6 +159,29 @@ export default async function Page(props: {
const providerType = idpTypeToIdentityProviderType(idp.type);
if (link && options?.isLinkingAllowed) {
console.log(userId);
const idpLink = await addIDPLink(
{
id: idpInformation.idpId,
userId: idpInformation.userId,
userName: idpInformation.userName,
},
userId,
);
if (!idpLink) {
return linkingFailed(branding);
} else {
return linkingSuccess(
userId,
{ idpIntentId: id, idpIntentToken: token },
authRequestId,
branding,
);
}
}
// search for potential user via username, then link
if (options?.isLinkingAllowed) {
let foundUser;

View File

@@ -120,6 +120,7 @@ export async function sendVerificationRedirectWithoutCheck(command: {
if (!authMethodResponse || !authMethodResponse.authMethodTypes) {
return { error: "Could not load possible authenticators" };
}
// if no authmethods are found on the user, redirect to set one up
if (
authMethodResponse &&

View File

@@ -170,6 +170,8 @@ export async function sendLoginname(command: SendLoginnameCommand) {
session.factors?.user?.id,
);
console.log(methods);
if (!methods.authMethodTypes || !methods.authMethodTypes.length) {
if (
potentialUsers[0].type.case === "human" &&