@passflow/react 0.2.0 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +28 -35
- package/dist/index.es.js.map +1 -1
- package/dist/src/components/form/forgot-password/forgot-password.d.ts.map +1 -1
- package/dist/src/components/form/invitation-join/index.d.ts.map +1 -1
- package/dist/src/components/form/reset-password/index.d.ts.map +1 -1
- package/dist/src/components/form/signin/index.d.ts.map +1 -1
- package/dist/src/components/form/signup/index.d.ts.map +1 -1
- package/dist/src/components/form/two-factor-verify/two-factor-recovery-form.d.ts.map +1 -1
- package/dist/src/components/form/verify-challenge/verify-challenge-otp-manual.d.ts.map +1 -1
- package/dist/src/components/provider/passflow-provider.d.ts.map +1 -1
- package/dist/src/hooks/use-app-settings.d.ts.map +1 -1
- package/dist/src/hooks/use-two-factor-setup-magic-link.d.ts.map +1 -1
- package/dist/src/utils/classify-two-factor-error.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ import { parseToken, Passflow } from '@passflow/core';
|
|
|
20
20
|
export * from '@passflow/core';
|
|
21
21
|
import 'react-dom';
|
|
22
22
|
|
|
23
|
-
const version = "0.
|
|
23
|
+
const version = "0.2.8";
|
|
24
24
|
|
|
25
25
|
window.passflowReactAppVersion = () => {
|
|
26
26
|
console.log(`App Version: ${version}`);
|
|
@@ -292,7 +292,6 @@ function getUserFriendlyErrorMessage(error) {
|
|
|
292
292
|
return "Two-factor authentication is not enabled for your account. Please contact your administrator to enable 2FA.";
|
|
293
293
|
case "invalid_code":
|
|
294
294
|
return "Invalid code. Please check your authenticator app and try again.";
|
|
295
|
-
case "generic":
|
|
296
295
|
default:
|
|
297
296
|
return error.message;
|
|
298
297
|
}
|
|
@@ -1032,10 +1031,9 @@ const useAppSettings = () => {
|
|
|
1032
1031
|
break;
|
|
1033
1032
|
}
|
|
1034
1033
|
} catch {
|
|
1035
|
-
continue;
|
|
1036
1034
|
}
|
|
1037
1035
|
}
|
|
1038
|
-
if (response
|
|
1036
|
+
if (response?.ok) {
|
|
1039
1037
|
const settings = await response.json();
|
|
1040
1038
|
const discoveredAppId = settings.login_app?.app_id || settings.appId;
|
|
1041
1039
|
if (discoveredAppId) {
|
|
@@ -1713,7 +1711,8 @@ const useTwoFactorSetupMagicLink = (token) => {
|
|
|
1713
1711
|
}
|
|
1714
1712
|
setError(null);
|
|
1715
1713
|
try {
|
|
1716
|
-
const
|
|
1714
|
+
const passflowWithMagicLink = passflow;
|
|
1715
|
+
const response = await passflowWithMagicLink.validateTwoFactorSetupMagicLink(token);
|
|
1717
1716
|
if (response.success && response.sessionToken && response.userId) {
|
|
1718
1717
|
setSessionToken(response.sessionToken);
|
|
1719
1718
|
setUserId(response.userId);
|
|
@@ -1771,7 +1770,8 @@ const useTwoFactorSetupMagicLink = (token) => {
|
|
|
1771
1770
|
clearInterval(countdownTimerRef.current);
|
|
1772
1771
|
}
|
|
1773
1772
|
if (shouldClearOnUnmount.current) {
|
|
1774
|
-
passflow
|
|
1773
|
+
const passflowWithSession = passflow;
|
|
1774
|
+
passflowWithSession.clearMagicLinkSession?.();
|
|
1775
1775
|
}
|
|
1776
1776
|
};
|
|
1777
1777
|
}, [passflow]);
|
|
@@ -2146,7 +2146,7 @@ const TwoFactorSetupForm = ({ onComplete, onCancel, numInputs }) => {
|
|
|
2146
2146
|
/* @__PURE__ */ jsx(Icon, { size: "small", id: "warning", type: "general", className: "icon-warning" }),
|
|
2147
2147
|
/* @__PURE__ */ jsx("span", { children: "These codes will only be shown once. Make sure to save them!" })
|
|
2148
2148
|
] }),
|
|
2149
|
-
/* @__PURE__ */ jsx("div", { className: "passflow-2fa-recovery-codes", children: recoveryCodes.map((recoveryCode
|
|
2149
|
+
/* @__PURE__ */ jsx("div", { className: "passflow-2fa-recovery-codes", children: recoveryCodes.map((recoveryCode) => /* @__PURE__ */ jsx("code", { className: "passflow-2fa-recovery-code", children: recoveryCode }, recoveryCode)) }),
|
|
2150
2150
|
/* @__PURE__ */ jsx(Button, { size: "big", type: "button", variant: "secondary", onClick: handleCopyRecoveryCodes, children: "Copy to Clipboard" }),
|
|
2151
2151
|
/* @__PURE__ */ jsx(Button, { size: "big", type: "button", variant: "primary", onClick: handleComplete, children: "I've Saved These Codes" })
|
|
2152
2152
|
] })
|
|
@@ -2440,7 +2440,6 @@ const TwoFactorRecoveryForm = ({
|
|
|
2440
2440
|
isError && "passflow-field--error",
|
|
2441
2441
|
isInputDisabled && "passflow-field--disabled"
|
|
2442
2442
|
),
|
|
2443
|
-
autoFocus: !isInputDisabled,
|
|
2444
2443
|
autoComplete: "off",
|
|
2445
2444
|
disabled: isInputDisabled
|
|
2446
2445
|
}
|
|
@@ -2692,9 +2691,9 @@ const SignInForm = ({
|
|
|
2692
2691
|
navigate({ to: twoFactorVerifyPath ?? routes.two_factor_verify.path });
|
|
2693
2692
|
return;
|
|
2694
2693
|
}
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
else window.location.href = await getUrlWithTokens(passflow,
|
|
2694
|
+
const redirectUrl = successAuthRedirect ?? appSettings?.defaults.redirect ?? "";
|
|
2695
|
+
if (!isValidUrl(redirectUrl)) navigate({ to: redirectUrl });
|
|
2696
|
+
else window.location.href = await getUrlWithTokens(passflow, redirectUrl);
|
|
2698
2697
|
}
|
|
2699
2698
|
};
|
|
2700
2699
|
const onSubmitPasskeyHandler = async (passkeyPayload) => {
|
|
@@ -2708,9 +2707,9 @@ const SignInForm = ({
|
|
|
2708
2707
|
navigate({ to: twoFactorVerifyPath ?? routes.two_factor_verify.path });
|
|
2709
2708
|
return;
|
|
2710
2709
|
}
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
else window.location.href = await getUrlWithTokens(passflow,
|
|
2710
|
+
const redirectUrl = successAuthRedirect ?? appSettings?.defaults.redirect ?? "";
|
|
2711
|
+
if (!isValidUrl(redirectUrl)) navigate({ to: redirectUrl });
|
|
2712
|
+
else window.location.href = await getUrlWithTokens(passflow, redirectUrl);
|
|
2714
2713
|
}
|
|
2715
2714
|
};
|
|
2716
2715
|
const onSubmitPasswordlessHandler = async (userPayload) => {
|
|
@@ -2719,8 +2718,7 @@ const SignInForm = ({
|
|
|
2719
2718
|
...userPayload,
|
|
2720
2719
|
challenge_type: getPasswordlessData(authMethods, defaultMethod)?.challengeType,
|
|
2721
2720
|
create_tenant: createTenantForNewUser,
|
|
2722
|
-
|
|
2723
|
-
redirect_url: successAuthRedirect ?? appSettings.defaults.redirect,
|
|
2721
|
+
redirect_url: successAuthRedirect ?? appSettings?.defaults.redirect,
|
|
2724
2722
|
...!isEmpty(inviteToken) && { invite_token: inviteToken }
|
|
2725
2723
|
};
|
|
2726
2724
|
const response = await fetch(payload, "passwordless");
|
|
@@ -3151,25 +3149,24 @@ const SignUpForm = ({
|
|
|
3151
3149
|
};
|
|
3152
3150
|
const status = await fetch(payload, "password");
|
|
3153
3151
|
if (status) {
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
else window.location.href = await getUrlWithTokens(passflow,
|
|
3152
|
+
const redirectUrl = successAuthRedirect ?? appSettings?.defaults.redirect ?? "";
|
|
3153
|
+
if (!isValidUrl(redirectUrl)) navigate({ to: redirectUrl });
|
|
3154
|
+
else window.location.href = await getUrlWithTokens(passflow, redirectUrl);
|
|
3157
3155
|
}
|
|
3158
3156
|
};
|
|
3159
3157
|
const onSubmitPasskeyHandler = async () => {
|
|
3158
|
+
const redirectUrl = successAuthRedirect ?? appSettings?.defaults.redirect ?? "";
|
|
3160
3159
|
const payload = {
|
|
3161
3160
|
relying_party_id: relyingPartyId,
|
|
3162
3161
|
create_tenant: createTenantForNewUser,
|
|
3163
|
-
|
|
3164
|
-
redirect_url: successAuthRedirect ?? appSettings.defaults.redirect,
|
|
3162
|
+
redirect_url: redirectUrl,
|
|
3165
3163
|
...!isEmpty(inviteToken) && { invite_token: inviteToken },
|
|
3166
3164
|
scopes
|
|
3167
3165
|
};
|
|
3168
3166
|
const response = await fetch(payload, "passkey");
|
|
3169
3167
|
if (response) {
|
|
3170
|
-
if (!isValidUrl(
|
|
3171
|
-
|
|
3172
|
-
else window.location.href = await getUrlWithTokens(passflow, successAuthRedirect ?? appSettings.defaults.redirect);
|
|
3168
|
+
if (!isValidUrl(redirectUrl)) navigate({ to: redirectUrl });
|
|
3169
|
+
else window.location.href = await getUrlWithTokens(passflow, redirectUrl);
|
|
3173
3170
|
}
|
|
3174
3171
|
};
|
|
3175
3172
|
const onSubmitPasswordlessHandler = async (userPayload) => {
|
|
@@ -3178,8 +3175,7 @@ const SignUpForm = ({
|
|
|
3178
3175
|
...userPayload,
|
|
3179
3176
|
challenge_type: currentChallegeType,
|
|
3180
3177
|
create_tenant: createTenantForNewUser,
|
|
3181
|
-
|
|
3182
|
-
redirect_url: successAuthRedirect ?? appSettings.defaults.redirect,
|
|
3178
|
+
redirect_url: successAuthRedirect ?? appSettings?.defaults.redirect,
|
|
3183
3179
|
...!isEmpty(inviteToken) && { invite_token: inviteToken }
|
|
3184
3180
|
};
|
|
3185
3181
|
const response = await fetch(payload, "passwordless");
|
|
@@ -3665,8 +3661,7 @@ const VerifyChallengeOTPManual = ({
|
|
|
3665
3661
|
const payload = {
|
|
3666
3662
|
create_tenant: createTenantForNewUser,
|
|
3667
3663
|
challenge_type: challengeType,
|
|
3668
|
-
|
|
3669
|
-
redirect_url: successAuthRedirect ?? appSettings.defaults.redirect,
|
|
3664
|
+
redirect_url: successAuthRedirect ?? appSettings?.defaults.redirect ?? "",
|
|
3670
3665
|
...identity === "email" ? { email: identityValue } : { phone: identityValue }
|
|
3671
3666
|
};
|
|
3672
3667
|
const refetchResponse = await refetch(payload, type);
|
|
@@ -3919,8 +3914,7 @@ const ForgotPassword = ({
|
|
|
3919
3914
|
...isEmail && { email: values.email_or_username },
|
|
3920
3915
|
...isUsername && { username: values.email_or_username },
|
|
3921
3916
|
...isPhone && { phone: validatedPhone.phoneNumber },
|
|
3922
|
-
|
|
3923
|
-
redirect_url: successResetRedirect ?? appSettings.defaults.redirect
|
|
3917
|
+
redirect_url: successResetRedirect ?? appSettings?.defaults.redirect
|
|
3924
3918
|
};
|
|
3925
3919
|
const status = await fetch(payload);
|
|
3926
3920
|
if (status) {
|
|
@@ -4138,12 +4132,12 @@ const ResetPassword = ({ successAuthRedirect }) => {
|
|
|
4138
4132
|
const resetTokenType = resetTokenData;
|
|
4139
4133
|
const status = await fetch(values.password);
|
|
4140
4134
|
if (status) {
|
|
4141
|
-
if (!isValidUrl(resetTokenType?.redirect_url ?? successAuthRedirect ?? appSettings
|
|
4142
|
-
navigate({ to: resetTokenType?.redirect_url ?? successAuthRedirect ?? appSettings
|
|
4135
|
+
if (!isValidUrl(resetTokenType?.redirect_url ?? successAuthRedirect ?? appSettings?.defaults.redirect))
|
|
4136
|
+
navigate({ to: resetTokenType?.redirect_url ?? successAuthRedirect ?? appSettings?.defaults.redirect });
|
|
4143
4137
|
else
|
|
4144
4138
|
window.location.href = await getUrlWithTokens(
|
|
4145
4139
|
passflow,
|
|
4146
|
-
resetTokenType?.redirect_url ?? successAuthRedirect ?? appSettings
|
|
4140
|
+
resetTokenType?.redirect_url ?? successAuthRedirect ?? appSettings?.defaults.redirect
|
|
4147
4141
|
);
|
|
4148
4142
|
}
|
|
4149
4143
|
};
|
|
@@ -4306,7 +4300,7 @@ const InvitationJoinFlow = ({
|
|
|
4306
4300
|
type: "button",
|
|
4307
4301
|
variant: "primary",
|
|
4308
4302
|
className: "passflow-button-invitation-join",
|
|
4309
|
-
onClick: () => void onClickAcceptInvitationHandler(redirectUrl ?? successAuthRedirect ?? appSettings
|
|
4303
|
+
onClick: () => void onClickAcceptInvitationHandler(redirectUrl ?? successAuthRedirect ?? appSettings?.defaults.redirect),
|
|
4310
4304
|
disabled: isInvitationJoinLoading,
|
|
4311
4305
|
children: "Accept invitation"
|
|
4312
4306
|
}
|
|
@@ -6385,7 +6379,6 @@ const PassflowProvider = ({
|
|
|
6385
6379
|
}
|
|
6386
6380
|
}
|
|
6387
6381
|
} catch (error) {
|
|
6388
|
-
continue;
|
|
6389
6382
|
}
|
|
6390
6383
|
}
|
|
6391
6384
|
console.warn("Failed to discover appId from /settings");
|