@yhgale/ui 0.1.5 → 0.1.6
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.js +246 -54
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -5114,7 +5114,7 @@ function ForgotPassword({
|
|
|
5114
5114
|
}) {
|
|
5115
5115
|
const { t: t2 } = useLocalization7();
|
|
5116
5116
|
const { passwordPolicy } = useEnvironment3();
|
|
5117
|
-
const { status, sendResetCode, resetPassword } = useForgotPassword();
|
|
5117
|
+
const { status, sendResetCode, resetPassword: resetPassword2 } = useForgotPassword();
|
|
5118
5118
|
const emailId = useId();
|
|
5119
5119
|
const codeId = useId();
|
|
5120
5120
|
const passwordId = useId();
|
|
@@ -5242,7 +5242,7 @@ function ForgotPassword({
|
|
|
5242
5242
|
loadingText: t2("forgotPassword.resetting"),
|
|
5243
5243
|
type: "button",
|
|
5244
5244
|
onClick: async () => {
|
|
5245
|
-
await
|
|
5245
|
+
await resetPassword2({ emailAddress, code, password: newPassword });
|
|
5246
5246
|
},
|
|
5247
5247
|
children: t2("forgotPassword.resetButton")
|
|
5248
5248
|
}
|
|
@@ -5790,13 +5790,16 @@ function SignOutButton({ afterSignOutUrl = "/", children }) {
|
|
|
5790
5790
|
|
|
5791
5791
|
// src/components/UserProfile.tsx
|
|
5792
5792
|
import { useState as useState8, useEffect as useEffect7 } from "react";
|
|
5793
|
+
import QRCode from "qrcode";
|
|
5793
5794
|
import {
|
|
5794
5795
|
confirmTotp,
|
|
5795
5796
|
disableTotp,
|
|
5796
5797
|
enrollTotp,
|
|
5798
|
+
forgotPassword,
|
|
5797
5799
|
generateBackupCodes,
|
|
5798
5800
|
getMe,
|
|
5799
|
-
getMfaStatus
|
|
5801
|
+
getMfaStatus,
|
|
5802
|
+
resetPassword
|
|
5800
5803
|
} from "@yhgale/gale-js";
|
|
5801
5804
|
import {
|
|
5802
5805
|
useUser as useUser4,
|
|
@@ -5847,7 +5850,7 @@ function AccountTab({
|
|
|
5847
5850
|
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
5848
5851
|
/* @__PURE__ */ jsx10(Section, { title: t2("userProfile.sectionProfile"), children: /* @__PURE__ */ jsx10(ProfileForm, { user }) }),
|
|
5849
5852
|
/* @__PURE__ */ jsx10(Section, { title: t2("userProfile.sectionEmailAddresses"), children: /* @__PURE__ */ jsx10(EmailAddressesSection, {}) }),
|
|
5850
|
-
/* @__PURE__ */ jsx10(Section, { title: t2("userProfile.sectionPassword"), children: /* @__PURE__ */ jsx10(PasswordForm, {}) }),
|
|
5853
|
+
/* @__PURE__ */ jsx10(Section, { title: t2("userProfile.sectionPassword"), children: /* @__PURE__ */ jsx10(PasswordForm, { primaryEmail: user.primaryEmail }) }),
|
|
5851
5854
|
/* @__PURE__ */ jsx10(Section, { title: t2("userProfile.sectionConnectedAccounts"), children: /* @__PURE__ */ jsx10(ConnectedAccountsSection, { identities }) })
|
|
5852
5855
|
] });
|
|
5853
5856
|
}
|
|
@@ -5956,27 +5959,40 @@ var ProfileForm = ({ user }) => {
|
|
|
5956
5959
|
] })
|
|
5957
5960
|
] });
|
|
5958
5961
|
};
|
|
5959
|
-
var PasswordForm = () => {
|
|
5962
|
+
var PasswordForm = ({ primaryEmail }) => {
|
|
5960
5963
|
const { t: t2 } = useLocalization12();
|
|
5961
5964
|
const { client } = useGaleContext();
|
|
5962
5965
|
const { passwordPolicy } = useEnvironment4();
|
|
5963
5966
|
const [current, setCurrent] = useState8("");
|
|
5964
5967
|
const [newPw, setNewPw] = useState8("");
|
|
5965
5968
|
const [confirm2, setConfirm] = useState8("");
|
|
5969
|
+
const [resetMode, setResetMode] = useState8(false);
|
|
5970
|
+
const [resetCodeSent, setResetCodeSent] = useState8(false);
|
|
5971
|
+
const [resetCode, setResetCode] = useState8("");
|
|
5966
5972
|
const [msg, setMsg] = useState8("");
|
|
5967
5973
|
const [msgOk, setMsgOk] = useState8(false);
|
|
5968
5974
|
const [saving, setSaving] = useState8(false);
|
|
5969
|
-
const
|
|
5975
|
+
const clearFields = () => {
|
|
5976
|
+
setCurrent("");
|
|
5977
|
+
setNewPw("");
|
|
5978
|
+
setConfirm("");
|
|
5979
|
+
setResetCode("");
|
|
5980
|
+
};
|
|
5981
|
+
const validatePassword = () => {
|
|
5970
5982
|
if (newPw !== confirm2) {
|
|
5971
5983
|
setMsg(t2("userProfile.passwordMismatch"));
|
|
5972
5984
|
setMsgOk(false);
|
|
5973
|
-
return;
|
|
5985
|
+
return false;
|
|
5974
5986
|
}
|
|
5975
5987
|
if (newPw.length < passwordPolicy.minLength) {
|
|
5976
5988
|
setMsg(t2("userProfile.passwordMinLength", { minLength: String(passwordPolicy.minLength) }));
|
|
5977
5989
|
setMsgOk(false);
|
|
5978
|
-
return;
|
|
5990
|
+
return false;
|
|
5979
5991
|
}
|
|
5992
|
+
return true;
|
|
5993
|
+
};
|
|
5994
|
+
const save = async () => {
|
|
5995
|
+
if (!validatePassword()) return;
|
|
5980
5996
|
setSaving(true);
|
|
5981
5997
|
setMsg("");
|
|
5982
5998
|
setMsgOk(false);
|
|
@@ -5985,9 +6001,65 @@ var PasswordForm = () => {
|
|
|
5985
6001
|
method: "POST",
|
|
5986
6002
|
json: { currentPassword: current, newPassword: newPw }
|
|
5987
6003
|
});
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
6004
|
+
clearFields();
|
|
6005
|
+
setMsg(t2("userProfile.passwordChanged"));
|
|
6006
|
+
setMsgOk(true);
|
|
6007
|
+
} catch (e) {
|
|
6008
|
+
setMsg(e instanceof Error ? e.message : "Error");
|
|
6009
|
+
setMsgOk(false);
|
|
6010
|
+
} finally {
|
|
6011
|
+
setSaving(false);
|
|
6012
|
+
}
|
|
6013
|
+
};
|
|
6014
|
+
const startReset = () => {
|
|
6015
|
+
clearFields();
|
|
6016
|
+
setResetMode(true);
|
|
6017
|
+
setResetCodeSent(false);
|
|
6018
|
+
setMsg("");
|
|
6019
|
+
setMsgOk(false);
|
|
6020
|
+
};
|
|
6021
|
+
const cancelReset = () => {
|
|
6022
|
+
clearFields();
|
|
6023
|
+
setResetMode(false);
|
|
6024
|
+
setResetCodeSent(false);
|
|
6025
|
+
setMsg("");
|
|
6026
|
+
setMsgOk(false);
|
|
6027
|
+
};
|
|
6028
|
+
const sendResetCode = async () => {
|
|
6029
|
+
if (!primaryEmail) {
|
|
6030
|
+
setMsg(t2("userProfile.emailEmpty"));
|
|
6031
|
+
setMsgOk(false);
|
|
6032
|
+
return;
|
|
6033
|
+
}
|
|
6034
|
+
setSaving(true);
|
|
6035
|
+
setMsg("");
|
|
6036
|
+
setMsgOk(false);
|
|
6037
|
+
try {
|
|
6038
|
+
await forgotPassword(client, { email_address: primaryEmail });
|
|
6039
|
+
setResetCodeSent(true);
|
|
6040
|
+
setMsg(t2("userProfile.emailCodeSent"));
|
|
6041
|
+
setMsgOk(true);
|
|
6042
|
+
} catch (e) {
|
|
6043
|
+
setMsg(e instanceof Error ? e.message : "Error");
|
|
6044
|
+
setMsgOk(false);
|
|
6045
|
+
} finally {
|
|
6046
|
+
setSaving(false);
|
|
6047
|
+
}
|
|
6048
|
+
};
|
|
6049
|
+
const reset = async () => {
|
|
6050
|
+
if (!primaryEmail || !validatePassword()) return;
|
|
6051
|
+
setSaving(true);
|
|
6052
|
+
setMsg("");
|
|
6053
|
+
setMsgOk(false);
|
|
6054
|
+
try {
|
|
6055
|
+
await resetPassword(client, {
|
|
6056
|
+
email_address: primaryEmail,
|
|
6057
|
+
code: resetCode,
|
|
6058
|
+
password: newPw
|
|
6059
|
+
});
|
|
6060
|
+
clearFields();
|
|
6061
|
+
setResetMode(false);
|
|
6062
|
+
setResetCodeSent(false);
|
|
5991
6063
|
setMsg(t2("userProfile.passwordChanged"));
|
|
5992
6064
|
setMsgOk(true);
|
|
5993
6065
|
} catch (e) {
|
|
@@ -5998,48 +6070,121 @@ var PasswordForm = () => {
|
|
|
5998
6070
|
}
|
|
5999
6071
|
};
|
|
6000
6072
|
return /* @__PURE__ */ jsxs6("div", { className: "space-y-3", children: [
|
|
6001
|
-
/* @__PURE__ */
|
|
6073
|
+
resetMode && /* @__PURE__ */ jsxs6("div", { className: "rounded-md bg-[var(--color-bg-muted)] px-3 py-2 text-xs text-[var(--color-fg-muted)]", children: [
|
|
6074
|
+
/* @__PURE__ */ jsx10("p", { children: t2("forgotPassword.instructions") }),
|
|
6075
|
+
/* @__PURE__ */ jsx10("p", { className: "mt-1 break-all font-medium text-[var(--color-fg)]", children: primaryEmail })
|
|
6076
|
+
] }),
|
|
6077
|
+
!resetMode && /* @__PURE__ */ jsx10(Field, { label: t2("userProfile.fieldCurrentPassword"), children: /* @__PURE__ */ jsx10(
|
|
6002
6078
|
"input",
|
|
6003
6079
|
{
|
|
6004
6080
|
type: "password",
|
|
6081
|
+
autoComplete: "current-password",
|
|
6005
6082
|
value: current,
|
|
6006
6083
|
onChange: (e) => setCurrent(e.target.value),
|
|
6007
6084
|
className: inputCls
|
|
6008
6085
|
}
|
|
6009
6086
|
) }),
|
|
6010
|
-
/* @__PURE__ */ jsx10(Field, { label: t2("
|
|
6087
|
+
resetMode && resetCodeSent && /* @__PURE__ */ jsx10(Field, { label: t2("forgotPassword.codeLabel"), children: /* @__PURE__ */ jsx10(
|
|
6011
6088
|
"input",
|
|
6012
6089
|
{
|
|
6013
|
-
type: "
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
) }),
|
|
6021
|
-
/* @__PURE__ */ jsx10(Field, { label: t2("userProfile.fieldConfirmPassword"), children: /* @__PURE__ */ jsx10(
|
|
6022
|
-
"input",
|
|
6023
|
-
{
|
|
6024
|
-
type: "password",
|
|
6025
|
-
value: confirm2,
|
|
6026
|
-
onChange: (e) => setConfirm(e.target.value),
|
|
6090
|
+
type: "text",
|
|
6091
|
+
inputMode: "numeric",
|
|
6092
|
+
autoComplete: "one-time-code",
|
|
6093
|
+
value: resetCode,
|
|
6094
|
+
onChange: (e) => setResetCode(e.target.value.replace(/\D/g, "").slice(0, 6)),
|
|
6095
|
+
placeholder: "000000",
|
|
6096
|
+
maxLength: 6,
|
|
6027
6097
|
className: inputCls
|
|
6028
6098
|
}
|
|
6029
6099
|
) }),
|
|
6030
|
-
/* @__PURE__ */ jsxs6(
|
|
6031
|
-
/* @__PURE__ */ jsx10(
|
|
6100
|
+
(!resetMode || resetCodeSent) && /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
6101
|
+
/* @__PURE__ */ jsx10(Field, { label: t2("userProfile.fieldNewPassword"), children: /* @__PURE__ */ jsx10(
|
|
6102
|
+
"input",
|
|
6103
|
+
{
|
|
6104
|
+
type: "password",
|
|
6105
|
+
autoComplete: "new-password",
|
|
6106
|
+
value: newPw,
|
|
6107
|
+
onChange: (e) => setNewPw(e.target.value),
|
|
6108
|
+
placeholder: t2("userProfile.placeholderNewPassword"),
|
|
6109
|
+
minLength: passwordPolicy.minLength,
|
|
6110
|
+
className: inputCls
|
|
6111
|
+
}
|
|
6112
|
+
) }),
|
|
6113
|
+
/* @__PURE__ */ jsx10(Field, { label: t2("userProfile.fieldConfirmPassword"), children: /* @__PURE__ */ jsx10(
|
|
6114
|
+
"input",
|
|
6115
|
+
{
|
|
6116
|
+
type: "password",
|
|
6117
|
+
autoComplete: "new-password",
|
|
6118
|
+
value: confirm2,
|
|
6119
|
+
onChange: (e) => setConfirm(e.target.value),
|
|
6120
|
+
className: inputCls
|
|
6121
|
+
}
|
|
6122
|
+
) })
|
|
6123
|
+
] }),
|
|
6124
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
6125
|
+
!resetMode ? /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
6126
|
+
/* @__PURE__ */ jsx10(
|
|
6127
|
+
"button",
|
|
6128
|
+
{
|
|
6129
|
+
type: "button",
|
|
6130
|
+
onClick: save,
|
|
6131
|
+
disabled: saving || !current || !newPw || !confirm2,
|
|
6132
|
+
className: "rounded-md bg-[var(--color-accent)] px-3 py-1.5 text-xs font-medium text-white hover:bg-[var(--color-accent-hover)] disabled:opacity-50",
|
|
6133
|
+
children: saving ? t2("userProfile.buttonChanging") : t2("userProfile.buttonChangePassword")
|
|
6134
|
+
}
|
|
6135
|
+
),
|
|
6136
|
+
primaryEmail && /* @__PURE__ */ jsx10(
|
|
6137
|
+
"button",
|
|
6138
|
+
{
|
|
6139
|
+
type: "button",
|
|
6140
|
+
onClick: startReset,
|
|
6141
|
+
className: "text-xs text-[var(--color-link)] hover:underline",
|
|
6142
|
+
children: t2("signIn.forgotPassword")
|
|
6143
|
+
}
|
|
6144
|
+
)
|
|
6145
|
+
] }) : !resetCodeSent ? /* @__PURE__ */ jsx10(
|
|
6032
6146
|
"button",
|
|
6033
6147
|
{
|
|
6034
6148
|
type: "button",
|
|
6035
|
-
onClick:
|
|
6036
|
-
disabled: saving
|
|
6149
|
+
onClick: sendResetCode,
|
|
6150
|
+
disabled: saving,
|
|
6037
6151
|
className: "rounded-md bg-[var(--color-accent)] px-3 py-1.5 text-xs font-medium text-white hover:bg-[var(--color-accent-hover)] disabled:opacity-50",
|
|
6038
|
-
children: saving ? t2("
|
|
6152
|
+
children: saving ? t2("forgotPassword.sending") : t2("forgotPassword.sendButton")
|
|
6039
6153
|
}
|
|
6040
|
-
),
|
|
6041
|
-
|
|
6042
|
-
|
|
6154
|
+
) : /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
6155
|
+
/* @__PURE__ */ jsx10(
|
|
6156
|
+
"button",
|
|
6157
|
+
{
|
|
6158
|
+
type: "button",
|
|
6159
|
+
onClick: reset,
|
|
6160
|
+
disabled: saving || resetCode.length !== 6 || !newPw || !confirm2,
|
|
6161
|
+
className: "rounded-md bg-[var(--color-accent)] px-3 py-1.5 text-xs font-medium text-white hover:bg-[var(--color-accent-hover)] disabled:opacity-50",
|
|
6162
|
+
children: saving ? t2("forgotPassword.resetting") : t2("forgotPassword.resetButton")
|
|
6163
|
+
}
|
|
6164
|
+
),
|
|
6165
|
+
/* @__PURE__ */ jsx10(
|
|
6166
|
+
"button",
|
|
6167
|
+
{
|
|
6168
|
+
type: "button",
|
|
6169
|
+
onClick: sendResetCode,
|
|
6170
|
+
disabled: saving,
|
|
6171
|
+
className: "text-xs text-[var(--color-link)] hover:underline disabled:opacity-50",
|
|
6172
|
+
children: t2("forgotPassword.resendCode")
|
|
6173
|
+
}
|
|
6174
|
+
)
|
|
6175
|
+
] }),
|
|
6176
|
+
resetMode && /* @__PURE__ */ jsx10(
|
|
6177
|
+
"button",
|
|
6178
|
+
{
|
|
6179
|
+
type: "button",
|
|
6180
|
+
onClick: cancelReset,
|
|
6181
|
+
disabled: saving,
|
|
6182
|
+
className: "text-xs text-[var(--color-fg-muted)] hover:underline disabled:opacity-50",
|
|
6183
|
+
children: t2("common.cancel")
|
|
6184
|
+
}
|
|
6185
|
+
)
|
|
6186
|
+
] }),
|
|
6187
|
+
msg && /* @__PURE__ */ jsx10("p", { className: `text-xs ${msgOk ? "text-emerald-600" : "text-red-600"}`, children: msg })
|
|
6043
6188
|
] });
|
|
6044
6189
|
};
|
|
6045
6190
|
var MfaSection = () => {
|
|
@@ -6050,6 +6195,7 @@ var MfaSection = () => {
|
|
|
6050
6195
|
const [totpStep, setTotpStep] = useState8("");
|
|
6051
6196
|
const [secret, setSecret] = useState8("");
|
|
6052
6197
|
const [uri, setUri] = useState8("");
|
|
6198
|
+
const [qrDataUrl, setQrDataUrl] = useState8("");
|
|
6053
6199
|
const [code, setCode] = useState8("");
|
|
6054
6200
|
const [msg, setMsg] = useState8("");
|
|
6055
6201
|
const [backupCodes, setBackupCodes] = useState8(null);
|
|
@@ -6066,8 +6212,25 @@ var MfaSection = () => {
|
|
|
6066
6212
|
useEffect7(() => {
|
|
6067
6213
|
fetchStatus();
|
|
6068
6214
|
}, []);
|
|
6215
|
+
useEffect7(() => {
|
|
6216
|
+
if (!uri) {
|
|
6217
|
+
setQrDataUrl("");
|
|
6218
|
+
return;
|
|
6219
|
+
}
|
|
6220
|
+
let cancelled = false;
|
|
6221
|
+
QRCode.toDataURL(uri, { width: 192, margin: 1 }).then((dataUrl) => {
|
|
6222
|
+
if (!cancelled) setQrDataUrl(dataUrl);
|
|
6223
|
+
}).catch((e) => {
|
|
6224
|
+
if (!cancelled) setMsg(e instanceof Error ? e.message : "Error");
|
|
6225
|
+
});
|
|
6226
|
+
return () => {
|
|
6227
|
+
cancelled = true;
|
|
6228
|
+
};
|
|
6229
|
+
}, [uri]);
|
|
6069
6230
|
const enroll = async () => {
|
|
6070
6231
|
setMsg("");
|
|
6232
|
+
setCode("");
|
|
6233
|
+
setQrDataUrl("");
|
|
6071
6234
|
try {
|
|
6072
6235
|
const r = await enrollTotp(client);
|
|
6073
6236
|
setSecret(r.secretBase32);
|
|
@@ -6078,10 +6241,16 @@ var MfaSection = () => {
|
|
|
6078
6241
|
}
|
|
6079
6242
|
};
|
|
6080
6243
|
const confirm2 = async () => {
|
|
6244
|
+
if (!/^\d{6}$/.test(code)) {
|
|
6245
|
+
setMsg(t2("userProfile.totpInvalidCode"));
|
|
6246
|
+
return;
|
|
6247
|
+
}
|
|
6081
6248
|
setMsg("");
|
|
6082
6249
|
try {
|
|
6083
6250
|
await confirmTotp(client, { code });
|
|
6084
6251
|
setTotpStep("");
|
|
6252
|
+
setUri("");
|
|
6253
|
+
setSecret("");
|
|
6085
6254
|
setCode("");
|
|
6086
6255
|
await fetchStatus();
|
|
6087
6256
|
setMsg(t2("userProfile.totpEnabledMsg"));
|
|
@@ -6089,6 +6258,13 @@ var MfaSection = () => {
|
|
|
6089
6258
|
setMsg(e instanceof Error ? e.message : t2("userProfile.totpInvalidCode"));
|
|
6090
6259
|
}
|
|
6091
6260
|
};
|
|
6261
|
+
const cancelEnroll = () => {
|
|
6262
|
+
setTotpStep("");
|
|
6263
|
+
setUri("");
|
|
6264
|
+
setSecret("");
|
|
6265
|
+
setCode("");
|
|
6266
|
+
setMsg("");
|
|
6267
|
+
};
|
|
6092
6268
|
const disable = async () => {
|
|
6093
6269
|
setMsg("");
|
|
6094
6270
|
try {
|
|
@@ -6118,15 +6294,42 @@ var MfaSection = () => {
|
|
|
6118
6294
|
/* @__PURE__ */ jsx10("p", { className: "text-sm font-medium text-[var(--color-fg)]", children: t2("userProfile.totpTitle") }),
|
|
6119
6295
|
/* @__PURE__ */ jsx10("p", { className: "text-xs text-[var(--color-fg-muted)]", children: totp?.enrolled ? t2("userProfile.totpEnabled") : t2("userProfile.totpNotSetUp") })
|
|
6120
6296
|
] }),
|
|
6121
|
-
totp?.enrolled ? /* @__PURE__ */ jsx10("button", { type: "button", onClick: disable, className: "text-xs text-red-600 hover:underline", children: t2("common.remove") }) : totpStep
|
|
6297
|
+
totp?.enrolled ? /* @__PURE__ */ jsx10("button", { type: "button", onClick: disable, className: "text-xs text-red-600 hover:underline", children: t2("common.remove") }) : totpStep !== "confirm" ? /* @__PURE__ */ jsx10(
|
|
6298
|
+
"button",
|
|
6299
|
+
{
|
|
6300
|
+
type: "button",
|
|
6301
|
+
onClick: enroll,
|
|
6302
|
+
className: "text-xs text-[var(--color-accent)] hover:underline",
|
|
6303
|
+
children: t2("common.add")
|
|
6304
|
+
}
|
|
6305
|
+
) : null
|
|
6306
|
+
] }),
|
|
6307
|
+
totpStep === "confirm" && uri && /* @__PURE__ */ jsxs6("div", { className: "space-y-4 rounded border border-[var(--color-border)] bg-[var(--color-bg-muted)] p-4", children: [
|
|
6308
|
+
/* @__PURE__ */ jsx10("p", { className: "text-xs text-[var(--color-fg-muted)]", children: t2("userProfile.totpQrHint") }),
|
|
6309
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
6310
|
+
qrDataUrl ? /* @__PURE__ */ jsx10(
|
|
6311
|
+
"img",
|
|
6312
|
+
{
|
|
6313
|
+
src: qrDataUrl,
|
|
6314
|
+
alt: t2("userProfile.totpTitle"),
|
|
6315
|
+
width: 192,
|
|
6316
|
+
height: 192,
|
|
6317
|
+
className: "h-48 w-48 shrink-0 rounded bg-white p-2"
|
|
6318
|
+
}
|
|
6319
|
+
) : /* @__PURE__ */ jsx10("div", { className: "flex h-48 w-48 items-center justify-center bg-white text-xs text-[var(--color-fg-muted)]", children: t2("common.loading") }),
|
|
6320
|
+
/* @__PURE__ */ jsx10("p", { className: "min-w-0 flex-1 break-all font-mono text-sm text-[var(--color-fg)]", children: secret })
|
|
6321
|
+
] }),
|
|
6322
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
6122
6323
|
/* @__PURE__ */ jsx10(
|
|
6123
6324
|
"input",
|
|
6124
6325
|
{
|
|
6125
6326
|
value: code,
|
|
6126
|
-
onChange: (e) => setCode(e.target.value),
|
|
6327
|
+
onChange: (e) => setCode(e.target.value.replace(/\D/g, "").slice(0, 6)),
|
|
6127
6328
|
placeholder: "000000",
|
|
6329
|
+
inputMode: "numeric",
|
|
6330
|
+
autoComplete: "one-time-code",
|
|
6128
6331
|
maxLength: 6,
|
|
6129
|
-
className: `${inputCls} w-
|
|
6332
|
+
className: `${inputCls} w-24 text-center`
|
|
6130
6333
|
}
|
|
6131
6334
|
),
|
|
6132
6335
|
/* @__PURE__ */ jsx10(
|
|
@@ -6134,7 +6337,8 @@ var MfaSection = () => {
|
|
|
6134
6337
|
{
|
|
6135
6338
|
type: "button",
|
|
6136
6339
|
onClick: confirm2,
|
|
6137
|
-
|
|
6340
|
+
disabled: code.length !== 6,
|
|
6341
|
+
className: "rounded-md bg-[var(--color-accent)] px-3 py-1.5 text-xs font-medium text-white hover:bg-[var(--color-accent-hover)] disabled:opacity-50",
|
|
6138
6342
|
children: t2("common.verify")
|
|
6139
6343
|
}
|
|
6140
6344
|
),
|
|
@@ -6142,24 +6346,12 @@ var MfaSection = () => {
|
|
|
6142
6346
|
"button",
|
|
6143
6347
|
{
|
|
6144
6348
|
type: "button",
|
|
6145
|
-
onClick:
|
|
6146
|
-
className: "text-xs text-[var(--color-fg-muted)]",
|
|
6349
|
+
onClick: cancelEnroll,
|
|
6350
|
+
className: "text-xs text-[var(--color-fg-muted)] hover:underline",
|
|
6147
6351
|
children: t2("common.cancel")
|
|
6148
6352
|
}
|
|
6149
6353
|
)
|
|
6150
|
-
] })
|
|
6151
|
-
"button",
|
|
6152
|
-
{
|
|
6153
|
-
type: "button",
|
|
6154
|
-
onClick: enroll,
|
|
6155
|
-
className: "text-xs text-[var(--color-accent)] hover:underline",
|
|
6156
|
-
children: t2("common.add")
|
|
6157
|
-
}
|
|
6158
|
-
)
|
|
6159
|
-
] }),
|
|
6160
|
-
totpStep === "confirm" && uri && /* @__PURE__ */ jsxs6("div", { className: "rounded border border-[var(--color-border)] bg-[var(--color-bg-muted)] p-3", children: [
|
|
6161
|
-
/* @__PURE__ */ jsx10("p", { className: "text-xs text-[var(--color-fg-muted)] mb-2", children: t2("userProfile.totpQrHint") }),
|
|
6162
|
-
/* @__PURE__ */ jsx10("p", { className: "font-mono text-xs break-all text-[var(--color-fg)]", children: secret })
|
|
6354
|
+
] })
|
|
6163
6355
|
] }),
|
|
6164
6356
|
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between border-t border-[var(--color-border)] pt-3", children: [
|
|
6165
6357
|
/* @__PURE__ */ jsxs6("div", { children: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yhgale/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Headless UI components for gale (SignIn, UserButton, OrganizationSwitcher)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@emotion/cache": "^11.14.0",
|
|
26
26
|
"@emotion/react": "^11.14.0",
|
|
27
|
-
"
|
|
27
|
+
"qrcode": "^1.5.4",
|
|
28
|
+
"@yhgale/gale-js": "^0.1.10"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@types/node": "^22.10.2",
|
|
32
|
+
"@types/qrcode": "^1.5.5",
|
|
31
33
|
"@types/react": "^19.0.2",
|
|
32
34
|
"react": "^19.0.0",
|
|
33
35
|
"tsup": "^8.5.1",
|