@reachfive/identity-ui 1.26.0 → 1.26.1
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/cjs/identity-ui.js +310 -105
- package/cjs/identity-ui.js.map +1 -1
- package/es/identity-ui.js +310 -105
- package/es/identity-ui.js.map +1 -1
- package/es/identity-ui.min.js +88 -74
- package/es/identity-ui.min.js.map +1 -1
- package/package.json +1 -1
- package/types/identity-ui.d.ts +77 -8
- package/umd/identity-ui.js +310 -105
- package/umd/identity-ui.js.map +1 -1
- package/umd/identity-ui.min.js +86 -72
- package/umd/identity-ui.min.js.map +1 -1
package/es/identity-ui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @reachfive/identity-ui - v1.26.
|
|
3
|
-
* Compiled
|
|
2
|
+
* @reachfive/identity-ui - v1.26.1
|
|
3
|
+
* Compiled Fri, 19 Apr 2024 13:15:48 UTC
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) ReachFive.
|
|
6
6
|
*
|
|
@@ -4551,6 +4551,7 @@ function isValued(v, rawProperty = "raw") {
|
|
|
4551
4551
|
const unwrap = v !== null && typeof v === "object" ? v[rawProperty] : v;
|
|
4552
4552
|
return unwrap !== null && unwrap !== void 0 && unwrap !== "" && !Number.isNaN(unwrap) && (Array.isArray(unwrap) ? unwrap.length > 0 : true);
|
|
4553
4553
|
}
|
|
4554
|
+
const isCustomIdentifier = (identifier) => "customIdentifier" in identifier;
|
|
4554
4555
|
const specializeIdentifier = (identifier) => isValidEmail(identifier) ? { email: identifier } : libphonenumber.isValidNumber(identifier) ? { phoneNumber: identifier.replace(/\s+/g, "") } : { customIdentifier: identifier };
|
|
4555
4556
|
function specializeIdentifierData(data) {
|
|
4556
4557
|
if ("identifier" in data && typeof data.identifier === "string") {
|
|
@@ -5243,7 +5244,7 @@ function createForm(config) {
|
|
|
5243
5244
|
}, () => callback && callback(!this.state.hasErrors));
|
|
5244
5245
|
}
|
|
5245
5246
|
render() {
|
|
5246
|
-
const { submitLabel, i18n, fieldValidationDebounce } = this.props;
|
|
5247
|
+
const { submitLabel, allowWebAuthnLogin, i18n, fieldValidationDebounce } = this.props;
|
|
5247
5248
|
const { errorMessage, isLoading, fields } = this.state;
|
|
5248
5249
|
return /* @__PURE__ */ React.createElement(Form, { noValidate: true, onSubmit: this.handleSubmit }, errorMessage && /* @__PURE__ */ React.createElement(Error$1, null, errorMessage), this.allFields.map((field) => !field.staticContent ? field.render({
|
|
5249
5250
|
state: fields[field.key],
|
|
@@ -5254,7 +5255,7 @@ function createForm(config) {
|
|
|
5254
5255
|
}, fieldValidationDebounce)(this);
|
|
5255
5256
|
},
|
|
5256
5257
|
...this.props.sharedProps
|
|
5257
|
-
}) : field.staticContent), /* @__PURE__ */ React.createElement(PrimaryButton, { disabled: isLoading }, i18n(submitLabel)));
|
|
5258
|
+
}) : field.staticContent), !allowWebAuthnLogin && /* @__PURE__ */ React.createElement(PrimaryButton, { disabled: isLoading }, i18n(submitLabel)), allowWebAuthnLogin && this.props.webAuthnButtons(isLoading, this.handleClick));
|
|
5258
5259
|
}
|
|
5259
5260
|
}
|
|
5260
5261
|
__publicField$8(FormComponent, "defaultProps", {
|
|
@@ -5948,7 +5949,7 @@ const simpleField = ({ type, placeholder, ...config }) => createField({
|
|
|
5948
5949
|
}
|
|
5949
5950
|
});
|
|
5950
5951
|
|
|
5951
|
-
const ForgotPasswordWrapper = styled.div`
|
|
5952
|
+
const ForgotPasswordWrapper$1 = styled.div`
|
|
5952
5953
|
margin-bottom: ${(props) => props.theme.spacing}px;
|
|
5953
5954
|
text-align: right;
|
|
5954
5955
|
${(props) => props.floating && `
|
|
@@ -5989,7 +5990,7 @@ const LoginForm = createForm({
|
|
|
5989
5990
|
canShowPassword
|
|
5990
5991
|
}),
|
|
5991
5992
|
showForgotPassword && {
|
|
5992
|
-
staticContent: /* @__PURE__ */ React.createElement(ForgotPasswordWrapper, { key: "forgot-password", floating: showRememberMe }, /* @__PURE__ */ React.createElement(Link, { target: "forgot-password" }, i18n("login.forgotPasswordLink")))
|
|
5993
|
+
staticContent: /* @__PURE__ */ React.createElement(ForgotPasswordWrapper$1, { key: "forgot-password", floating: showRememberMe }, /* @__PURE__ */ React.createElement(Link, { target: "forgot-password" }, i18n("login.forgotPasswordLink")))
|
|
5993
5994
|
},
|
|
5994
5995
|
showRememberMe && checkboxField({
|
|
5995
5996
|
key: "auth.persistent",
|
|
@@ -6059,6 +6060,290 @@ const LoginView = ({
|
|
|
6059
6060
|
), allowSignup && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement("span", null, i18n("login.signupLinkPrefix")), "\xA0", /* @__PURE__ */ React.createElement(Link, { target: "signup", controller }, i18n("login.signupLink"))));
|
|
6060
6061
|
};
|
|
6061
6062
|
|
|
6063
|
+
var _path$3, _path2$1;
|
|
6064
|
+
function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
|
|
6065
|
+
var SvgFingerprint = function SvgFingerprint(props) {
|
|
6066
|
+
return /*#__PURE__*/reactExports.createElement("svg", _extends$3({
|
|
6067
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6068
|
+
fill: "currentColor",
|
|
6069
|
+
viewBox: "0 0 24 24"
|
|
6070
|
+
}, props), _path$3 || (_path$3 = /*#__PURE__*/reactExports.createElement("path", {
|
|
6071
|
+
fill: "none",
|
|
6072
|
+
d: "M0 0h24v24H0z"
|
|
6073
|
+
})), _path2$1 || (_path2$1 = /*#__PURE__*/reactExports.createElement("path", {
|
|
6074
|
+
d: "M17.81 4.47c-.08 0-.16-.02-.23-.06C15.66 3.42 14 3 12.01 3c-1.98 0-3.86.47-5.57 1.41-.24.13-.54.04-.68-.2a.506.506 0 0 1 .2-.68C7.82 2.52 9.86 2 12.01 2c2.13 0 3.99.47 6.03 1.52.25.13.34.43.21.67a.49.49 0 0 1-.44.28M3.5 9.72a.499.499 0 0 1-.41-.79c.99-1.4 2.25-2.5 3.75-3.27C9.98 4.04 14 4.03 17.15 5.65c1.5.77 2.76 1.86 3.75 3.25a.5.5 0 0 1-.12.7c-.23.16-.54.11-.7-.12a9.4 9.4 0 0 0-3.39-2.94c-2.87-1.47-6.54-1.47-9.4.01-1.36.7-2.5 1.7-3.4 2.96-.08.14-.23.21-.39.21m6.25 12.07a.47.47 0 0 1-.35-.15c-.87-.87-1.34-1.43-2.01-2.64-.69-1.23-1.05-2.73-1.05-4.34 0-2.97 2.54-5.39 5.66-5.39s5.66 2.42 5.66 5.39c0 .28-.22.5-.5.5s-.5-.22-.5-.5c0-2.42-2.09-4.39-4.66-4.39s-4.66 1.97-4.66 4.39c0 1.44.32 2.77.93 3.85.64 1.15 1.08 1.64 1.85 2.42.19.2.19.51 0 .71-.11.1-.24.15-.37.15m7.17-1.85c-1.19 0-2.24-.3-3.1-.89-1.49-1.01-2.38-2.65-2.38-4.39 0-.28.22-.5.5-.5s.5.22.5.5c0 1.41.72 2.74 1.94 3.56.71.48 1.54.71 2.54.71.24 0 .64-.03 1.04-.1.27-.05.53.13.58.41.05.27-.13.53-.41.58-.57.11-1.07.12-1.21.12M14.91 22c-.04 0-.09-.01-.13-.02-1.59-.44-2.63-1.03-3.72-2.1a7.3 7.3 0 0 1-2.17-5.22c0-1.62 1.38-2.94 3.08-2.94s3.08 1.32 3.08 2.94c0 1.07.93 1.94 2.08 1.94s2.08-.87 2.08-1.94c0-3.77-3.25-6.83-7.25-6.83-2.84 0-5.44 1.58-6.61 4.03-.39.81-.59 1.76-.59 2.8 0 .78.07 2.01.67 3.61.1.26-.03.55-.29.64-.26.1-.55-.04-.64-.29a11.1 11.1 0 0 1-.73-3.96c0-1.2.23-2.29.68-3.24 1.33-2.79 4.28-4.6 7.51-4.6 4.55 0 8.25 3.51 8.25 7.83 0 1.62-1.38 2.94-3.08 2.94s-3.08-1.32-3.08-2.94c0-1.07-.93-1.94-2.08-1.94s-2.08.87-2.08 1.94c0 1.71.66 3.31 1.87 4.51.95.94 1.86 1.46 3.27 1.85.27.07.42.35.35.61-.05.23-.26.38-.47.38"
|
|
6075
|
+
})));
|
|
6076
|
+
};
|
|
6077
|
+
|
|
6078
|
+
var _path$2, _path2;
|
|
6079
|
+
function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
6080
|
+
var SvgKeyboard = function SvgKeyboard(props) {
|
|
6081
|
+
return /*#__PURE__*/reactExports.createElement("svg", _extends$2({
|
|
6082
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6083
|
+
fill: "currentColor",
|
|
6084
|
+
viewBox: "0 0 24 24"
|
|
6085
|
+
}, props), _path$2 || (_path$2 = /*#__PURE__*/reactExports.createElement("path", {
|
|
6086
|
+
d: "M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m-9 3h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-1 2H5v-2h2zm0-3H5V8h2zm9 7H8v-2h8zm0-4h-2v-2h2zm0-3h-2V8h2zm3 3h-2v-2h2zm0-3h-2V8h2z"
|
|
6087
|
+
})), _path2 || (_path2 = /*#__PURE__*/reactExports.createElement("path", {
|
|
6088
|
+
fill: "none",
|
|
6089
|
+
d: "M0 0h24v24H0zm0 0h24v24H0z"
|
|
6090
|
+
})));
|
|
6091
|
+
};
|
|
6092
|
+
|
|
6093
|
+
const iconStyle$1 = `
|
|
6094
|
+
width: 40px;
|
|
6095
|
+
height: 40px;
|
|
6096
|
+
`;
|
|
6097
|
+
const FingerPrintIcon = styled(SvgFingerprint)`${iconStyle$1}`;
|
|
6098
|
+
const KeyboardIcon = styled(SvgKeyboard)`${iconStyle$1}`;
|
|
6099
|
+
const PrimaryButtonWithIcon = styled(({
|
|
6100
|
+
type = "submit",
|
|
6101
|
+
disabled = false,
|
|
6102
|
+
text,
|
|
6103
|
+
children,
|
|
6104
|
+
className,
|
|
6105
|
+
...props
|
|
6106
|
+
}) => {
|
|
6107
|
+
const theme = useTheme();
|
|
6108
|
+
return /* @__PURE__ */ React.createElement(
|
|
6109
|
+
Button,
|
|
6110
|
+
{
|
|
6111
|
+
type,
|
|
6112
|
+
disabled,
|
|
6113
|
+
...props,
|
|
6114
|
+
className: classes(["r5-button-with-icon"], className),
|
|
6115
|
+
background: theme.backgroundColor,
|
|
6116
|
+
border: theme.backgroundColor,
|
|
6117
|
+
color: theme.primaryColor
|
|
6118
|
+
},
|
|
6119
|
+
children,
|
|
6120
|
+
text && /* @__PURE__ */ React.createElement("span", { className: "r5-button-text" }, text)
|
|
6121
|
+
);
|
|
6122
|
+
})`
|
|
6123
|
+
display: flex;
|
|
6124
|
+
align-items: center;
|
|
6125
|
+
justify-content: center;
|
|
6126
|
+
|
|
6127
|
+
.r5-button-text {
|
|
6128
|
+
margin-left: 10px;
|
|
6129
|
+
text-transform: uppercase;
|
|
6130
|
+
}
|
|
6131
|
+
`;
|
|
6132
|
+
const ButtonsSeparator = styled.div`
|
|
6133
|
+
text-align: center;
|
|
6134
|
+
color: ${(props) => props.theme.mutedTextColor}
|
|
6135
|
+
`;
|
|
6136
|
+
const WebAuthnLoginViewButtons = styled(({ disabled, onPasswordClick, className, ...props }) => {
|
|
6137
|
+
const i18n = useI18n();
|
|
6138
|
+
return /* @__PURE__ */ React.createElement("div", { className: classes(["r5-webauthn-login-buttons"], className) }, /* @__PURE__ */ React.createElement(
|
|
6139
|
+
PrimaryButtonWithIcon,
|
|
6140
|
+
{
|
|
6141
|
+
type: "submit",
|
|
6142
|
+
dataTestId: "webauthn-button",
|
|
6143
|
+
title: i18n("login.withBiometrics"),
|
|
6144
|
+
disabled,
|
|
6145
|
+
...props
|
|
6146
|
+
},
|
|
6147
|
+
/* @__PURE__ */ React.createElement(FingerPrintIcon, null)
|
|
6148
|
+
), /* @__PURE__ */ React.createElement(ButtonsSeparator, null, i18n("or")), /* @__PURE__ */ React.createElement(
|
|
6149
|
+
PrimaryButtonWithIcon,
|
|
6150
|
+
{
|
|
6151
|
+
dataTestId: "password-button",
|
|
6152
|
+
title: i18n("login.withPassword"),
|
|
6153
|
+
disabled,
|
|
6154
|
+
onClick: onPasswordClick
|
|
6155
|
+
},
|
|
6156
|
+
/* @__PURE__ */ React.createElement(KeyboardIcon, null)
|
|
6157
|
+
));
|
|
6158
|
+
})`
|
|
6159
|
+
display: flex;
|
|
6160
|
+
align-items: center;
|
|
6161
|
+
|
|
6162
|
+
& > :not(:last-child) {
|
|
6163
|
+
margin-right: 20px;
|
|
6164
|
+
}
|
|
6165
|
+
`;
|
|
6166
|
+
const WebAuthnSignupViewButtons = styled(({ onBiometricClick, onPasswordClick, className }) => {
|
|
6167
|
+
const i18n = useI18n();
|
|
6168
|
+
return /* @__PURE__ */ React.createElement("div", { className: classes(["r5-webauthn-signup-buttons"], className) }, /* @__PURE__ */ React.createElement(
|
|
6169
|
+
PrimaryButtonWithIcon,
|
|
6170
|
+
{
|
|
6171
|
+
dataTestId: "webauthn-button",
|
|
6172
|
+
onClick: onBiometricClick,
|
|
6173
|
+
title: i18n("signup.withBiometrics"),
|
|
6174
|
+
text: i18n("biometrics")
|
|
6175
|
+
},
|
|
6176
|
+
/* @__PURE__ */ React.createElement(FingerPrintIcon, null)
|
|
6177
|
+
), /* @__PURE__ */ React.createElement(Separator, { text: i18n("or") }), /* @__PURE__ */ React.createElement(
|
|
6178
|
+
PrimaryButtonWithIcon,
|
|
6179
|
+
{
|
|
6180
|
+
dataTestId: "password-button",
|
|
6181
|
+
onClick: onPasswordClick,
|
|
6182
|
+
title: i18n("signup.withPassword"),
|
|
6183
|
+
text: i18n("password")
|
|
6184
|
+
},
|
|
6185
|
+
/* @__PURE__ */ React.createElement(KeyboardIcon, null)
|
|
6186
|
+
));
|
|
6187
|
+
})``;
|
|
6188
|
+
|
|
6189
|
+
const LoginWithWebAuthnForm = createForm({
|
|
6190
|
+
prefix: "r5-login-",
|
|
6191
|
+
fields({ showIdentifier = true, defaultIdentifier, config }) {
|
|
6192
|
+
return [
|
|
6193
|
+
identifierField(
|
|
6194
|
+
{
|
|
6195
|
+
defaultValue: defaultIdentifier,
|
|
6196
|
+
withPhoneNumber: showIdentifier && config.sms,
|
|
6197
|
+
required: true,
|
|
6198
|
+
autoComplete: "username webauthn"
|
|
6199
|
+
},
|
|
6200
|
+
config
|
|
6201
|
+
)
|
|
6202
|
+
];
|
|
6203
|
+
},
|
|
6204
|
+
allowWebAuthnLogin: true
|
|
6205
|
+
});
|
|
6206
|
+
const LoginWithWebAuthnView = ({ acceptTos, allowSignup = true, auth, showLabels = false, socialProviders }) => {
|
|
6207
|
+
const coreClient = useReachfive();
|
|
6208
|
+
const { goTo } = useRouting();
|
|
6209
|
+
const i18n = useI18n();
|
|
6210
|
+
const session = useSession();
|
|
6211
|
+
const controller = new AbortController();
|
|
6212
|
+
const signal = controller.signal;
|
|
6213
|
+
React.useEffect(() => {
|
|
6214
|
+
coreClient.loginWithWebAuthn({
|
|
6215
|
+
conditionalMediation: "preferred",
|
|
6216
|
+
auth: {
|
|
6217
|
+
...auth
|
|
6218
|
+
},
|
|
6219
|
+
signal
|
|
6220
|
+
}).catch(() => void 0);
|
|
6221
|
+
}, [coreClient, auth, signal]);
|
|
6222
|
+
const handleWebAuthnLogin = React.useCallback(
|
|
6223
|
+
(data) => {
|
|
6224
|
+
const { auth: dataAuth, ...identifier } = specializeIdentifierData(data);
|
|
6225
|
+
if (isCustomIdentifier(identifier)) {
|
|
6226
|
+
console.error("Custom identifier is not a valid WebAuthn identifier.");
|
|
6227
|
+
return Promise.reject(new Error("Custom identifier is not a valid WebAuthn identifier."));
|
|
6228
|
+
}
|
|
6229
|
+
return coreClient.loginWithWebAuthn({
|
|
6230
|
+
...identifier,
|
|
6231
|
+
auth: {
|
|
6232
|
+
...dataAuth,
|
|
6233
|
+
...auth
|
|
6234
|
+
}
|
|
6235
|
+
});
|
|
6236
|
+
},
|
|
6237
|
+
[coreClient, auth]
|
|
6238
|
+
);
|
|
6239
|
+
const redirectToPasswordLoginView = reactExports.useCallback(
|
|
6240
|
+
(data) => {
|
|
6241
|
+
const username = "identifier" in data ? data.identifier : "email" in data ? data.email : "";
|
|
6242
|
+
goTo("login-with-password", { username });
|
|
6243
|
+
},
|
|
6244
|
+
[goTo]
|
|
6245
|
+
);
|
|
6246
|
+
const defaultIdentifier = session?.lastLoginType === "password" ? session.email : void 0;
|
|
6247
|
+
const webAuthnButtons = (disabled, handleClick) => /* @__PURE__ */ React.createElement(
|
|
6248
|
+
WebAuthnLoginViewButtons,
|
|
6249
|
+
{
|
|
6250
|
+
disabled,
|
|
6251
|
+
onPasswordClick: handleClick
|
|
6252
|
+
}
|
|
6253
|
+
);
|
|
6254
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, i18n("login.title")), socialProviders && socialProviders.length > 0 && /* @__PURE__ */ React.createElement(SocialButtons, { providers: socialProviders, auth, acceptTos }), socialProviders && socialProviders.length > 0 && /* @__PURE__ */ React.createElement(Separator, { text: i18n("or") }), /* @__PURE__ */ React.createElement(
|
|
6255
|
+
LoginWithWebAuthnForm,
|
|
6256
|
+
{
|
|
6257
|
+
showLabels,
|
|
6258
|
+
defaultIdentifier,
|
|
6259
|
+
handler: handleWebAuthnLogin,
|
|
6260
|
+
redirect: redirectToPasswordLoginView,
|
|
6261
|
+
webAuthnButtons
|
|
6262
|
+
}
|
|
6263
|
+
), allowSignup && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement("span", null, i18n("login.signupLinkPrefix")), "\xA0", /* @__PURE__ */ React.createElement(Link, { controller, target: "signup" }, i18n("login.signupLink"))));
|
|
6264
|
+
};
|
|
6265
|
+
|
|
6266
|
+
const ForgotPasswordWrapper = styled.div`
|
|
6267
|
+
margin-bottom: ${(props) => props.theme.spacing}px;
|
|
6268
|
+
text-align: right;
|
|
6269
|
+
${(props) => props.floating && `
|
|
6270
|
+
position: absolute;
|
|
6271
|
+
right: 0;
|
|
6272
|
+
`};
|
|
6273
|
+
`;
|
|
6274
|
+
const LoginWithPasswordForm = createForm({
|
|
6275
|
+
prefix: "r5-login-",
|
|
6276
|
+
fields({ username, showRememberMe, canShowPassword, showForgotPassword, i18n, config }) {
|
|
6277
|
+
return [
|
|
6278
|
+
config.sms ? identifierField({
|
|
6279
|
+
key: "identifier",
|
|
6280
|
+
defaultValue: username,
|
|
6281
|
+
withPhoneNumber: true,
|
|
6282
|
+
readOnly: true
|
|
6283
|
+
}, config) : identifierField({
|
|
6284
|
+
key: "identifier",
|
|
6285
|
+
defaultValue: username,
|
|
6286
|
+
withPhoneNumber: false,
|
|
6287
|
+
readOnly: true
|
|
6288
|
+
}, config),
|
|
6289
|
+
simplePasswordField({
|
|
6290
|
+
key: "password",
|
|
6291
|
+
label: "password",
|
|
6292
|
+
autoComplete: "current-password",
|
|
6293
|
+
canShowPassword
|
|
6294
|
+
}),
|
|
6295
|
+
showForgotPassword && {
|
|
6296
|
+
staticContent: /* @__PURE__ */ React.createElement(ForgotPasswordWrapper, { key: "forgot-password", floating: showRememberMe }, /* @__PURE__ */ React.createElement(Link, { target: "forgot-password" }, i18n("login.forgotPasswordLink")))
|
|
6297
|
+
},
|
|
6298
|
+
showRememberMe && checkboxField({
|
|
6299
|
+
key: "auth.persistent",
|
|
6300
|
+
label: "rememberMe",
|
|
6301
|
+
defaultValue: false
|
|
6302
|
+
})
|
|
6303
|
+
];
|
|
6304
|
+
},
|
|
6305
|
+
submitLabel: "login.submitLabel"
|
|
6306
|
+
});
|
|
6307
|
+
const LoginWithPasswordView = ({
|
|
6308
|
+
allowForgotPassword = true,
|
|
6309
|
+
auth,
|
|
6310
|
+
canShowPassword,
|
|
6311
|
+
recaptcha_enabled = false,
|
|
6312
|
+
recaptcha_site_key,
|
|
6313
|
+
showLabels,
|
|
6314
|
+
showRememberMe
|
|
6315
|
+
}) => {
|
|
6316
|
+
const i18n = useI18n();
|
|
6317
|
+
const coreClient = useReachfive();
|
|
6318
|
+
const { goTo, params } = useRouting();
|
|
6319
|
+
const { username } = params;
|
|
6320
|
+
reactExports.useLayoutEffect(() => {
|
|
6321
|
+
importGoogleRecaptchaScript(recaptcha_site_key);
|
|
6322
|
+
}, [recaptcha_site_key]);
|
|
6323
|
+
const callback = (data) => {
|
|
6324
|
+
const { auth: dataAuth, ...specializedData } = specializeIdentifierData(data);
|
|
6325
|
+
return coreClient.loginWithPassword({
|
|
6326
|
+
...specializedData,
|
|
6327
|
+
captchaToken: data.captchaToken,
|
|
6328
|
+
auth: {
|
|
6329
|
+
...dataAuth,
|
|
6330
|
+
...auth
|
|
6331
|
+
}
|
|
6332
|
+
}).then((res) => res?.stepUpToken ? goTo("fa-selection", { token: res.stepUpToken, amr: res.amr ?? [] }) : res);
|
|
6333
|
+
};
|
|
6334
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, i18n("login.title")), /* @__PURE__ */ React.createElement(
|
|
6335
|
+
LoginWithPasswordForm,
|
|
6336
|
+
{
|
|
6337
|
+
username,
|
|
6338
|
+
showLabels,
|
|
6339
|
+
showRememberMe,
|
|
6340
|
+
showForgotPassword: allowForgotPassword,
|
|
6341
|
+
canShowPassword,
|
|
6342
|
+
handler: (data) => ReCaptcha.handle(data, { recaptcha_enabled, recaptcha_site_key }, callback, "login")
|
|
6343
|
+
}
|
|
6344
|
+
), /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: "login-with-web-authn" }, i18n("login.password.userAnotherIdentifier"))));
|
|
6345
|
+
};
|
|
6346
|
+
|
|
6062
6347
|
const SelectField = (props) => {
|
|
6063
6348
|
const {
|
|
6064
6349
|
value = "",
|
|
@@ -6948,100 +7233,10 @@ const PasswordSignupForm = ({
|
|
|
6948
7233
|
);
|
|
6949
7234
|
};
|
|
6950
7235
|
|
|
6951
|
-
var _path$3, _path2$1;
|
|
6952
|
-
function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
|
|
6953
|
-
var SvgFingerprint = function SvgFingerprint(props) {
|
|
6954
|
-
return /*#__PURE__*/reactExports.createElement("svg", _extends$3({
|
|
6955
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6956
|
-
fill: "currentColor",
|
|
6957
|
-
viewBox: "0 0 24 24"
|
|
6958
|
-
}, props), _path$3 || (_path$3 = /*#__PURE__*/reactExports.createElement("path", {
|
|
6959
|
-
fill: "none",
|
|
6960
|
-
d: "M0 0h24v24H0z"
|
|
6961
|
-
})), _path2$1 || (_path2$1 = /*#__PURE__*/reactExports.createElement("path", {
|
|
6962
|
-
d: "M17.81 4.47c-.08 0-.16-.02-.23-.06C15.66 3.42 14 3 12.01 3c-1.98 0-3.86.47-5.57 1.41-.24.13-.54.04-.68-.2a.506.506 0 0 1 .2-.68C7.82 2.52 9.86 2 12.01 2c2.13 0 3.99.47 6.03 1.52.25.13.34.43.21.67a.49.49 0 0 1-.44.28M3.5 9.72a.499.499 0 0 1-.41-.79c.99-1.4 2.25-2.5 3.75-3.27C9.98 4.04 14 4.03 17.15 5.65c1.5.77 2.76 1.86 3.75 3.25a.5.5 0 0 1-.12.7c-.23.16-.54.11-.7-.12a9.4 9.4 0 0 0-3.39-2.94c-2.87-1.47-6.54-1.47-9.4.01-1.36.7-2.5 1.7-3.4 2.96-.08.14-.23.21-.39.21m6.25 12.07a.47.47 0 0 1-.35-.15c-.87-.87-1.34-1.43-2.01-2.64-.69-1.23-1.05-2.73-1.05-4.34 0-2.97 2.54-5.39 5.66-5.39s5.66 2.42 5.66 5.39c0 .28-.22.5-.5.5s-.5-.22-.5-.5c0-2.42-2.09-4.39-4.66-4.39s-4.66 1.97-4.66 4.39c0 1.44.32 2.77.93 3.85.64 1.15 1.08 1.64 1.85 2.42.19.2.19.51 0 .71-.11.1-.24.15-.37.15m7.17-1.85c-1.19 0-2.24-.3-3.1-.89-1.49-1.01-2.38-2.65-2.38-4.39 0-.28.22-.5.5-.5s.5.22.5.5c0 1.41.72 2.74 1.94 3.56.71.48 1.54.71 2.54.71.24 0 .64-.03 1.04-.1.27-.05.53.13.58.41.05.27-.13.53-.41.58-.57.11-1.07.12-1.21.12M14.91 22c-.04 0-.09-.01-.13-.02-1.59-.44-2.63-1.03-3.72-2.1a7.3 7.3 0 0 1-2.17-5.22c0-1.62 1.38-2.94 3.08-2.94s3.08 1.32 3.08 2.94c0 1.07.93 1.94 2.08 1.94s2.08-.87 2.08-1.94c0-3.77-3.25-6.83-7.25-6.83-2.84 0-5.44 1.58-6.61 4.03-.39.81-.59 1.76-.59 2.8 0 .78.07 2.01.67 3.61.1.26-.03.55-.29.64-.26.1-.55-.04-.64-.29a11.1 11.1 0 0 1-.73-3.96c0-1.2.23-2.29.68-3.24 1.33-2.79 4.28-4.6 7.51-4.6 4.55 0 8.25 3.51 8.25 7.83 0 1.62-1.38 2.94-3.08 2.94s-3.08-1.32-3.08-2.94c0-1.07-.93-1.94-2.08-1.94s-2.08.87-2.08 1.94c0 1.71.66 3.31 1.87 4.51.95.94 1.86 1.46 3.27 1.85.27.07.42.35.35.61-.05.23-.26.38-.47.38"
|
|
6963
|
-
})));
|
|
6964
|
-
};
|
|
6965
|
-
|
|
6966
|
-
var _path$2, _path2;
|
|
6967
|
-
function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
6968
|
-
var SvgKeyboard = function SvgKeyboard(props) {
|
|
6969
|
-
return /*#__PURE__*/reactExports.createElement("svg", _extends$2({
|
|
6970
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6971
|
-
fill: "currentColor",
|
|
6972
|
-
viewBox: "0 0 24 24"
|
|
6973
|
-
}, props), _path$2 || (_path$2 = /*#__PURE__*/reactExports.createElement("path", {
|
|
6974
|
-
d: "M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m-9 3h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-1 2H5v-2h2zm0-3H5V8h2zm9 7H8v-2h8zm0-4h-2v-2h2zm0-3h-2V8h2zm3 3h-2v-2h2zm0-3h-2V8h2z"
|
|
6975
|
-
})), _path2 || (_path2 = /*#__PURE__*/reactExports.createElement("path", {
|
|
6976
|
-
fill: "none",
|
|
6977
|
-
d: "M0 0h24v24H0zm0 0h24v24H0z"
|
|
6978
|
-
})));
|
|
6979
|
-
};
|
|
6980
|
-
|
|
6981
|
-
const iconStyle$1 = `
|
|
6982
|
-
width: 40px;
|
|
6983
|
-
height: 40px;
|
|
6984
|
-
`;
|
|
6985
|
-
const FingerPrintIcon = styled(SvgFingerprint)`${iconStyle$1}`;
|
|
6986
|
-
const KeyboardIcon = styled(SvgKeyboard)`${iconStyle$1}`;
|
|
6987
|
-
const PrimaryButtonWithIcon = styled(({
|
|
6988
|
-
type = "submit",
|
|
6989
|
-
disabled = false,
|
|
6990
|
-
text,
|
|
6991
|
-
children,
|
|
6992
|
-
className,
|
|
6993
|
-
...props
|
|
6994
|
-
}) => {
|
|
6995
|
-
const theme = useTheme();
|
|
6996
|
-
return /* @__PURE__ */ React.createElement(
|
|
6997
|
-
Button,
|
|
6998
|
-
{
|
|
6999
|
-
type,
|
|
7000
|
-
disabled,
|
|
7001
|
-
...props,
|
|
7002
|
-
className: classes(["r5-button-with-icon"], className),
|
|
7003
|
-
background: theme.backgroundColor,
|
|
7004
|
-
border: theme.backgroundColor,
|
|
7005
|
-
color: theme.primaryColor
|
|
7006
|
-
},
|
|
7007
|
-
children,
|
|
7008
|
-
text && /* @__PURE__ */ React.createElement("span", { className: "r5-button-text" }, text)
|
|
7009
|
-
);
|
|
7010
|
-
})`
|
|
7011
|
-
display: flex;
|
|
7012
|
-
align-items: center;
|
|
7013
|
-
justify-content: center;
|
|
7014
|
-
|
|
7015
|
-
.r5-button-text {
|
|
7016
|
-
margin-left: 10px;
|
|
7017
|
-
text-transform: uppercase;
|
|
7018
|
-
}
|
|
7019
|
-
`;
|
|
7020
|
-
const WebAuthnSignupViewButtons = styled(({ onBiometricClick, onPasswordClick, className }) => {
|
|
7021
|
-
const i18n = useI18n();
|
|
7022
|
-
return /* @__PURE__ */ React.createElement("div", { className: classes(["r5-webauthn-signup-buttons"], className) }, /* @__PURE__ */ React.createElement(
|
|
7023
|
-
PrimaryButtonWithIcon,
|
|
7024
|
-
{
|
|
7025
|
-
dataTestId: "webauthn-button",
|
|
7026
|
-
onClick: onBiometricClick,
|
|
7027
|
-
title: i18n("signup.withBiometrics"),
|
|
7028
|
-
text: i18n("biometrics")
|
|
7029
|
-
},
|
|
7030
|
-
/* @__PURE__ */ React.createElement(FingerPrintIcon, null)
|
|
7031
|
-
), /* @__PURE__ */ React.createElement(Separator, { text: i18n("or") }), /* @__PURE__ */ React.createElement(
|
|
7032
|
-
PrimaryButtonWithIcon,
|
|
7033
|
-
{
|
|
7034
|
-
dataTestId: "password-button",
|
|
7035
|
-
onClick: onPasswordClick,
|
|
7036
|
-
title: i18n("signup.withPassword"),
|
|
7037
|
-
text: i18n("password")
|
|
7038
|
-
},
|
|
7039
|
-
/* @__PURE__ */ React.createElement(KeyboardIcon, null)
|
|
7040
|
-
));
|
|
7041
|
-
})``;
|
|
7042
|
-
|
|
7043
7236
|
const SignupView = ({
|
|
7044
7237
|
allowLogin = true,
|
|
7238
|
+
initialScreen,
|
|
7239
|
+
allowWebAuthnLogin = false,
|
|
7045
7240
|
allowWebAuthnSignup = false,
|
|
7046
7241
|
socialProviders,
|
|
7047
7242
|
...props
|
|
@@ -7054,7 +7249,7 @@ const SignupView = ({
|
|
|
7054
7249
|
onPasswordClick: () => goTo("signup-with-password"),
|
|
7055
7250
|
onBiometricClick: () => goTo("signup-with-web-authn")
|
|
7056
7251
|
}
|
|
7057
|
-
) : /* @__PURE__ */ React.createElement(PasswordSignupForm, { ...props }), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement("span", null, i18n("signup.loginLinkPrefix")), "\xA0", /* @__PURE__ */ React.createElement(Link, { target:
|
|
7252
|
+
) : /* @__PURE__ */ React.createElement(PasswordSignupForm, { ...props }), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement("span", null, i18n("signup.loginLinkPrefix")), "\xA0", /* @__PURE__ */ React.createElement(Link, { target: selectLogin(initialScreen, allowWebAuthnLogin) }, i18n("signup.loginLink"))));
|
|
7058
7253
|
};
|
|
7059
7254
|
|
|
7060
7255
|
const SignupWithPasswordView = (props) => {
|
|
@@ -7127,7 +7322,9 @@ const ForgotPasswordView = ({
|
|
|
7127
7322
|
allowLogin = true,
|
|
7128
7323
|
displaySafeErrorMessage = false,
|
|
7129
7324
|
showLabels = false,
|
|
7325
|
+
allowWebAuthnLogin = false,
|
|
7130
7326
|
recaptcha_enabled = false,
|
|
7327
|
+
initialScreen,
|
|
7131
7328
|
recaptcha_site_key,
|
|
7132
7329
|
redirectUrl,
|
|
7133
7330
|
returnToAfterPasswordReset
|
|
@@ -7155,18 +7352,18 @@ const ForgotPasswordView = ({
|
|
|
7155
7352
|
onSuccess: () => goTo("forgot-password-success"),
|
|
7156
7353
|
skipError: displaySafeErrorMessage && skipError
|
|
7157
7354
|
}
|
|
7158
|
-
), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target:
|
|
7355
|
+
), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: selectLogin(initialScreen, allowWebAuthnLogin) }, i18n("forgotPassword.backToLoginLink"))));
|
|
7159
7356
|
};
|
|
7160
|
-
const ForgotPasswordSuccessView = ({ allowLogin }) => {
|
|
7357
|
+
const ForgotPasswordSuccessView = ({ allowLogin, initialScreen, allowWebAuthnLogin }) => {
|
|
7161
7358
|
const i18n = useI18n();
|
|
7162
|
-
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, i18n("forgotPassword.title")), /* @__PURE__ */ React.createElement(Info, null, i18n("forgotPassword.successMessage")), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target:
|
|
7359
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, i18n("forgotPassword.title")), /* @__PURE__ */ React.createElement(Info, null, i18n("forgotPassword.successMessage")), allowLogin && /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: selectLogin(initialScreen, allowWebAuthnLogin) }, i18n("back"))));
|
|
7163
7360
|
};
|
|
7164
7361
|
|
|
7165
|
-
const QuickLoginView = ({ auth, session }) => {
|
|
7362
|
+
const QuickLoginView = ({ initialScreen, allowWebAuthnLogin = false, auth, session }) => {
|
|
7166
7363
|
const i18n = useI18n();
|
|
7167
7364
|
if (!session)
|
|
7168
7365
|
return null;
|
|
7169
|
-
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, session.name || session.email), /* @__PURE__ */ React.createElement(Intro, null, i18n("lastTimeYouLoggedInWith")), /* @__PURE__ */ React.createElement(SocialButtons, { providers: session.lastLoginType ? [session.lastLoginType] : [], auth }), /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target:
|
|
7366
|
+
return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Heading, null, session.name || session.email), /* @__PURE__ */ React.createElement(Intro, null, i18n("lastTimeYouLoggedInWith")), /* @__PURE__ */ React.createElement(SocialButtons, { providers: session.lastLoginType ? [session.lastLoginType] : [], auth }), /* @__PURE__ */ React.createElement(Alternative, null, /* @__PURE__ */ React.createElement(Link, { target: selectLogin(initialScreen, allowWebAuthnLogin) }, i18n("notYourAccount"))));
|
|
7170
7367
|
};
|
|
7171
7368
|
|
|
7172
7369
|
const ReauthView = ({ allowForgotPassword = true, auth, session, showLabels = false, socialProviders }) => {
|
|
@@ -7317,20 +7514,28 @@ var mfaStepUpWidget = createMultiViewWidget({
|
|
|
7317
7514
|
}
|
|
7318
7515
|
});
|
|
7319
7516
|
|
|
7517
|
+
function selectLogin(initialScreen, allowWebAuthnLogin) {
|
|
7518
|
+
if (initialScreen === "login" || initialScreen === "login-with-web-authn")
|
|
7519
|
+
return initialScreen;
|
|
7520
|
+
return !allowWebAuthnLogin ? "login" : "login-with-web-authn";
|
|
7521
|
+
}
|
|
7320
7522
|
var authWidget = createMultiViewWidget({
|
|
7321
7523
|
initialView({
|
|
7322
7524
|
initialScreen,
|
|
7323
7525
|
allowLogin = true,
|
|
7324
7526
|
allowQuickLogin = true,
|
|
7325
7527
|
allowSignup = true,
|
|
7528
|
+
allowWebAuthnLogin,
|
|
7326
7529
|
socialProviders,
|
|
7327
7530
|
session = {}
|
|
7328
7531
|
}) {
|
|
7329
7532
|
const quickLogin = allowQuickLogin && !session.isAuthenticated && session.lastLoginType && socialProviders ? socialProviders.indexOf(session.lastLoginType) >= 0 : false;
|
|
7330
|
-
return initialScreen || quickLogin && "quick-login" || session.isAuthenticated && "reauth" || allowLogin && "login" || allowSignup && "signup" || "forgot-password";
|
|
7533
|
+
return initialScreen || quickLogin && "quick-login" || session.isAuthenticated && "reauth" || allowLogin && !allowWebAuthnLogin && "login" || allowLogin && "login-with-web-authn" || allowSignup && "signup" || "forgot-password";
|
|
7331
7534
|
},
|
|
7332
7535
|
views: {
|
|
7333
7536
|
"login": LoginView,
|
|
7537
|
+
"login-with-web-authn": LoginWithWebAuthnView,
|
|
7538
|
+
"login-with-password": LoginWithPasswordView,
|
|
7334
7539
|
"signup": SignupView,
|
|
7335
7540
|
"signup-with-password": SignupWithPasswordView,
|
|
7336
7541
|
"signup-with-web-authn": SignupWithWebAuthnView,
|