fix url template

This commit is contained in:
Max Peintner
2024-12-10 09:59:37 +01:00
parent 4187028e7b
commit 60218306d1

View File

@@ -84,7 +84,7 @@ export function LoginOTP({
value: host value: host
? { ? {
urlTemplate: urlTemplate:
`${host.includes("localhost") ? "http://" : "https://"}${host}/otp/method=${method}?code={{.Code}}&userId={{.UserID}}&sessionId={{.SessionID}}` + `${host.includes("localhost") ? "http://" : "https://"}${host}/otp/${method}?code={{.Code}}&userId={{.UserID}}&sessionId={{.SessionID}}` +
(authRequestId ? `&authRequestId=${authRequestId}` : ""), (authRequestId ? `&authRequestId=${authRequestId}` : ""),
} }
: {}, : {},
@@ -182,11 +182,11 @@ export function LoginOTP({
function setCodeAndContinue(values: Inputs, organization?: string) { function setCodeAndContinue(values: Inputs, organization?: string) {
return submitCode(values, organization).then(async (response) => { return submitCode(values, organization).then(async (response) => {
setLoading(true); if (response && "sessionId" in response) {
// Wait for 2 seconds to avoid eventual consistency issues with an OTP code being verified in the /login endpoint setLoading(true);
await new Promise((resolve) => setTimeout(resolve, 2000)); // Wait for 2 seconds to avoid eventual consistency issues with an OTP code being verified in the /login endpoint
await new Promise((resolve) => setTimeout(resolve, 2000));
if (response) {
const url = const url =
authRequestId && response.sessionId authRequestId && response.sessionId
? await getNextUrl( ? await getNextUrl(