@micha.bigler/ui-core-micha 3.14.4 → 4.0.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/CHANGELOG.md +29 -0
- package/README.md +7 -0
- package/dist/chat/kitSxRegistry.js +9 -0
- package/dist/components/charts/kitSxRegistry.js +6 -0
- package/dist/entries/charts.js +6 -0
- package/dist/entries/chat.js +8 -0
- package/dist/entries/markdown.js +1 -0
- package/dist/index.js +0 -14
- package/dist/pages/AccountPage.js +1 -2
- package/dist/pages/LoginPage.js +1 -2
- package/dist/pages/PasswordChangePage.js +1 -2
- package/dist/pages/PasswordInvitePage.js +1 -2
- package/dist/pages/PasswordResetRequestPage.js +1 -2
- package/dist/pages/SignUpPage.js +1 -2
- package/dist/pages/SignupConfirmPage.js +1 -2
- package/dist/theme/kitSxEntry.js +11 -0
- package/dist/theme/kitSxRegistry.js +2 -15
- package/package.json +31 -7
- package/.github/workflows/ci.yml +0 -35
- package/.github/workflows/publish.yml +0 -126
- package/DESIGN.md +0 -60
- package/WORK_ORDERS.md +0 -150
- package/dev/entries.jsx +0 -721
- package/dev/fixtures.js +0 -26
- package/dev/main.jsx +0 -75
- package/dev/mockTransport.jsx +0 -128
- package/docs/CHART-LAYOUT.md +0 -157
- package/docs/DARK-TOKENS.md +0 -140
- package/docs/TYPE-SCALE.md +0 -111
- package/docs/messaging-deviations.md +0 -118
- package/index.html +0 -12
- package/renovate.json +0 -10
- package/scripts/chart-api-census.mjs +0 -415
- package/src/auth/AuthContext.jsx +0 -158
- package/src/auth/ReauthModal.jsx +0 -82
- package/src/auth/UserMenu.jsx +0 -121
- package/src/auth/apiClient.jsx +0 -232
- package/src/auth/authApi.jsx +0 -539
- package/src/auth/authConfig.jsx +0 -34
- package/src/auth/reauth.js +0 -47
- package/src/chat/ChatComposer.jsx +0 -36
- package/src/chat/ChatList.jsx +0 -87
- package/src/chat/ChatThread.jsx +0 -128
- package/src/chat/ChatWorkspace.jsx +0 -244
- package/src/chat/MarkdownReply.jsx +0 -22
- package/src/chat/ModelPicker.jsx +0 -85
- package/src/chat/api.js +0 -18
- package/src/chat/useChatSocket.js +0 -32
- package/src/chat/wire.js +0 -7
- package/src/components/AccessCodeManager.jsx +0 -288
- package/src/components/AccessCodeSingleUseToggle.jsx +0 -92
- package/src/components/AllowedEmailDomainsManager.jsx +0 -92
- package/src/components/AuthFactorRequirementCard.jsx +0 -95
- package/src/components/BulkInviteCsvTab.jsx +0 -198
- package/src/components/EmptyState.jsx +0 -38
- package/src/components/LoginForm.jsx +0 -159
- package/src/components/MFAComponent.jsx +0 -350
- package/src/components/MfaLoginComponent.jsx +0 -252
- package/src/components/MobileBottomNav.jsx +0 -82
- package/src/components/PasskeysComponent.jsx +0 -252
- package/src/components/PasswordChangeForm.jsx +0 -87
- package/src/components/PasswordResetRequestForm.jsx +0 -43
- package/src/components/PasswordSetForm.jsx +0 -97
- package/src/components/ProfileComponent.jsx +0 -348
- package/src/components/QrSignupManager.jsx +0 -404
- package/src/components/QrSignupValidityManager.jsx +0 -106
- package/src/components/RegistrationMethodsManager.jsx +0 -150
- package/src/components/SecurityComponent.jsx +0 -141
- package/src/components/SocialLoginButtons.jsx +0 -83
- package/src/components/SoftChip.jsx +0 -93
- package/src/components/StatTile.jsx +0 -39
- package/src/components/SupportRecoveryRequestsTab.jsx +0 -482
- package/src/components/TurnstileWidget.jsx +0 -99
- package/src/components/UserInviteComponent.jsx +0 -76
- package/src/components/UserListComponent.jsx +0 -618
- package/src/components/charts/BarChart.jsx +0 -102
- package/src/components/charts/ChartFrame.jsx +0 -214
- package/src/components/charts/LineChart.jsx +0 -126
- package/src/components/charts/ScatterChart.jsx +0 -299
- package/src/components/charts/TimeSeriesChart.jsx +0 -300
- package/src/components/charts/chartDefaults.js +0 -644
- package/src/components/charts/chartLabels.js +0 -36
- package/src/components/charts/exportChart.js +0 -258
- package/src/components/charts/formatters.js +0 -39
- package/src/components/charts/palette.js +0 -33
- package/src/components/charts/yearTickInterval.js +0 -7
- package/src/i18n/authTranslations.ts +0 -2651
- package/src/i18n/chartsTranslations.ts +0 -91
- package/src/i18n/chatTranslations.ts +0 -55
- package/src/i18n/messagingTranslations.ts +0 -120
- package/src/i18n/notificationsTranslations.ts +0 -32
- package/src/i18n/onboardingTranslations.ts +0 -29
- package/src/i18n/sectionNavTranslations.ts +0 -20
- package/src/i18n/uiCoreTranslations.js +0 -29
- package/src/i18n/userMenuTranslations.ts +0 -5
- package/src/index.js +0 -158
- package/src/layout/PageLayout.jsx +0 -36
- package/src/layout/SectionNav.jsx +0 -320
- package/src/messaging/AttachmentList.jsx +0 -145
- package/src/messaging/Composer.jsx +0 -197
- package/src/messaging/ConversationLaunchers.jsx +0 -51
- package/src/messaging/ConversationList.jsx +0 -109
- package/src/messaging/DirectMessageLauncher.jsx +0 -112
- package/src/messaging/MessageBubble.jsx +0 -183
- package/src/messaging/MessagingProvider.jsx +0 -0
- package/src/messaging/MessagingScopeConfig.jsx +0 -24
- package/src/messaging/PollCard.jsx +0 -163
- package/src/messaging/ReactionBar.jsx +0 -43
- package/src/messaging/ReadTicks.jsx +0 -82
- package/src/messaging/Thread.jsx +0 -195
- package/src/messaging/api.js +0 -48
- package/src/messaging/composerImageCompression.js +0 -35
- package/src/messaging/linkifyText.jsx +0 -37
- package/src/notifications/NotificationBell.jsx +0 -84
- package/src/notifications/NotificationSettings.jsx +0 -330
- package/src/notifications/NotificationsProvider.jsx +0 -224
- package/src/notifications/PopupSurface.jsx +0 -105
- package/src/notifications/api.js +0 -55
- package/src/notifications/feedApi.js +0 -18
- package/src/notifications/realtime.jsx +0 -138
- package/src/notifications/serviceWorker/sw.js +0 -50
- package/src/onboarding/OnboardingProvider.jsx +0 -326
- package/src/onboarding/OnboardingWizard.jsx +0 -61
- package/src/onboarding/WizardDialogShell.jsx +0 -51
- package/src/onboarding/api.js +0 -13
- package/src/onboarding/stepSelection.js +0 -16
- package/src/onboarding/steps/BrowserPushStep.jsx +0 -121
- package/src/onboarding/steps/CompleteNameStep.jsx +0 -46
- package/src/onboarding/steps/CookieConsentStep.jsx +0 -133
- package/src/onboarding/steps/PwaInstallStep.jsx +0 -47
- package/src/pages/AccountPage.jsx +0 -394
- package/src/pages/LoginPage.jsx +0 -343
- package/src/pages/PasswordChangePage.jsx +0 -62
- package/src/pages/PasswordInvitePage.jsx +0 -177
- package/src/pages/PasswordResetRequestPage.jsx +0 -68
- package/src/pages/SignUpPage.jsx +0 -268
- package/src/pages/SignupConfirmPage.jsx +0 -155
- package/src/testing/checkKitIntegration.js +0 -233
- package/src/theme/createAppTheme.js +0 -423
- package/src/theme/fonts.js +0 -3
- package/src/theme/index.js +0 -21
- package/src/theme/kitSxRegistry.js +0 -285
- package/src/theme/themeCompleteness.js +0 -1045
- package/src/theme/tokens.js +0 -478
- package/src/utils/auth-errors.js +0 -76
- package/src/utils/authService.js +0 -223
- package/src/utils/resolveErrorText.js +0 -28
- package/src/utils/webauthn.js +0 -51
- package/tests/AccountPage.profileStatements.test.jsx +0 -162
- package/tests/AccountPage.test.jsx +0 -200
- package/tests/AuthContext.test.jsx +0 -129
- package/tests/BarChart.test.jsx +0 -112
- package/tests/BrowserPushStep.test.jsx +0 -110
- package/tests/ChartFrame.test.jsx +0 -336
- package/tests/ConversationList.test.jsx +0 -144
- package/tests/CookieConsentStep.test.jsx +0 -69
- package/tests/EmptyState.test.jsx +0 -62
- package/tests/LineChart.test.jsx +0 -80
- package/tests/MessagingProvider.test.jsx +0 -50
- package/tests/MobileBottomNav.test.jsx +0 -319
- package/tests/NotificationBell.test.jsx +0 -60
- package/tests/NotificationSettings.test.jsx +0 -276
- package/tests/NotificationsProvider.test.jsx +0 -240
- package/tests/OnboardingProvider.test.jsx +0 -294
- package/tests/OnboardingWizard.test.jsx +0 -143
- package/tests/PasswordChangeForm.test.jsx +0 -70
- package/tests/PasswordInvitePage.test.jsx +0 -142
- package/tests/PasswordSetForm.test.jsx +0 -70
- package/tests/PopupSurface.test.jsx +0 -142
- package/tests/ProfileComponent.refresh.test.jsx +0 -194
- package/tests/QrSignupManager.registrationContext.test.jsx +0 -106
- package/tests/QrSignupManagerInfoBox.test.jsx +0 -49
- package/tests/ScatterChart.test.jsx +0 -270
- package/tests/SectionNav.test.jsx +0 -363
- package/tests/SignUpPage.test.jsx +0 -208
- package/tests/SoftChip.test.jsx +0 -105
- package/tests/StatTile.test.jsx +0 -57
- package/tests/Thread.test.jsx +0 -151
- package/tests/TimeSeriesChart.test.jsx +0 -367
- package/tests/UserListComponent.test.jsx +0 -192
- package/tests/UserMenu.test.jsx +0 -171
- package/tests/apiClientLanguage.test.js +0 -33
- package/tests/apiClientPublicPaths.test.js +0 -178
- package/tests/authApiLogin.test.js +0 -42
- package/tests/authApiRegistration.test.js +0 -31
- package/tests/authErrorCodeRendering.test.jsx +0 -77
- package/tests/authErrors.test.js +0 -74
- package/tests/authTranslations.test.js +0 -74
- package/tests/chart-api-census.test.js +0 -366
- package/tests/chartAxisTickBand.test.jsx +0 -95
- package/tests/chartDefaults.test.js +0 -902
- package/tests/chartLabels.test.js +0 -50
- package/tests/chartsPalette.test.js +0 -99
- package/tests/chatApi.test.js +0 -48
- package/tests/chatDriverNames.test.jsx +0 -71
- package/tests/chatExports.test.js +0 -3
- package/tests/chatList.test.jsx +0 -84
- package/tests/chatPicker.test.jsx +0 -82
- package/tests/chatSocket.test.jsx +0 -26
- package/tests/chatThread.test.jsx +0 -116
- package/tests/chatTranslations.test.js +0 -47
- package/tests/chatWorkspace.test.jsx +0 -234
- package/tests/checkKitIntegration.test.jsx +0 -219
- package/tests/createAppTheme.test.js +0 -132
- package/tests/createAppThemeDark.test.js +0 -127
- package/tests/createAppThemeLightGuard.test.js +0 -40
- package/tests/createAppThemePageContrast.test.js +0 -108
- package/tests/createAppThemeTypography.test.js +0 -53
- package/tests/errorCallSiteGuard.test.js +0 -32
- package/tests/exportChart.test.js +0 -313
- package/tests/feedApi.test.js +0 -46
- package/tests/fixtures/light-theme-baseline.json +0 -2234
- package/tests/i18nAggregate.test.js +0 -120
- package/tests/i18nGermanVariant.test.js +0 -65
- package/tests/loginPageErrorResolution.test.jsx +0 -102
- package/tests/messagingApi.test.js +0 -32
- package/tests/messagingChunk6.test.jsx +0 -116
- package/tests/messagingCompactBubble.test.jsx +0 -64
- package/tests/messagingComposer.test.jsx +0 -136
- package/tests/messagingComposerChunk5.test.jsx +0 -113
- package/tests/messagingContractConformance.test.js +0 -69
- package/tests/messagingDirectMessageLauncher.test.jsx +0 -151
- package/tests/messagingExports.test.js +0 -21
- package/tests/messagingInteractions.test.jsx +0 -136
- package/tests/messagingLastMessagePreview.test.jsx +0 -93
- package/tests/messagingLinkify.test.jsx +0 -51
- package/tests/messagingMessageActions.test.jsx +0 -163
- package/tests/messagingMsg6.test.jsx +0 -105
- package/tests/messagingMsg6f.test.jsx +0 -155
- package/tests/messagingMsg6g.test.jsx +0 -166
- package/tests/messagingMsg6h.test.jsx +0 -136
- package/tests/messagingMsg6i.test.jsx +0 -129
- package/tests/messagingPollRendering.test.jsx +0 -142
- package/tests/messagingReactionMerge.test.jsx +0 -77
- package/tests/messagingReadTicksTooltip.test.jsx +0 -36
- package/tests/messagingThreadReceipts.test.jsx +0 -178
- package/tests/messagingThreadingQuoting.test.jsx +0 -87
- package/tests/messagingUnreadLifecycle.test.jsx +0 -78
- package/tests/notificationsApi.test.js +0 -41
- package/tests/notificationsExports.test.js +0 -34
- package/tests/onboardingDescriptors.test.js +0 -132
- package/tests/packageTreeShaking.test.js +0 -126
- package/tests/realtime.test.jsx +0 -219
- package/tests/resolveErrorText.test.js +0 -72
- package/tests/stepSelection.test.js +0 -53
- package/tests/themeCompleteness.test.js +0 -626
- package/tests/timeSeriesLegend.test.js +0 -99
- package/tests/userScreenTranslations.test.jsx +0 -218
- package/tsconfig.build.json +0 -18
- package/vite.config.mjs +0 -6
- package/work-orders/AUTH-1.md +0 -74
- package/work-orders/AUTH-2.md +0 -74
- package/work-orders/AUTH-4.md +0 -183
- package/work-orders/AUTH-5.md +0 -154
- package/work-orders/AUTH-7.md +0 -181
- package/work-orders/AUTH-8.md +0 -184
- package/work-orders/CHART-1.md +0 -285
- package/work-orders/CHART-2.md +0 -222
- package/work-orders/CHART-3.md +0 -163
- package/work-orders/CHART-4.md +0 -203
- package/work-orders/CHART-5.md +0 -226
- package/work-orders/CHART-6.md +0 -428
- package/work-orders/CHART-7.md +0 -175
- package/work-orders/DX-1.md +0 -169
- package/work-orders/DX-2.md +0 -188
- package/work-orders/DX-3.md +0 -195
- package/work-orders/I18N-1.md +0 -254
- package/work-orders/I18N-3.md +0 -207
- package/work-orders/MSG-3.md +0 -375
- package/work-orders/MSG-3b.md +0 -1002
- package/work-orders/MSG-3c.md +0 -378
- package/work-orders/MSG-3d.md +0 -268
- package/work-orders/MSG-3e.md +0 -164
- package/work-orders/MSG-3f.md +0 -391
- package/work-orders/MSG-6e.md +0 -308
- package/work-orders/MSG-6f.md +0 -214
- package/work-orders/MSG-6g.md +0 -244
- package/work-orders/MSG-6h.md +0 -238
- package/work-orders/MSG-6i.md +0 -271
- package/work-orders/MSG-6j.md +0 -117
- package/work-orders/NOTIF-12.md +0 -214
- package/work-orders/NOTIF-13.md +0 -142
- package/work-orders/NOTIF-14.md +0 -151
- package/work-orders/PRIM-1.md +0 -177
- package/work-orders/SHELL-1.md +0 -255
- package/work-orders/SHELL-2.md +0 -197
- package/work-orders/SHELL-3.md +0 -359
- package/work-orders/SHELL-4.md +0 -351
- package/work-orders/SHELL-5.md +0 -345
- package/work-orders/SHELL-6.md +0 -210
- package/work-orders/THEME-1.md +0 -587
- package/work-orders/THEME-10.md +0 -303
- package/work-orders/THEME-11.md +0 -208
- package/work-orders/THEME-2.md +0 -339
- package/work-orders/THEME-3.md +0 -210
- package/work-orders/THEME-4.md +0 -271
- package/work-orders/THEME-5.md +0 -341
- package/work-orders/THEME-6.md +0 -247
- package/work-orders/THEME-7.md +0 -82
- package/work-orders/THEME-8.md +0 -211
- package/work-orders/THEME-9.md +0 -194
- package/work-orders/UCM-AUTH-10.md +0 -490
- package/work-orders/UCM-AUTH-11.md +0 -185
- package/work-orders/UCM-AUTH-12.md +0 -98
- package/work-orders/UCM-AUTH-13.md +0 -47
- package/work-orders/UCM-AUTH-9.md +0 -207
- package/work-orders/UCM-CHART-10.md +0 -150
- package/work-orders/UCM-CHART-11.md +0 -132
- package/work-orders/UCM-CHART-12.md +0 -348
- package/work-orders/UCM-CHART-13.md +0 -122
- package/work-orders/UCM-CHART-14.md +0 -198
- package/work-orders/UCM-CHART-15.md +0 -187
- package/work-orders/UCM-CHART-16.md +0 -169
- package/work-orders/UCM-CHART-17.md +0 -195
- package/work-orders/UCM-CHART-18.md +0 -200
- package/work-orders/UCM-CHART-8.md +0 -147
- package/work-orders/UCM-CHART-9.md +0 -265
- package/work-orders/UCM-CHAT-1.md +0 -190
- package/work-orders/UCM-CHAT-2.md +0 -75
- package/work-orders/UCM-CI-1.md +0 -65
- package/work-orders/UCM-DEP-1.md +0 -63
- package/work-orders/UCM-I18N-4.md +0 -226
- package/work-orders/UCM-I18N-5.md +0 -211
- package/work-orders/UCM-MSG-20.md +0 -192
- package/work-orders/UCM-PRIM-2.md +0 -114
- package/work-orders/UCM-SHELL-7.md +0 -134
- package/work-orders/UCM-SHELL-8.md +0 -125
- package/work-orders/UCM-TEST-1.md +0 -304
- package/work-orders/UCM-THEME-13.md +0 -69
- package/work-orders/UCM-THEME-14.md +0 -312
- package/work-orders/UCM-THEME-15.md +0 -356
- package/work-orders/UCM-THEME-16.md +0 -80
- package/work-orders/UCM-THEME-17.md +0 -111
- package/work-orders/UCM-THEME-18.md +0 -184
- package/work-orders/assets/AUTH-4-user-list-card.html +0 -407
- package/work-orders/assets/PRIM-1-dashboard-primitives.html +0 -624
- package/work-orders/assets/SHELL-2-account-navigation.html +0 -1159
- package/work-orders/assets/THEME-1-baseline-reference-sheet.html +0 -1352
- package/work-orders/assets/UCM-CHAT-1-ai-chat.html +0 -447
- package/work-orders/assets/UCM-THEME-13-dark-prototype.html +0 -390
- package/work-orders/assets/UCM-THEME-17-type-scale.html +0 -391
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
// src/auth/components/MFAComponent.jsx
|
|
2
|
-
import React, { useState, useEffect } from 'react';
|
|
3
|
-
import { QRCodeSVG } from 'qrcode.react';
|
|
4
|
-
import {
|
|
5
|
-
Box,
|
|
6
|
-
Typography,
|
|
7
|
-
Button,
|
|
8
|
-
TextField,
|
|
9
|
-
Card,
|
|
10
|
-
CardContent,
|
|
11
|
-
Alert,
|
|
12
|
-
CircularProgress,
|
|
13
|
-
Stack,
|
|
14
|
-
Divider,
|
|
15
|
-
IconButton,
|
|
16
|
-
Tooltip,
|
|
17
|
-
} from '@mui/material';
|
|
18
|
-
import DeleteIcon from '@mui/icons-material/Delete';
|
|
19
|
-
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
|
20
|
-
import { useTranslation } from 'react-i18next';
|
|
21
|
-
import { fetchAuthenticators, requestTotpKey, activateTotp, deactivateTotp, fetchRecoveryCodes, generateRecoveryCodes } from '../auth/authApi';
|
|
22
|
-
import { resolveErrorText } from '../utils/resolveErrorText';
|
|
23
|
-
|
|
24
|
-
export const MFA_ALERT_SX = { mb: 2 };
|
|
25
|
-
export const MFA_CARD_SX = { mb: 3 };
|
|
26
|
-
export const MFA_ACTIVE_CARD_SX = { bgcolor: 'success.bg' };
|
|
27
|
-
export const MFA_TEXT_FIELD_SX = { mb: 2 };
|
|
28
|
-
export const MFA_DIVIDER_SX = { my: 3 };
|
|
29
|
-
export const MFA_RECOVERY_BUTTON_SX = { mt: 2 };
|
|
30
|
-
|
|
31
|
-
export function MFAComponent() {
|
|
32
|
-
const { t, i18n } = useTranslation();
|
|
33
|
-
|
|
34
|
-
const [authenticators, setAuthenticators] = useState([]);
|
|
35
|
-
const [loading, setLoading] = useState(true);
|
|
36
|
-
const [errorKey, setErrorKey] = useState(null);
|
|
37
|
-
|
|
38
|
-
// Setup State
|
|
39
|
-
const [isSettingUp, setIsSettingUp] = useState(false);
|
|
40
|
-
const [totpData, setTotpData] = useState(null); // { secret, key_uri }
|
|
41
|
-
const [verifyCode, setVerifyCode] = useState('');
|
|
42
|
-
const [submitting, setSubmitting] = useState(false);
|
|
43
|
-
|
|
44
|
-
// Recovery Codes State
|
|
45
|
-
const [recoveryCodes, setRecoveryCodes] = useState([]);
|
|
46
|
-
const [showRecovery, setShowRecovery] = useState(false);
|
|
47
|
-
|
|
48
|
-
const loadData = async () => {
|
|
49
|
-
setLoading(true);
|
|
50
|
-
setErrorKey(null);
|
|
51
|
-
try {
|
|
52
|
-
const data = await fetchAuthenticators();
|
|
53
|
-
setAuthenticators(Array.isArray(data) ? data : []);
|
|
54
|
-
} catch (err) {
|
|
55
|
-
// 404 / leer einfach schlucken
|
|
56
|
-
// eslint-disable-next-line no-console
|
|
57
|
-
console.error(err);
|
|
58
|
-
} finally {
|
|
59
|
-
setLoading(false);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
loadData();
|
|
65
|
-
}, []);
|
|
66
|
-
|
|
67
|
-
const totpAuthenticator = authenticators.find((a) => a.type === 'totp');
|
|
68
|
-
|
|
69
|
-
// --- HANDLER: TOTP START ---
|
|
70
|
-
const handleStartSetup = async () => {
|
|
71
|
-
setErrorKey(null);
|
|
72
|
-
setIsSettingUp(true);
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
const result = await requestTotpKey();
|
|
76
|
-
|
|
77
|
-
if (result.exists) {
|
|
78
|
-
setIsSettingUp(false);
|
|
79
|
-
setErrorKey(t('Auth.MFA_TOTP_ALREADY_ACTIVE'));
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
setTotpData({
|
|
84
|
-
secret: result.secret,
|
|
85
|
-
key_uri: result.key_uri,
|
|
86
|
-
});
|
|
87
|
-
} catch (err) {
|
|
88
|
-
// eslint-disable-next-line no-console
|
|
89
|
-
console.error(err);
|
|
90
|
-
setErrorKey(resolveErrorText(i18n, err, 'Auth.TOTP_REQUEST_FAILED'));
|
|
91
|
-
setIsSettingUp(false);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
// --- HANDLER: TOTP VERIFY ---
|
|
96
|
-
const handleVerify = async (e) => {
|
|
97
|
-
e.preventDefault();
|
|
98
|
-
setSubmitting(true);
|
|
99
|
-
setErrorKey(null);
|
|
100
|
-
try {
|
|
101
|
-
await activateTotp(verifyCode);
|
|
102
|
-
setIsSettingUp(false);
|
|
103
|
-
setVerifyCode('');
|
|
104
|
-
setTotpData(null);
|
|
105
|
-
await loadData();
|
|
106
|
-
await handleShowRecoveryCodes();
|
|
107
|
-
} catch (err) {
|
|
108
|
-
setErrorKey(resolveErrorText(i18n, err, 'Auth.MFA_AUTHENTICATE_FAILED'));
|
|
109
|
-
} finally {
|
|
110
|
-
setSubmitting(false);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
// --- HANDLER: TOTP DELETE ---
|
|
115
|
-
const handleDeleteTotp = async () => {
|
|
116
|
-
// Achtung: confirm-Text jetzt übersetzt
|
|
117
|
-
// eslint-disable-next-line no-alert
|
|
118
|
-
const ok = window.confirm(t('Auth.MFA_TOTP_DISABLE_CONFIRM'));
|
|
119
|
-
if (!ok) return;
|
|
120
|
-
|
|
121
|
-
setErrorKey(null);
|
|
122
|
-
try {
|
|
123
|
-
await deactivateTotp();
|
|
124
|
-
await loadData();
|
|
125
|
-
} catch (err) {
|
|
126
|
-
// eslint-disable-next-line no-console
|
|
127
|
-
console.error(err);
|
|
128
|
-
setErrorKey(resolveErrorText(i18n, err, 'Auth.TOTP_DEACTIVATE_FAILED'));
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
// --- HANDLER: RECOVERY CODES ---
|
|
133
|
-
const handleShowRecoveryCodes = async () => {
|
|
134
|
-
setErrorKey(null);
|
|
135
|
-
try {
|
|
136
|
-
const data = await fetchRecoveryCodes();
|
|
137
|
-
const codes = data.codes || data.unused_codes || [];
|
|
138
|
-
setRecoveryCodes(Array.isArray(codes) ? codes : []);
|
|
139
|
-
setShowRecovery(true);
|
|
140
|
-
} catch (err) {
|
|
141
|
-
// eslint-disable-next-line no-console
|
|
142
|
-
console.error(err);
|
|
143
|
-
setErrorKey(resolveErrorText(i18n, err, 'Auth.RECOVERY_CODES_FETCH_FAILED'));
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const handleGenerateNewRecoveryCodes = async () => {
|
|
148
|
-
setErrorKey(null);
|
|
149
|
-
try {
|
|
150
|
-
const data = await generateRecoveryCodes();
|
|
151
|
-
const codes = data.codes || data.unused_codes || [];
|
|
152
|
-
setRecoveryCodes(Array.isArray(codes) ? codes : []);
|
|
153
|
-
} catch (err) {
|
|
154
|
-
// eslint-disable-next-line no-console
|
|
155
|
-
console.error(err);
|
|
156
|
-
setErrorKey(resolveErrorText(i18n, err, 'Auth.RECOVERY_CODES_GENERATE_FAILED'));
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const handleCopyCode = (code) => {
|
|
161
|
-
navigator.clipboard.writeText(code);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
if (loading) return <CircularProgress />;
|
|
165
|
-
|
|
166
|
-
return (
|
|
167
|
-
<Box>
|
|
168
|
-
<Typography variant="h6" gutterBottom>
|
|
169
|
-
{t('Auth.MFA_TOTP_TITLE')}
|
|
170
|
-
</Typography>
|
|
171
|
-
<Typography variant="body2" sx={{ mb: 2 }}>
|
|
172
|
-
{t('Auth.MFA_TOTP_DESCRIPTION')}
|
|
173
|
-
</Typography>
|
|
174
|
-
|
|
175
|
-
{errorKey && (
|
|
176
|
-
<Alert severity="error" sx={MFA_ALERT_SX}>
|
|
177
|
-
{errorKey}
|
|
178
|
-
</Alert>
|
|
179
|
-
)}
|
|
180
|
-
|
|
181
|
-
{/* --- CASE 1: TOTP IS ACTIVE --- */}
|
|
182
|
-
{totpAuthenticator ? (
|
|
183
|
-
<Card variant="outlined" sx={[MFA_CARD_SX, MFA_ACTIVE_CARD_SX]}>
|
|
184
|
-
<CardContent
|
|
185
|
-
sx={{
|
|
186
|
-
display: 'flex',
|
|
187
|
-
alignItems: 'center',
|
|
188
|
-
justifyContent: 'space-between',
|
|
189
|
-
}}
|
|
190
|
-
>
|
|
191
|
-
<Box>
|
|
192
|
-
<Typography
|
|
193
|
-
variant="subtitle1"
|
|
194
|
-
color="success.main"
|
|
195
|
-
fontWeight="bold"
|
|
196
|
-
>
|
|
197
|
-
{t('Auth.MFA_TOTP_STATUS_ACTIVE')}
|
|
198
|
-
</Typography>
|
|
199
|
-
</Box>
|
|
200
|
-
<Button
|
|
201
|
-
variant="outlined"
|
|
202
|
-
color="error"
|
|
203
|
-
startIcon={<DeleteIcon />}
|
|
204
|
-
onClick={handleDeleteTotp}
|
|
205
|
-
>
|
|
206
|
-
{t('Auth.MFA_TOTP_BUTTON_DISABLE')}
|
|
207
|
-
</Button>
|
|
208
|
-
</CardContent>
|
|
209
|
-
</Card>
|
|
210
|
-
) : (
|
|
211
|
-
!isSettingUp && (
|
|
212
|
-
<Button variant="contained" onClick={handleStartSetup}>
|
|
213
|
-
{t('Auth.MFA_TOTP_BUTTON_SETUP')}
|
|
214
|
-
</Button>
|
|
215
|
-
)
|
|
216
|
-
)}
|
|
217
|
-
|
|
218
|
-
{/* --- WIZARD: SETUP --- */}
|
|
219
|
-
{isSettingUp && totpData && (
|
|
220
|
-
<Card variant="outlined" sx={MFA_CARD_SX}>
|
|
221
|
-
<CardContent>
|
|
222
|
-
<Typography variant="subtitle1" gutterBottom>
|
|
223
|
-
{t('Auth.MFA_TOTP_QR_TITLE')}
|
|
224
|
-
</Typography>
|
|
225
|
-
|
|
226
|
-
<Stack
|
|
227
|
-
direction={{ xs: 'column', sm: 'row' }}
|
|
228
|
-
spacing={3}
|
|
229
|
-
alignItems="center"
|
|
230
|
-
>
|
|
231
|
-
{/* QR CODE */}
|
|
232
|
-
<Box sx={{ p: 2, bgcolor: 'background.paper', border: '1px solid', borderColor: 'divider' }}>
|
|
233
|
-
<QRCodeSVG value={totpData.key_uri} size={150} />
|
|
234
|
-
</Box>
|
|
235
|
-
|
|
236
|
-
{/* MANUAL ENTRY & VERIFY */}
|
|
237
|
-
<Box sx={{ flex: 1 }}>
|
|
238
|
-
<Typography variant="body2" gutterBottom>
|
|
239
|
-
{t('Auth.MFA_TOTP_MANUAL_HINT')}
|
|
240
|
-
</Typography>
|
|
241
|
-
<Typography
|
|
242
|
-
variant="mono"
|
|
243
|
-
sx={{
|
|
244
|
-
fontFamily: 'monospace',
|
|
245
|
-
bgcolor: 'background.subtle',
|
|
246
|
-
p: 1,
|
|
247
|
-
borderRadius: 1,
|
|
248
|
-
display: 'inline-block',
|
|
249
|
-
mb: 2,
|
|
250
|
-
}}
|
|
251
|
-
>
|
|
252
|
-
{totpData.secret}
|
|
253
|
-
</Typography>
|
|
254
|
-
|
|
255
|
-
<form onSubmit={handleVerify}>
|
|
256
|
-
<TextField
|
|
257
|
-
label={t('Auth.MFA_TOTP_CODE_LABEL')}
|
|
258
|
-
value={verifyCode}
|
|
259
|
-
onChange={(e) => setVerifyCode(e.target.value)}
|
|
260
|
-
fullWidth
|
|
261
|
-
required
|
|
262
|
-
sx={MFA_TEXT_FIELD_SX}
|
|
263
|
-
autoComplete="off"
|
|
264
|
-
/>
|
|
265
|
-
<Stack direction="row" spacing={1}>
|
|
266
|
-
<Button type="submit" variant="contained" disabled={submitting}>
|
|
267
|
-
{submitting
|
|
268
|
-
? t('Auth.MFA_TOTP_VERIFY_BUTTON_LOADING')
|
|
269
|
-
: t('Auth.MFA_TOTP_VERIFY_BUTTON')}
|
|
270
|
-
</Button>
|
|
271
|
-
<Button
|
|
272
|
-
onClick={() => {
|
|
273
|
-
setIsSettingUp(false);
|
|
274
|
-
setTotpData(null);
|
|
275
|
-
setVerifyCode('');
|
|
276
|
-
}}
|
|
277
|
-
disabled={submitting}
|
|
278
|
-
>
|
|
279
|
-
{t('Auth.MFA_TOTP_CANCEL_BUTTON')}
|
|
280
|
-
</Button>
|
|
281
|
-
</Stack>
|
|
282
|
-
</form>
|
|
283
|
-
</Box>
|
|
284
|
-
</Stack>
|
|
285
|
-
</CardContent>
|
|
286
|
-
</Card>
|
|
287
|
-
)}
|
|
288
|
-
|
|
289
|
-
<Divider sx={MFA_DIVIDER_SX} />
|
|
290
|
-
|
|
291
|
-
{/* --- RECOVERY CODES --- */}
|
|
292
|
-
<Typography variant="h6" gutterBottom>
|
|
293
|
-
{t('Auth.MFA_RECOVERY_TITLE')}
|
|
294
|
-
</Typography>
|
|
295
|
-
<Typography variant="body2" sx={{ mb: 2 }}>
|
|
296
|
-
{t('Auth.MFA_RECOVERY_DESCRIPTION')}
|
|
297
|
-
</Typography>
|
|
298
|
-
|
|
299
|
-
{!showRecovery ? (
|
|
300
|
-
<Button variant="outlined" onClick={handleShowRecoveryCodes}>
|
|
301
|
-
{t('Auth.MFA_RECOVERY_VIEW_BUTTON')}
|
|
302
|
-
</Button>
|
|
303
|
-
) : (
|
|
304
|
-
<Box sx={{ bgcolor: 'background.subtle', p: 2, borderRadius: 1 }}>
|
|
305
|
-
<Alert severity="warning" sx={MFA_ALERT_SX}>
|
|
306
|
-
{t('Auth.MFA_RECOVERY_WARNING')}
|
|
307
|
-
</Alert>
|
|
308
|
-
<Stack direction="row" flexWrap="wrap" gap={2}>
|
|
309
|
-
{Array.isArray(recoveryCodes) &&
|
|
310
|
-
recoveryCodes.map((code) => (
|
|
311
|
-
<Box
|
|
312
|
-
key={code}
|
|
313
|
-
sx={{
|
|
314
|
-
bgcolor: 'background.paper',
|
|
315
|
-
border: '1px solid',
|
|
316
|
-
borderColor: 'divider',
|
|
317
|
-
p: 1,
|
|
318
|
-
borderRadius: 1,
|
|
319
|
-
fontFamily: 'monospace',
|
|
320
|
-
display: 'flex',
|
|
321
|
-
alignItems: 'center',
|
|
322
|
-
gap: 1,
|
|
323
|
-
}}
|
|
324
|
-
>
|
|
325
|
-
{code}
|
|
326
|
-
<Tooltip title={t('Auth.MFA_RECOVERY_COPY_TOOLTIP')}>
|
|
327
|
-
<IconButton
|
|
328
|
-
size="small"
|
|
329
|
-
onClick={() => handleCopyCode(code)}
|
|
330
|
-
>
|
|
331
|
-
<ContentCopyIcon fontSize="small" />
|
|
332
|
-
</IconButton>
|
|
333
|
-
</Tooltip>
|
|
334
|
-
</Box>
|
|
335
|
-
))}
|
|
336
|
-
</Stack>
|
|
337
|
-
<Button
|
|
338
|
-
sx={MFA_RECOVERY_BUTTON_SX}
|
|
339
|
-
size="small"
|
|
340
|
-
onClick={handleGenerateNewRecoveryCodes}
|
|
341
|
-
>
|
|
342
|
-
{t('Auth.MFA_RECOVERY_GENERATE_NEW')}
|
|
343
|
-
</Button>
|
|
344
|
-
</Box>
|
|
345
|
-
)}
|
|
346
|
-
</Box>
|
|
347
|
-
);
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Box,
|
|
4
|
-
Typography,
|
|
5
|
-
TextField,
|
|
6
|
-
Button,
|
|
7
|
-
Stack,
|
|
8
|
-
Alert,
|
|
9
|
-
Divider,
|
|
10
|
-
Dialog,
|
|
11
|
-
DialogTitle,
|
|
12
|
-
DialogContent,
|
|
13
|
-
DialogActions,
|
|
14
|
-
} from '@mui/material';
|
|
15
|
-
import { useTranslation } from 'react-i18next';
|
|
16
|
-
import { authenticateWithMFA, fetchCurrentUser, requestMfaSupportHelp } from '../auth/authApi';
|
|
17
|
-
import { loginWithPasskey } from '../utils/authService';
|
|
18
|
-
import { resolveErrorText } from '../utils/resolveErrorText';
|
|
19
|
-
|
|
20
|
-
export const MFA_LOGIN_ALERT_SX = { mb: 2 };
|
|
21
|
-
export const MFA_LOGIN_DIVIDER_SX = { my: 2 };
|
|
22
|
-
export const MFA_LOGIN_TEXT_FIELD_SX = { mb: 2 };
|
|
23
|
-
|
|
24
|
-
export function MfaLoginComponent({ availableTypes, identifier, onSuccess, onCancel }) {
|
|
25
|
-
const { t, i18n } = useTranslation();
|
|
26
|
-
const [code, setCode] = useState('');
|
|
27
|
-
const [submitting, setSubmitting] = useState(false);
|
|
28
|
-
const [errorKey, setErrorKey] = useState(null);
|
|
29
|
-
const [infoKey, setInfoKey] = useState(null);
|
|
30
|
-
const [helpRequested, setHelpRequested] = useState(false);
|
|
31
|
-
|
|
32
|
-
const [helpDialogOpen, setHelpDialogOpen] = useState(false);
|
|
33
|
-
const [helpMessage, setHelpMessage] = useState('');
|
|
34
|
-
|
|
35
|
-
const types = Array.isArray(availableTypes) ? availableTypes : [];
|
|
36
|
-
const supportsTotpOrRecovery =
|
|
37
|
-
types.includes('totp') || types.includes('recovery_codes');
|
|
38
|
-
const supportsWebauthn = types.includes('webauthn');
|
|
39
|
-
|
|
40
|
-
const handleSubmitCode = async (event) => {
|
|
41
|
-
event.preventDefault();
|
|
42
|
-
setErrorKey(null);
|
|
43
|
-
setInfoKey(null);
|
|
44
|
-
setSubmitting(true);
|
|
45
|
-
try {
|
|
46
|
-
const trimmed = code.trim();
|
|
47
|
-
const isRecovery = trimmed.length > 6;
|
|
48
|
-
|
|
49
|
-
await authenticateWithMFA({ code: trimmed });
|
|
50
|
-
|
|
51
|
-
const user = await fetchCurrentUser();
|
|
52
|
-
|
|
53
|
-
onSuccess({
|
|
54
|
-
user,
|
|
55
|
-
method: isRecovery ? 'recovery_code' : 'totp',
|
|
56
|
-
});
|
|
57
|
-
} catch (err) {
|
|
58
|
-
setErrorKey(resolveErrorText(i18n, err, 'Auth.MFA_AUTHENTICATE_FAILED'));
|
|
59
|
-
} finally {
|
|
60
|
-
setSubmitting(false);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const handlePasskey = async () => {
|
|
65
|
-
setErrorKey(null);
|
|
66
|
-
setInfoKey(null);
|
|
67
|
-
setSubmitting(true);
|
|
68
|
-
try {
|
|
69
|
-
// Use standard passkey login (starts a fresh session flow).
|
|
70
|
-
// This allows users to bypass the password MFA step if they have a valid passkey.
|
|
71
|
-
const user = await loginWithPasskey();
|
|
72
|
-
onSuccess({ user, method: 'webauthn' });
|
|
73
|
-
} catch (err) {
|
|
74
|
-
// Detailed error handling
|
|
75
|
-
if (err.code === 'Auth.PASSKEY_CANCELLED') {
|
|
76
|
-
// User cancelled - show specific key or just ignore
|
|
77
|
-
setErrorKey(t('Auth.PASSKEY_CANCELLED'));
|
|
78
|
-
} else {
|
|
79
|
-
// eslint-disable-next-line no-console
|
|
80
|
-
console.error(err);
|
|
81
|
-
setErrorKey(t('Auth.PASSKEY_FAILED'));
|
|
82
|
-
}
|
|
83
|
-
} finally {
|
|
84
|
-
setSubmitting(false);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const openHelpDialog = () => {
|
|
89
|
-
setErrorKey(null);
|
|
90
|
-
setInfoKey(null);
|
|
91
|
-
setHelpDialogOpen(true);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const handleNeedHelp = async () => {
|
|
95
|
-
setErrorKey(null);
|
|
96
|
-
setInfoKey(null);
|
|
97
|
-
setSubmitting(true);
|
|
98
|
-
try {
|
|
99
|
-
await requestMfaSupportHelp(identifier || '', helpMessage || '');
|
|
100
|
-
setHelpRequested(true);
|
|
101
|
-
setInfoKey('Auth.MFA_HELP_REQUESTED');
|
|
102
|
-
setHelpDialogOpen(false);
|
|
103
|
-
setHelpMessage('');
|
|
104
|
-
} catch (err) {
|
|
105
|
-
setErrorKey(resolveErrorText(i18n, err, 'Auth.MFA_HELP_REQUEST_FAILED'));
|
|
106
|
-
} finally {
|
|
107
|
-
setSubmitting(false);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
return (
|
|
112
|
-
<Box>
|
|
113
|
-
<Typography variant="body2" sx={{ mb: 2 }}>
|
|
114
|
-
{t(
|
|
115
|
-
'Auth.MFA_SUBTITLE',
|
|
116
|
-
'Please confirm your login using one of the available methods.',
|
|
117
|
-
)}
|
|
118
|
-
</Typography>
|
|
119
|
-
|
|
120
|
-
{errorKey && (
|
|
121
|
-
<Alert severity="error" sx={MFA_LOGIN_ALERT_SX}>
|
|
122
|
-
{errorKey}
|
|
123
|
-
</Alert>
|
|
124
|
-
)}
|
|
125
|
-
|
|
126
|
-
{infoKey && (
|
|
127
|
-
<Alert severity="info" sx={MFA_LOGIN_ALERT_SX}>
|
|
128
|
-
{t(infoKey)}
|
|
129
|
-
</Alert>
|
|
130
|
-
)}
|
|
131
|
-
|
|
132
|
-
<Stack spacing={2}>
|
|
133
|
-
{supportsWebauthn && (
|
|
134
|
-
<Button
|
|
135
|
-
variant="contained"
|
|
136
|
-
fullWidth
|
|
137
|
-
onClick={handlePasskey}
|
|
138
|
-
disabled={submitting || helpRequested}
|
|
139
|
-
>
|
|
140
|
-
{t('Auth.LOGIN_USE_PASSKEY_BUTTON', 'Use passkey / security key')}
|
|
141
|
-
</Button>
|
|
142
|
-
)}
|
|
143
|
-
|
|
144
|
-
<Divider sx={MFA_LOGIN_DIVIDER_SX}>
|
|
145
|
-
{t('Auth.LOGIN_OR')}
|
|
146
|
-
</Divider>
|
|
147
|
-
|
|
148
|
-
{supportsTotpOrRecovery && (
|
|
149
|
-
<Box component="form" onSubmit={handleSubmitCode}>
|
|
150
|
-
<TextField
|
|
151
|
-
label={t(
|
|
152
|
-
'Auth.MFA_CODE_LABEL',
|
|
153
|
-
'Authenticator code (or recovery code)',
|
|
154
|
-
)}
|
|
155
|
-
value={code}
|
|
156
|
-
onChange={(e) => setCode(e.target.value)}
|
|
157
|
-
fullWidth
|
|
158
|
-
disabled={submitting || helpRequested}
|
|
159
|
-
autoComplete="one-time-code"
|
|
160
|
-
sx={MFA_LOGIN_TEXT_FIELD_SX}
|
|
161
|
-
/>
|
|
162
|
-
<Button
|
|
163
|
-
type="submit"
|
|
164
|
-
variant="contained"
|
|
165
|
-
fullWidth
|
|
166
|
-
disabled={submitting || !code.trim() || helpRequested}
|
|
167
|
-
>
|
|
168
|
-
{t('Auth.MFA_VERIFY', 'Verify')}
|
|
169
|
-
</Button>
|
|
170
|
-
</Box>
|
|
171
|
-
)}
|
|
172
|
-
|
|
173
|
-
<Divider sx={MFA_LOGIN_DIVIDER_SX}>
|
|
174
|
-
{t('Auth.LOGIN_OR')}
|
|
175
|
-
</Divider>
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
<Stack direction="row" spacing={1} sx={{ mt: 1 }}>
|
|
180
|
-
<Button
|
|
181
|
-
fullWidth
|
|
182
|
-
size="small"
|
|
183
|
-
variant="outlined"
|
|
184
|
-
onClick={onCancel}
|
|
185
|
-
disabled={submitting}
|
|
186
|
-
>
|
|
187
|
-
{t('Auth.MFA_BACK_TO_LOGIN', 'Back to login')}
|
|
188
|
-
</Button>
|
|
189
|
-
|
|
190
|
-
<Button
|
|
191
|
-
fullWidth
|
|
192
|
-
size="small"
|
|
193
|
-
variant="outlined"
|
|
194
|
-
color="secondary"
|
|
195
|
-
onClick={openHelpDialog}
|
|
196
|
-
disabled={submitting || helpRequested}
|
|
197
|
-
>
|
|
198
|
-
{t(
|
|
199
|
-
'Auth.MFA_NEED_HELP',
|
|
200
|
-
"I can't use any of these methods",
|
|
201
|
-
)}
|
|
202
|
-
</Button>
|
|
203
|
-
</Stack>
|
|
204
|
-
</Stack>
|
|
205
|
-
<Dialog
|
|
206
|
-
open={helpDialogOpen}
|
|
207
|
-
onClose={() => setHelpDialogOpen(false)}
|
|
208
|
-
fullWidth
|
|
209
|
-
maxWidth="sm"
|
|
210
|
-
>
|
|
211
|
-
<DialogTitle>
|
|
212
|
-
{t('Auth.MFA_HELP_DIALOG_TITLE', 'Need help with sign-in')}
|
|
213
|
-
</DialogTitle>
|
|
214
|
-
<DialogContent dividers>
|
|
215
|
-
<Typography variant="body2" sx={{ mb: 2 }}>
|
|
216
|
-
{t(
|
|
217
|
-
'Auth.MFA_HELP_DIALOG_DESCRIPTION',
|
|
218
|
-
'Describe briefly why you cannot use the available methods. A support person will review your request.',
|
|
219
|
-
)}
|
|
220
|
-
</Typography>
|
|
221
|
-
<TextField
|
|
222
|
-
label={t('Auth.MFA_HELP_MESSAGE_LABEL', 'Your message to support')}
|
|
223
|
-
multiline
|
|
224
|
-
minRows={3}
|
|
225
|
-
fullWidth
|
|
226
|
-
value={helpMessage}
|
|
227
|
-
onChange={(e) => setHelpMessage(e.target.value)}
|
|
228
|
-
disabled={submitting}
|
|
229
|
-
/>
|
|
230
|
-
</DialogContent>
|
|
231
|
-
<DialogActions>
|
|
232
|
-
<Button
|
|
233
|
-
onClick={() => setHelpDialogOpen(false)}
|
|
234
|
-
disabled={submitting}
|
|
235
|
-
>
|
|
236
|
-
{t('Common.CANCEL', 'Cancel')}
|
|
237
|
-
</Button>
|
|
238
|
-
<Button
|
|
239
|
-
onClick={handleNeedHelp}
|
|
240
|
-
disabled={submitting}
|
|
241
|
-
variant="contained"
|
|
242
|
-
>
|
|
243
|
-
{t('Auth.MFA_HELP_SUBMIT', 'Send request')}
|
|
244
|
-
</Button>
|
|
245
|
-
</DialogActions>
|
|
246
|
-
</Dialog>
|
|
247
|
-
</Box>
|
|
248
|
-
|
|
249
|
-
);
|
|
250
|
-
|
|
251
|
-
};
|
|
252
|
-
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import Badge from '@mui/material/Badge';
|
|
2
|
-
import BottomNavigation from '@mui/material/BottomNavigation';
|
|
3
|
-
import BottomNavigationAction from '@mui/material/BottomNavigationAction';
|
|
4
|
-
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
5
|
-
import { useTheme } from '@mui/material/styles';
|
|
6
|
-
|
|
7
|
-
const defaultZIndex = (theme) => theme.zIndex.drawer + 2;
|
|
8
|
-
|
|
9
|
-
export const MOBILE_BOTTOM_NAV_ROOT_SX = {
|
|
10
|
-
position: 'fixed',
|
|
11
|
-
left: 0,
|
|
12
|
-
right: 0,
|
|
13
|
-
bottom: 0,
|
|
14
|
-
borderTop: '1px solid',
|
|
15
|
-
borderColor: 'divider',
|
|
16
|
-
paddingBottom: 'env(safe-area-inset-bottom)',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const MOBILE_BOTTOM_NAV_ACTION_SX = {
|
|
20
|
-
minWidth: 0,
|
|
21
|
-
maxWidth: 'none',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export function MobileBottomNav({
|
|
25
|
-
destinations,
|
|
26
|
-
activeRoute,
|
|
27
|
-
onNavigate,
|
|
28
|
-
hideAbove = 'md',
|
|
29
|
-
zIndex = defaultZIndex,
|
|
30
|
-
sx = {},
|
|
31
|
-
}) {
|
|
32
|
-
const theme = useTheme();
|
|
33
|
-
const isHidden = useMediaQuery(theme.breakpoints.up(hideAbove));
|
|
34
|
-
const callerSx = Array.isArray(sx) ? sx : [sx];
|
|
35
|
-
|
|
36
|
-
if (isHidden) return null;
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<BottomNavigation
|
|
40
|
-
value={activeRoute}
|
|
41
|
-
onChange={(_, route) => onNavigate(route)}
|
|
42
|
-
showLabels
|
|
43
|
-
sx={[
|
|
44
|
-
{ ...MOBILE_BOTTOM_NAV_ROOT_SX, zIndex },
|
|
45
|
-
...callerSx,
|
|
46
|
-
]}
|
|
47
|
-
>
|
|
48
|
-
{destinations.map((destination) => {
|
|
49
|
-
const Icon = destination.icon;
|
|
50
|
-
const selected = activeRoute === destination.route;
|
|
51
|
-
const icon = (
|
|
52
|
-
<Icon
|
|
53
|
-
sx={destination.emphasis ? {
|
|
54
|
-
p: 0.8,
|
|
55
|
-
borderRadius: '50%',
|
|
56
|
-
backgroundColor: selected ? 'primary.main' : 'background.paper',
|
|
57
|
-
color: selected ? 'primary.contrastText' : 'primary.main',
|
|
58
|
-
boxShadow: 'none',
|
|
59
|
-
transform: 'translateY(-4px)',
|
|
60
|
-
} : undefined}
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<BottomNavigationAction
|
|
66
|
-
key={destination.route}
|
|
67
|
-
value={destination.route}
|
|
68
|
-
label={destination.shortLabel ?? destination.label}
|
|
69
|
-
aria-label={destination.shortLabel != null ? destination.label : undefined}
|
|
70
|
-
aria-current={selected ? 'page' : undefined}
|
|
71
|
-
sx={MOBILE_BOTTOM_NAV_ACTION_SX}
|
|
72
|
-
icon={destination.badgeCount ? (
|
|
73
|
-
<Badge badgeContent={destination.badgeCount} color="error" max={99}>
|
|
74
|
-
{icon}
|
|
75
|
-
</Badge>
|
|
76
|
-
) : icon}
|
|
77
|
-
/>
|
|
78
|
-
);
|
|
79
|
-
})}
|
|
80
|
-
</BottomNavigation>
|
|
81
|
-
);
|
|
82
|
-
}
|