@mcurros2/microm 1.1.288-0 → 1.1.290-0
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.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4016,15 +4016,15 @@ const $a8704b86039e0c33$export$c2c75fd58793f69 = {
|
|
|
4016
4016
|
loginErrorMessage: "Unknown user name or bad password",
|
|
4017
4017
|
confirmRecoveryEmailTitle: "Recovery email",
|
|
4018
4018
|
codeLabel: "Authentication code",
|
|
4019
|
-
codePlaceholder: "
|
|
4019
|
+
codePlaceholder: "1",
|
|
4020
4020
|
verifyCodeButtonLabel: "Verify code",
|
|
4021
4021
|
twoFactorTitle: "Two-factor authentication",
|
|
4022
4022
|
twoFactorDescription: "Enter the 6-digit code from your authenticator app.",
|
|
4023
|
-
|
|
4023
|
+
registerAuthenticatorLabel: "Register authenticator",
|
|
4024
4024
|
cancelTwoFactorButtonLabel: "Back"
|
|
4025
4025
|
};
|
|
4026
4026
|
function $a8704b86039e0c33$export$21a94553ffa41578(props) {
|
|
4027
|
-
const { client: client, onStatusCompleted: onStatusCompleted, userLabel: userLabel, userPlaceholder: userPlaceholder, passwordLabel: passwordLabel, passwordPlaceholder: passwordPlaceholder, rememberLabel: rememberLabel, forgotLabel: forgotLabel, signInButtonLabel: signInButtonLabel, loginErrorMessage: loginErrorMessage, confirmRecoveryEmailTitle: confirmRecoveryEmailTitle, codeLabel: codeLabel, codePlaceholder: codePlaceholder, verifyCodeButtonLabel: verifyCodeButtonLabel, twoFactorTitle: twoFactorTitle, twoFactorDescription: twoFactorDescription,
|
|
4027
|
+
const { client: client, onStatusCompleted: onStatusCompleted, userLabel: userLabel, userPlaceholder: userPlaceholder, passwordLabel: passwordLabel, passwordPlaceholder: passwordPlaceholder, rememberLabel: rememberLabel, forgotLabel: forgotLabel, signInButtonLabel: signInButtonLabel, loginErrorMessage: loginErrorMessage, confirmRecoveryEmailTitle: confirmRecoveryEmailTitle, codeLabel: codeLabel, codePlaceholder: codePlaceholder, verifyCodeButtonLabel: verifyCodeButtonLabel, twoFactorTitle: twoFactorTitle, twoFactorDescription: twoFactorDescription, registerAuthenticatorLabel: registerAuthenticatorLabel, cancelTwoFactorButtonLabel: cancelTwoFactorButtonLabel } = (0, $b4te3$mantinecore.useComponentDefaultProps)('Login', $a8704b86039e0c33$export$c2c75fd58793f69, props);
|
|
4028
4028
|
const modal = (0, $k7qj2.useModal)();
|
|
4029
4029
|
const form = (0, $b4te3$mantineform.useForm)({
|
|
4030
4030
|
initialValues: {
|
|
@@ -4037,6 +4037,8 @@ function $a8704b86039e0c33$export$21a94553ffa41578(props) {
|
|
|
4037
4037
|
});
|
|
4038
4038
|
const [status, setStatus] = (0, $b4te3$react.useState)();
|
|
4039
4039
|
const [twoFactorState, setTwoFactorState] = (0, $b4te3$react.useState)();
|
|
4040
|
+
const [totpRegistration, setTotpRegistration] = (0, $b4te3$react.useState)();
|
|
4041
|
+
const [totpRegistrationStatus, setTotpRegistrationStatus] = (0, $b4te3$react.useState)();
|
|
4040
4042
|
const handleClick = (0, $b4te3$react.useCallback)(async (values)=>{
|
|
4041
4043
|
setStatus({
|
|
4042
4044
|
loading: true
|
|
@@ -4045,6 +4047,8 @@ function $a8704b86039e0c33$export$21a94553ffa41578(props) {
|
|
|
4045
4047
|
const data = await client.login(values.user, values.password, values.rememberme);
|
|
4046
4048
|
if ('requires_two_factor' in data && data.requires_two_factor) {
|
|
4047
4049
|
setTwoFactorState(data);
|
|
4050
|
+
setTotpRegistration(undefined);
|
|
4051
|
+
setTotpRegistrationStatus(undefined);
|
|
4048
4052
|
setStatus(undefined);
|
|
4049
4053
|
return;
|
|
4050
4054
|
}
|
|
@@ -4088,6 +4092,26 @@ function $a8704b86039e0c33$export$21a94553ffa41578(props) {
|
|
|
4088
4092
|
onStatusCompleted,
|
|
4089
4093
|
twoFactorState
|
|
4090
4094
|
]);
|
|
4095
|
+
const handleRegisterAuthenticatorClick = (0, $b4te3$react.useCallback)(async ()=>{
|
|
4096
|
+
if (!twoFactorState?.two_factor_challenge_id) return;
|
|
4097
|
+
setTotpRegistrationStatus({
|
|
4098
|
+
loading: true
|
|
4099
|
+
});
|
|
4100
|
+
try {
|
|
4101
|
+
const data = await client.registerLoginTotp(twoFactorState.two_factor_challenge_id);
|
|
4102
|
+
setTotpRegistration(data);
|
|
4103
|
+
setTotpRegistrationStatus({
|
|
4104
|
+
data: data
|
|
4105
|
+
});
|
|
4106
|
+
} catch (e) {
|
|
4107
|
+
setTotpRegistrationStatus({
|
|
4108
|
+
error: (0, $98ddT.toMicroMError)(e)
|
|
4109
|
+
});
|
|
4110
|
+
}
|
|
4111
|
+
}, [
|
|
4112
|
+
client,
|
|
4113
|
+
twoFactorState
|
|
4114
|
+
]);
|
|
4091
4115
|
const handleForgotPasswordClick = (0, $b4te3$react.useCallback)(async ()=>{
|
|
4092
4116
|
await modal.open({
|
|
4093
4117
|
modalProps: {
|
|
@@ -4115,6 +4139,8 @@ function $a8704b86039e0c33$export$21a94553ffa41578(props) {
|
|
|
4115
4139
|
]);
|
|
4116
4140
|
const handleCancelTwoFactorClick = (0, $b4te3$react.useCallback)(()=>{
|
|
4117
4141
|
setTwoFactorState(undefined);
|
|
4142
|
+
setTotpRegistration(undefined);
|
|
4143
|
+
setTotpRegistrationStatus(undefined);
|
|
4118
4144
|
setStatus(undefined);
|
|
4119
4145
|
form.setFieldValue('code', '');
|
|
4120
4146
|
}, [
|
|
@@ -4136,24 +4162,9 @@ function $a8704b86039e0c33$export$21a94553ffa41578(props) {
|
|
|
4136
4162
|
onSubmit: form.onSubmit((values)=>handleClick(values)),
|
|
4137
4163
|
children: [
|
|
4138
4164
|
status?.loading && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $lFsp3.FakeProgressBar), {}),
|
|
4139
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.TextInput), {
|
|
4140
|
-
label: userLabel,
|
|
4141
|
-
placeholder: userPlaceholder,
|
|
4142
|
-
required: true,
|
|
4143
|
-
"data-autofocus": true,
|
|
4144
|
-
disabled: status?.loading || !!twoFactorState,
|
|
4145
|
-
...form.getInputProps('user')
|
|
4146
|
-
}),
|
|
4147
|
-
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.PasswordInput), {
|
|
4148
|
-
label: passwordLabel,
|
|
4149
|
-
placeholder: passwordPlaceholder,
|
|
4150
|
-
required: true,
|
|
4151
|
-
mt: "md",
|
|
4152
|
-
disabled: status?.loading || !!twoFactorState,
|
|
4153
|
-
...form.getInputProps('password')
|
|
4154
|
-
}),
|
|
4155
4165
|
twoFactorState ? /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Stack), {
|
|
4156
4166
|
mt: "md",
|
|
4167
|
+
align: "center",
|
|
4157
4168
|
children: [
|
|
4158
4169
|
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Stack), {
|
|
4159
4170
|
spacing: 2,
|
|
@@ -4166,26 +4177,25 @@ function $a8704b86039e0c33$export$21a94553ffa41578(props) {
|
|
|
4166
4177
|
size: "sm",
|
|
4167
4178
|
color: "dimmed",
|
|
4168
4179
|
children: twoFactorDescription
|
|
4169
|
-
}),
|
|
4170
|
-
twoFactorState.two_factor_provider && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Text), {
|
|
4171
|
-
size: "xs",
|
|
4172
|
-
color: "dimmed",
|
|
4173
|
-
children: [
|
|
4174
|
-
twoFactorProviderLabel,
|
|
4175
|
-
": ",
|
|
4176
|
-
twoFactorState.two_factor_provider
|
|
4177
|
-
]
|
|
4178
4180
|
})
|
|
4179
4181
|
]
|
|
4180
4182
|
}),
|
|
4181
|
-
|
|
4182
|
-
src: twoFactorState.qr_code_data_url,
|
|
4183
|
+
(totpRegistration?.qr_code_data_url || twoFactorState.qr_code_data_url) && /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Image), {
|
|
4184
|
+
src: totpRegistration?.qr_code_data_url ?? twoFactorState.qr_code_data_url,
|
|
4183
4185
|
alt: twoFactorTitle,
|
|
4184
4186
|
width: 180,
|
|
4185
4187
|
height: 180,
|
|
4186
4188
|
fit: "contain",
|
|
4187
4189
|
mx: "auto"
|
|
4188
4190
|
}),
|
|
4191
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Anchor), {
|
|
4192
|
+
component: "button",
|
|
4193
|
+
type: "button",
|
|
4194
|
+
size: "sm",
|
|
4195
|
+
disabled: status?.loading || totpRegistrationStatus?.loading,
|
|
4196
|
+
onClick: ()=>void handleRegisterAuthenticatorClick(),
|
|
4197
|
+
children: registerAuthenticatorLabel
|
|
4198
|
+
}),
|
|
4189
4199
|
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.PinInput), {
|
|
4190
4200
|
length: 6,
|
|
4191
4201
|
oneTimeCode: true,
|
|
@@ -4213,6 +4223,22 @@ function $a8704b86039e0c33$export$21a94553ffa41578(props) {
|
|
|
4213
4223
|
]
|
|
4214
4224
|
}) : /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$reactjsxruntime.Fragment), {
|
|
4215
4225
|
children: [
|
|
4226
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.TextInput), {
|
|
4227
|
+
label: userLabel,
|
|
4228
|
+
placeholder: userPlaceholder,
|
|
4229
|
+
required: true,
|
|
4230
|
+
"data-autofocus": true,
|
|
4231
|
+
disabled: status?.loading || !!twoFactorState,
|
|
4232
|
+
...form.getInputProps('user')
|
|
4233
|
+
}),
|
|
4234
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.PasswordInput), {
|
|
4235
|
+
label: passwordLabel,
|
|
4236
|
+
placeholder: passwordPlaceholder,
|
|
4237
|
+
required: true,
|
|
4238
|
+
mt: "md",
|
|
4239
|
+
disabled: status?.loading || !!twoFactorState,
|
|
4240
|
+
...form.getInputProps('password')
|
|
4241
|
+
}),
|
|
4216
4242
|
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Group), {
|
|
4217
4243
|
position: "apart",
|
|
4218
4244
|
mt: "lg",
|
|
@@ -4246,6 +4272,11 @@ function $a8704b86039e0c33$export$21a94553ffa41578(props) {
|
|
|
4246
4272
|
mt: "xs",
|
|
4247
4273
|
hidden: status?.error === undefined,
|
|
4248
4274
|
children: status?.error !== undefined && status.error.name === 'validation' ? status.error.message : loginErrorMessage
|
|
4275
|
+
}),
|
|
4276
|
+
/*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $d50o9.AlertError), {
|
|
4277
|
+
mt: "xs",
|
|
4278
|
+
hidden: totpRegistrationStatus?.error === undefined,
|
|
4279
|
+
children: totpRegistrationStatus?.error?.errorBody || totpRegistrationStatus?.error?.message || loginErrorMessage
|
|
4249
4280
|
})
|
|
4250
4281
|
]
|
|
4251
4282
|
});
|