fix redirect from loginname

This commit is contained in:
peintnermax
2024-09-10 15:16:27 +02:00
parent 32e1e4bfb6
commit 9cba5755c3
3 changed files with 9 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ if (fs.existsSync(customConfigPath)) {
customConfig = module.default; customConfig = module.default;
}) })
.catch((error) => { .catch((error) => {
console.warn("Error loading custom configuration:", error); console.warn("Could not find custom configuration:", error);
}); });
} else { } else {
console.info("No custom configuration file found!"); console.info("No custom configuration file found!");

View File

@@ -62,7 +62,6 @@ export async function sendLoginname(command: SendLoginnameCommand) {
if (identityProviders.length === 1) { if (identityProviders.length === 1) {
const host = headers().get("host"); const host = headers().get("host");
console.log("host", host);
const identityProviderType = identityProviders[0].type; const identityProviderType = identityProviders[0].type;
const provider = idpTypeToSlug(identityProviderType); const provider = idpTypeToSlug(identityProviderType);
@@ -109,9 +108,9 @@ export async function sendLoginname(command: SendLoginnameCommand) {
params.set("loginName", command.loginName); params.set("loginName", command.loginName);
} }
const registerUrl = new URL("/register?" + params); const registerUrl = "/register?" + params;
return redirect(registerUrl.toString()); return redirect(registerUrl);
} }
throw Error("Could not find user"); throw Error("Could not find user");

View File

@@ -73,10 +73,16 @@ export default function UsernameForm({
) { ) {
const response = await submitLoginName(values, organization); const response = await submitLoginName(values, organization);
if (!response) {
setError("An internal error occurred");
return;
}
if (response?.authMethodTypes && response.authMethodTypes.length === 0) { if (response?.authMethodTypes && response.authMethodTypes.length === 0) {
setError( setError(
"User has no available authentication methods. Contact your administrator to setup authentication for the requested user.", "User has no available authentication methods. Contact your administrator to setup authentication for the requested user.",
); );
return;
} }
if (response?.authMethodTypes.length == 1) { if (response?.authMethodTypes.length == 1) {