@mesob/auth-react 0.4.0 → 0.4.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/dist/chunk-35TCGAW3.js +98 -0
- package/dist/chunk-35TCGAW3.js.map +1 -0
- package/dist/chunk-3BZC4VVD.js +36 -0
- package/dist/chunk-3BZC4VVD.js.map +1 -0
- package/dist/chunk-45UCLKH2.js +188 -0
- package/dist/chunk-45UCLKH2.js.map +1 -0
- package/dist/chunk-55BMNC4S.js +115 -0
- package/dist/chunk-55BMNC4S.js.map +1 -0
- package/dist/chunk-5F5FZMHE.js +94 -0
- package/dist/chunk-5F5FZMHE.js.map +1 -0
- package/dist/chunk-5M7I7WNH.js +31 -0
- package/dist/chunk-5M7I7WNH.js.map +1 -0
- package/dist/chunk-72YRO3A7.js +288 -0
- package/dist/chunk-72YRO3A7.js.map +1 -0
- package/dist/chunk-7KXTL6NT.js +48 -0
- package/dist/chunk-7KXTL6NT.js.map +1 -0
- package/dist/chunk-AIMD6R6U.js +466 -0
- package/dist/chunk-AIMD6R6U.js.map +1 -0
- package/dist/chunk-BGSHXIHI.js +953 -0
- package/dist/chunk-BGSHXIHI.js.map +1 -0
- package/dist/chunk-BZ42QPXE.js +271 -0
- package/dist/chunk-BZ42QPXE.js.map +1 -0
- package/dist/chunk-C26NPUPI.js +272 -0
- package/dist/chunk-C26NPUPI.js.map +1 -0
- package/dist/chunk-C2KFZ57H.js +194 -0
- package/dist/chunk-C2KFZ57H.js.map +1 -0
- package/dist/chunk-C5ZW7FD2.js +46 -0
- package/dist/chunk-C5ZW7FD2.js.map +1 -0
- package/dist/chunk-DPH2PHK3.js +32 -0
- package/dist/chunk-DPH2PHK3.js.map +1 -0
- package/dist/chunk-EQ4346FE.js +139 -0
- package/dist/chunk-EQ4346FE.js.map +1 -0
- package/dist/chunk-FAHN63DA.js +535 -0
- package/dist/chunk-FAHN63DA.js.map +1 -0
- package/dist/chunk-FBABIA5J.js +345 -0
- package/dist/chunk-FBABIA5J.js.map +1 -0
- package/dist/chunk-FFR5UHTS.js +99 -0
- package/dist/chunk-FFR5UHTS.js.map +1 -0
- package/dist/chunk-FHOLUOOZ.js +164 -0
- package/dist/chunk-FHOLUOOZ.js.map +1 -0
- package/dist/chunk-G2AW2H36.js +11 -0
- package/dist/chunk-G2AW2H36.js.map +1 -0
- package/dist/chunk-G7SCXCCM.js +89 -0
- package/dist/chunk-G7SCXCCM.js.map +1 -0
- package/dist/chunk-GP7GIUI3.js +64 -0
- package/dist/chunk-GP7GIUI3.js.map +1 -0
- package/dist/chunk-GRT6EBR6.js +93 -0
- package/dist/chunk-GRT6EBR6.js.map +1 -0
- package/dist/chunk-GXKBVCVS.js +102 -0
- package/dist/chunk-GXKBVCVS.js.map +1 -0
- package/dist/chunk-HOO2VLNM.js +305 -0
- package/dist/chunk-HOO2VLNM.js.map +1 -0
- package/dist/chunk-II5MLBSB.js +183 -0
- package/dist/chunk-II5MLBSB.js.map +1 -0
- package/dist/chunk-ISNNPMF7.js +95 -0
- package/dist/chunk-ISNNPMF7.js.map +1 -0
- package/dist/chunk-JB6XVST4.js +141 -0
- package/dist/chunk-JB6XVST4.js.map +1 -0
- package/dist/chunk-JUHBVG5Q.js +303 -0
- package/dist/chunk-JUHBVG5Q.js.map +1 -0
- package/dist/chunk-JZZJCBAE.js +118 -0
- package/dist/chunk-JZZJCBAE.js.map +1 -0
- package/dist/chunk-KWG4DSB5.js +55 -0
- package/dist/chunk-KWG4DSB5.js.map +1 -0
- package/dist/chunk-L4CGIO2I.js +265 -0
- package/dist/chunk-L4CGIO2I.js.map +1 -0
- package/dist/chunk-LNG736CV.js +19 -0
- package/dist/chunk-LNG736CV.js.map +1 -0
- package/dist/chunk-LSYKVFJA.js +98 -0
- package/dist/chunk-LSYKVFJA.js.map +1 -0
- package/dist/chunk-LZR4YUDV.js +107 -0
- package/dist/chunk-LZR4YUDV.js.map +1 -0
- package/dist/chunk-MELNS4QH.js +255 -0
- package/dist/chunk-MELNS4QH.js.map +1 -0
- package/dist/chunk-MS2JUZ3N.js +94 -0
- package/dist/chunk-MS2JUZ3N.js.map +1 -0
- package/dist/chunk-NEO72TMH.js +32 -0
- package/dist/chunk-NEO72TMH.js.map +1 -0
- package/dist/chunk-NJPNTAAT.js +68 -0
- package/dist/chunk-NJPNTAAT.js.map +1 -0
- package/dist/chunk-NPW7D2HZ.js +16 -0
- package/dist/chunk-NPW7D2HZ.js.map +1 -0
- package/dist/chunk-OAN4EXU4.js +310 -0
- package/dist/chunk-OAN4EXU4.js.map +1 -0
- package/dist/chunk-OFLSINVU.js +138 -0
- package/dist/chunk-OFLSINVU.js.map +1 -0
- package/dist/chunk-OHIIMUQC.js +286 -0
- package/dist/chunk-OHIIMUQC.js.map +1 -0
- package/dist/chunk-OQGJX37L.js +239 -0
- package/dist/chunk-OQGJX37L.js.map +1 -0
- package/dist/chunk-OYHH7HQG.js +65 -0
- package/dist/chunk-OYHH7HQG.js.map +1 -0
- package/dist/chunk-PSRIZMWJ.js +486 -0
- package/dist/chunk-PSRIZMWJ.js.map +1 -0
- package/dist/chunk-QNCE2B5O.js +23 -0
- package/dist/chunk-QNCE2B5O.js.map +1 -0
- package/dist/chunk-RLPZFLAS.js +23 -0
- package/dist/chunk-RLPZFLAS.js.map +1 -0
- package/dist/chunk-RT5C7IAE.js +38 -0
- package/dist/chunk-RT5C7IAE.js.map +1 -0
- package/dist/chunk-S3CXCCKL.js +272 -0
- package/dist/chunk-S3CXCCKL.js.map +1 -0
- package/dist/chunk-SOCZK4CV.js +69 -0
- package/dist/chunk-SOCZK4CV.js.map +1 -0
- package/dist/chunk-T6P7UHVP.js +34 -0
- package/dist/chunk-T6P7UHVP.js.map +1 -0
- package/dist/chunk-TFVBER3Y.js +52 -0
- package/dist/chunk-TFVBER3Y.js.map +1 -0
- package/dist/chunk-UXOZ2TME.js +104 -0
- package/dist/chunk-UXOZ2TME.js.map +1 -0
- package/dist/chunk-V2W3WPCZ.js +22 -0
- package/dist/chunk-V2W3WPCZ.js.map +1 -0
- package/dist/chunk-YZ264S2L.js +286 -0
- package/dist/chunk-YZ264S2L.js.map +1 -0
- package/dist/chunk-ZESFGO3K.js +28 -0
- package/dist/chunk-ZESFGO3K.js.map +1 -0
- package/dist/chunk-ZG6WFZHX.js +143 -0
- package/dist/chunk-ZG6WFZHX.js.map +1 -0
- package/dist/components/auth/auth-card.d.ts +3 -6
- package/dist/components/auth/auth-card.js +3 -7
- package/dist/components/auth/auth-card.js.map +1 -1
- package/dist/components/auth/auth-layout.d.ts +3 -6
- package/dist/components/auth/auth-layout.js +3 -28
- package/dist/components/auth/auth-layout.js.map +1 -1
- package/dist/components/auth/countdown.d.ts +2 -5
- package/dist/components/auth/countdown.js +5 -130
- package/dist/components/auth/countdown.js.map +1 -1
- package/dist/components/auth/forgot-password.d.ts +1 -5
- package/dist/components/auth/forgot-password.js +6 -365
- package/dist/components/auth/forgot-password.js.map +1 -1
- package/dist/components/auth/reset-password-form.d.ts +2 -5
- package/dist/components/auth/reset-password-form.js +6 -487
- package/dist/components/auth/reset-password-form.js.map +1 -1
- package/dist/components/auth/set-password.d.ts +2 -5
- package/dist/components/auth/set-password.js +7 -521
- package/dist/components/auth/set-password.js.map +1 -1
- package/dist/components/auth/sign-in.d.ts +2 -5
- package/dist/components/auth/sign-in.js +7 -561
- package/dist/components/auth/sign-in.js.map +1 -1
- package/dist/components/auth/sign-up.d.ts +2 -5
- package/dist/components/auth/sign-up.js +6 -511
- package/dist/components/auth/sign-up.js.map +1 -1
- package/dist/components/auth/verification-form.d.ts +13 -2
- package/dist/components/auth/verification-form.js +5 -217
- package/dist/components/auth/verification-form.js.map +1 -1
- package/dist/components/auth/verify-email.d.ts +2 -5
- package/dist/components/auth/verify-email.js +8 -527
- package/dist/components/auth/verify-email.js.map +1 -1
- package/dist/components/auth/verify-phone.d.ts +2 -5
- package/dist/components/auth/verify-phone.js +8 -532
- package/dist/components/auth/verify-phone.js.map +1 -1
- package/dist/components/authorization/deny.d.ts +3 -6
- package/dist/components/authorization/deny.js +4 -47
- package/dist/components/authorization/deny.js.map +1 -1
- package/dist/components/authorization/grant.d.ts +3 -6
- package/dist/components/authorization/grant.js +4 -52
- package/dist/components/authorization/grant.js.map +1 -1
- package/dist/components/error-boundary.d.ts +6 -10
- package/dist/components/error-boundary.js +4 -43
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/iam/permission-selector.d.ts +3 -6
- package/dist/components/iam/permission-selector.js +3 -116
- package/dist/components/iam/permission-selector.js.map +1 -1
- package/dist/components/iam/permissions-page.d.ts +1 -0
- package/dist/components/iam/permissions-page.js +10 -0
- package/dist/components/iam/permissions-page.js.map +1 -0
- package/dist/components/iam/permissions.d.ts +1 -5
- package/dist/components/iam/permissions.js +5 -198
- package/dist/components/iam/permissions.js.map +1 -1
- package/dist/components/iam/role-detail-layout.d.ts +3 -6
- package/dist/components/iam/role-detail-layout.js +3 -131
- package/dist/components/iam/role-detail-layout.js.map +1 -1
- package/dist/components/iam/role-detail-page.d.ts +2 -5
- package/dist/components/iam/role-detail-page.js +3 -223
- package/dist/components/iam/role-detail-page.js.map +1 -1
- package/dist/components/iam/role-permissions-page.d.ts +2 -5
- package/dist/components/iam/role-permissions-page.js +4 -391
- package/dist/components/iam/role-permissions-page.js.map +1 -1
- package/dist/components/iam/roles-page.d.ts +1 -0
- package/dist/components/iam/roles-page.js +13 -0
- package/dist/components/iam/roles-page.js.map +1 -0
- package/dist/components/iam/roles.d.ts +1 -5
- package/dist/components/iam/roles.js +5 -218
- package/dist/components/iam/roles.js.map +1 -1
- package/dist/components/iam/sessions-page.d.ts +1 -0
- package/dist/components/iam/sessions-page.js +12 -0
- package/dist/components/iam/sessions-page.js.map +1 -0
- package/dist/components/iam/sessions.d.ts +1 -5
- package/dist/components/iam/sessions.js +5 -198
- package/dist/components/iam/sessions.js.map +1 -1
- package/dist/components/iam/tenants-page.d.ts +1 -0
- package/dist/components/iam/tenants-page.js +13 -0
- package/dist/components/iam/tenants-page.js.map +1 -0
- package/dist/components/iam/tenants.d.ts +1 -5
- package/dist/components/iam/tenants.js +5 -204
- package/dist/components/iam/tenants.js.map +1 -1
- package/dist/components/iam/users-page.d.ts +1 -0
- package/dist/components/iam/users-page.js +13 -0
- package/dist/components/iam/users-page.js.map +1 -0
- package/dist/components/iam/users.d.ts +1 -5
- package/dist/components/iam/users.js +5 -207
- package/dist/components/iam/users.js.map +1 -1
- package/dist/components/profile/account.d.ts +1 -5
- package/dist/components/profile/account.js +4 -151
- package/dist/components/profile/account.js.map +1 -1
- package/dist/components/profile/change-email-form.d.ts +1 -5
- package/dist/components/profile/change-email-form.js +9 -735
- package/dist/components/profile/change-email-form.js.map +1 -1
- package/dist/components/profile/change-password-form.d.ts +1 -5
- package/dist/components/profile/change-password-form.js +3 -262
- package/dist/components/profile/change-password-form.js.map +1 -1
- package/dist/components/profile/change-phone-form.d.ts +1 -5
- package/dist/components/profile/change-phone-form.js +10 -772
- package/dist/components/profile/change-phone-form.js.map +1 -1
- package/dist/components/profile/change-profile.d.ts +3 -7
- package/dist/components/profile/change-profile.js +2 -40
- package/dist/components/profile/change-profile.js.map +1 -1
- package/dist/components/profile/otp-verification-modal.d.ts +2 -5
- package/dist/components/profile/otp-verification-modal.js +6 -266
- package/dist/components/profile/otp-verification-modal.js.map +1 -1
- package/dist/components/profile/profile-layout.d.ts +4 -0
- package/dist/components/profile/profile-layout.js +10 -0
- package/dist/components/profile/profile-layout.js.map +1 -0
- package/dist/components/profile/request-change-email-form.d.ts +2 -5
- package/dist/components/profile/request-change-email-form.js +4 -285
- package/dist/components/profile/request-change-email-form.js.map +1 -1
- package/dist/components/profile/request-change-phone-form.d.ts +2 -5
- package/dist/components/profile/request-change-phone-form.js +5 -323
- package/dist/components/profile/request-change-phone-form.js.map +1 -1
- package/dist/components/profile/security.d.ts +1 -5
- package/dist/components/profile/security.js +15 -1508
- package/dist/components/profile/security.js.map +1 -1
- package/dist/components/profile/verify-change-email-form.d.ts +2 -5
- package/dist/components/profile/verify-change-email-form.js +7 -407
- package/dist/components/profile/verify-change-email-form.js.map +1 -1
- package/dist/components/profile/verify-change-phone-form.d.ts +2 -5
- package/dist/components/profile/verify-change-phone-form.js +7 -411
- package/dist/components/profile/verify-change-phone-form.js.map +1 -1
- package/dist/components/shared/data-table.d.ts +5 -8
- package/dist/components/shared/data-table.js +3 -79
- package/dist/components/shared/data-table.js.map +1 -1
- package/dist/components/skeletons/auth-form-skeleton.d.ts +1 -5
- package/dist/components/skeletons/auth-form-skeleton.js +3 -27
- package/dist/components/skeletons/auth-form-skeleton.js.map +1 -1
- package/dist/components/skeletons/profile-skeleton.d.ts +1 -5
- package/dist/components/skeletons/profile-skeleton.js +3 -28
- package/dist/components/skeletons/profile-skeleton.js.map +1 -1
- package/dist/components/skeletons/table-skeleton.d.ts +2 -5
- package/dist/components/skeletons/table-skeleton.js +3 -34
- package/dist/components/skeletons/table-skeleton.js.map +1 -1
- package/dist/constants/auth.error.codes.d.ts +5 -0
- package/dist/hooks/use-session-cookie-name.d.ts +1 -0
- package/dist/hooks/use-translator.d.ts +1 -0
- package/dist/index.d.ts +50 -92
- package/dist/index.js +147 -4936
- package/dist/index.js.map +1 -1
- package/dist/lib/query-options.d.ts +10 -0
- package/dist/lib/translations.d.ts +3 -0
- package/dist/pages/auth/forgot-password.d.ts +3 -7
- package/dist/pages/auth/forgot-password.js +8 -770
- package/dist/pages/auth/forgot-password.js.map +1 -1
- package/dist/pages/auth/layout.d.ts +3 -7
- package/dist/pages/auth/layout.js +13 -536
- package/dist/pages/auth/layout.js.map +1 -1
- package/dist/pages/auth/reset-password.d.ts +4 -7
- package/dist/pages/auth/reset-password.js +8 -888
- package/dist/pages/auth/reset-password.js.map +1 -1
- package/dist/pages/auth/set-password.d.ts +4 -7
- package/dist/pages/auth/set-password.js +9 -927
- package/dist/pages/auth/set-password.js.map +1 -1
- package/dist/pages/auth/sign-in.d.ts +4 -7
- package/dist/pages/auth/sign-in.js +9 -967
- package/dist/pages/auth/sign-in.js.map +1 -1
- package/dist/pages/auth/sign-up.d.ts +4 -7
- package/dist/pages/auth/sign-up.js +8 -915
- package/dist/pages/auth/sign-up.js.map +1 -1
- package/dist/pages/auth/verify-email.d.ts +4 -7
- package/dist/pages/auth/verify-email.js +10 -922
- package/dist/pages/auth/verify-email.js.map +1 -1
- package/dist/pages/auth/verify-phone.d.ts +4 -7
- package/dist/pages/auth/verify-phone.js +10 -927
- package/dist/pages/auth/verify-phone.js.map +1 -1
- package/dist/pages/iam/permissions/_components/permission-card.d.ts +6 -0
- package/dist/pages/iam/permissions/_components/permissions-data.d.ts +7 -0
- package/dist/pages/iam/permissions/_components/permissions-list.d.ts +14 -0
- package/dist/pages/iam/permissions.d.ts +1 -5
- package/dist/pages/iam/permissions.js +4 -302
- package/dist/pages/iam/permissions.js.map +1 -1
- package/dist/pages/iam/role-detail-layout.d.ts +3 -6
- package/dist/pages/iam/role-detail-layout.js +5 -132
- package/dist/pages/iam/role-detail-layout.js.map +1 -1
- package/dist/pages/iam/role-detail.d.ts +4 -7
- package/dist/pages/iam/role-detail.js +5 -224
- package/dist/pages/iam/role-detail.js.map +1 -1
- package/dist/pages/iam/role-permissions.d.ts +4 -7
- package/dist/pages/iam/role-permissions.js +6 -392
- package/dist/pages/iam/role-permissions.js.map +1 -1
- package/dist/pages/iam/role-users.d.ts +4 -7
- package/dist/pages/iam/role-users.js +9 -808
- package/dist/pages/iam/role-users.js.map +1 -1
- package/dist/pages/iam/roles/_components/role-card.d.ts +7 -0
- package/dist/pages/iam/roles/_components/role-form.d.ts +9 -0
- package/dist/pages/iam/roles/_components/role-selector.d.ts +11 -0
- package/dist/pages/iam/roles/_components/roles-data.d.ts +16 -0
- package/dist/pages/iam/roles/_components/roles-list.d.ts +15 -0
- package/dist/pages/iam/roles/users/_components/role-users-page.d.ts +5 -0
- package/dist/pages/iam/roles.d.ts +1 -5
- package/dist/pages/iam/roles.js +7 -678
- package/dist/pages/iam/roles.js.map +1 -1
- package/dist/pages/iam/sessions/_components/session-card.d.ts +6 -0
- package/dist/pages/iam/sessions/_components/sessions-data.d.ts +7 -0
- package/dist/pages/iam/sessions/_components/sessions-list.d.ts +14 -0
- package/dist/pages/iam/sessions.d.ts +1 -5
- package/dist/pages/iam/sessions.js +6 -309
- package/dist/pages/iam/sessions.js.map +1 -1
- package/dist/pages/iam/shared/navigation.d.ts +8 -0
- package/dist/pages/iam/shared/page-helpers.d.ts +12 -0
- package/dist/pages/iam/tenant-detail.d.ts +2 -5
- package/dist/pages/iam/tenant-detail.js +6 -174
- package/dist/pages/iam/tenant-detail.js.map +1 -1
- package/dist/pages/iam/tenants/_components/tenant-card.d.ts +6 -0
- package/dist/pages/iam/tenants/_components/tenant-form.d.ts +9 -0
- package/dist/pages/iam/tenants/_components/tenant-selector.d.ts +13 -0
- package/dist/pages/iam/tenants/_components/tenants-data.d.ts +12 -0
- package/dist/pages/iam/tenants/_components/tenants-list.d.ts +15 -0
- package/dist/pages/iam/tenants/tenant-detail-page-content.d.ts +5 -0
- package/dist/pages/iam/tenants.d.ts +1 -5
- package/dist/pages/iam/tenants.js +7 -604
- package/dist/pages/iam/tenants.js.map +1 -1
- package/dist/pages/iam/user-activity.d.ts +2 -5
- package/dist/pages/iam/user-activity.js +9 -838
- package/dist/pages/iam/user-activity.js.map +1 -1
- package/dist/pages/iam/user-detail-layout.d.ts +3 -6
- package/dist/pages/iam/user-detail-layout.js +5 -93
- package/dist/pages/iam/user-detail-layout.js.map +1 -1
- package/dist/pages/iam/user-detail.d.ts +2 -5
- package/dist/pages/iam/user-detail.js +5 -92
- package/dist/pages/iam/user-detail.js.map +1 -1
- package/dist/pages/iam/users/_components/bulk-invite-user-form.d.ts +6 -0
- package/dist/pages/iam/users/_components/invite-user-form.d.ts +6 -0
- package/dist/pages/iam/users/_components/invite-user-shared.d.ts +25 -0
- package/dist/pages/iam/users/_components/user-card.d.ts +6 -0
- package/dist/pages/iam/users/_components/user-detail-layout-content.d.ts +6 -0
- package/dist/pages/iam/users/_components/user-detail-page-content.d.ts +5 -0
- package/dist/pages/iam/users/_components/user-form.d.ts +9 -0
- package/dist/pages/iam/users/_components/user-selector.d.ts +12 -0
- package/dist/pages/iam/users/_components/users-data.d.ts +22 -0
- package/dist/pages/iam/users/_components/users-list.d.ts +15 -0
- package/dist/pages/iam/users/activity/_components/role-section.d.ts +3 -0
- package/dist/pages/iam/users/activity/user-activity-page-content.d.ts +5 -0
- package/dist/pages/iam/users.d.ts +1 -5
- package/dist/pages/iam/users.js +7 -1269
- package/dist/pages/iam/users.js.map +1 -1
- package/dist/pages/profile/_components/profile-sidebar.d.ts +1 -0
- package/dist/pages/profile/account.d.ts +1 -5
- package/dist/pages/profile/account.js +9 -158
- package/dist/pages/profile/account.js.map +1 -1
- package/dist/pages/profile/layout.d.ts +1 -8
- package/dist/pages/profile/layout.js +5 -128
- package/dist/pages/profile/layout.js.map +1 -1
- package/dist/pages/profile/security.d.ts +1 -5
- package/dist/pages/profile/security.js +20 -1515
- package/dist/pages/profile/security.js.map +1 -1
- package/dist/provider.d.ts +53 -0
- package/dist/{types-g9QcNRxT.d.ts → types.d.ts} +33 -12
- package/dist/utils/cookie.d.ts +2 -0
- package/dist/utils/custom-fetch.d.ts +2 -0
- package/dist/utils/handle-error.d.ts +7 -0
- package/dist/utils/normalize-phone.d.ts +1 -0
- package/package.json +4 -4
- package/dist/verification-form-ipSRTtQB.d.ts +0 -22
|
@@ -1,566 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
// src/components/auth/sign-in.tsx
|
|
4
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
5
2
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
FormItem,
|
|
14
|
-
FormLabel,
|
|
15
|
-
FormMessage,
|
|
16
|
-
Input,
|
|
17
|
-
useFormField
|
|
18
|
-
} from "@mesob/ui/components";
|
|
19
|
-
import { useMesob as useMesob2 } from "@mesob/ui/providers";
|
|
20
|
-
import { IconAlertCircle, IconEye, IconEyeOff } from "@tabler/icons-react";
|
|
21
|
-
import { useEffect, useState as useState2 } from "react";
|
|
22
|
-
import { useForm } from "react-hook-form";
|
|
23
|
-
import { toast } from "sonner";
|
|
24
|
-
import { z } from "zod";
|
|
25
|
-
|
|
26
|
-
// src/hooks/use-translator.ts
|
|
27
|
-
import { useMesob } from "@mesob/ui/providers";
|
|
28
|
-
|
|
29
|
-
// src/lib/translations.ts
|
|
30
|
-
function createTranslator(messages, namespace) {
|
|
31
|
-
return (key, params) => {
|
|
32
|
-
const fullKey = namespace ? `${namespace}.${key}` : key;
|
|
33
|
-
const keys = fullKey.split(".");
|
|
34
|
-
let value = messages;
|
|
35
|
-
for (const k of keys) {
|
|
36
|
-
if (value && typeof value === "object" && value !== null) {
|
|
37
|
-
value = value[k];
|
|
38
|
-
} else {
|
|
39
|
-
return fullKey;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (typeof value !== "string") {
|
|
43
|
-
return fullKey;
|
|
44
|
-
}
|
|
45
|
-
if (params) {
|
|
46
|
-
return value.replace(
|
|
47
|
-
/\{(\w+)\}/g,
|
|
48
|
-
(_, param) => String(params[param] ?? `{${param}}`)
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
return value;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// src/provider.tsx
|
|
56
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
57
|
-
import { deepmerge } from "deepmerge-ts";
|
|
58
|
-
import createFetchClient from "openapi-fetch";
|
|
59
|
-
import createClient from "openapi-react-query";
|
|
60
|
-
import { createContext, useContext, useMemo, useState } from "react";
|
|
61
|
-
|
|
62
|
-
// src/utils/cookie.ts
|
|
63
|
-
var isProduction = typeof process !== "undefined" && process.env.NODE_ENV === "production";
|
|
64
|
-
|
|
65
|
-
// src/provider.tsx
|
|
66
|
-
import { jsx } from "react/jsx-runtime";
|
|
67
|
-
var SessionContext = createContext(null);
|
|
68
|
-
var ApiContext = createContext(null);
|
|
69
|
-
var ConfigContext = createContext(null);
|
|
70
|
-
var queryClient = new QueryClient({
|
|
71
|
-
defaultOptions: {
|
|
72
|
-
queries: {
|
|
73
|
-
refetchOnWindowFocus: false
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
function useApi() {
|
|
78
|
-
const context = useContext(ApiContext);
|
|
79
|
-
if (!context) {
|
|
80
|
-
throw new Error("useApi must be used within MesobAuthProvider");
|
|
81
|
-
}
|
|
82
|
-
return context;
|
|
83
|
-
}
|
|
84
|
-
function useConfig() {
|
|
85
|
-
const context = useContext(ConfigContext);
|
|
86
|
-
if (!context) {
|
|
87
|
-
throw new Error("useConfig must be used within MesobAuthProvider");
|
|
88
|
-
}
|
|
89
|
-
return context;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// src/hooks/use-translator.ts
|
|
93
|
-
function useTranslator(namespace) {
|
|
94
|
-
const mesob = useMesob();
|
|
95
|
-
const { config } = useConfig();
|
|
96
|
-
if (mesob?.t) {
|
|
97
|
-
return (key, params) => {
|
|
98
|
-
const fullKey = namespace ? `${namespace}.${key}` : key;
|
|
99
|
-
return mesob.t?.(fullKey, params) ?? fullKey;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
return createTranslator(config.messages || {}, namespace);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// src/constants/auth.error.codes.ts
|
|
106
|
-
var AUTH_ERROR_MAPPING = {
|
|
107
|
-
USER_NOT_FOUND: {
|
|
108
|
-
title: "Account Not Found",
|
|
109
|
-
description: "We could not find an account with that identifier. Please check your spelling or sign up."
|
|
110
|
-
},
|
|
111
|
-
INVALID_PASSWORD: {
|
|
112
|
-
title: "Invalid Password",
|
|
113
|
-
description: "The password you entered is incorrect. Please try again."
|
|
114
|
-
},
|
|
115
|
-
USER_EXISTS: {
|
|
116
|
-
title: "Account Already Exists",
|
|
117
|
-
description: "An account with this identifier already exists. Please sign in instead."
|
|
118
|
-
},
|
|
119
|
-
VERIFICATION_EXPIRED: {
|
|
120
|
-
title: "Verification Expired",
|
|
121
|
-
description: "The verification code or link has expired. Please request a new one."
|
|
122
|
-
},
|
|
123
|
-
VERIFICATION_MISMATCH: {
|
|
124
|
-
title: "Invalid Code",
|
|
125
|
-
description: "The verification code you entered is invalid. Please double-check and try again."
|
|
126
|
-
},
|
|
127
|
-
VERIFICATION_NOT_FOUND: {
|
|
128
|
-
title: "Verification Not Found",
|
|
129
|
-
description: "We could not find a pending verification request. Please restart the process."
|
|
130
|
-
},
|
|
131
|
-
TOO_MANY_ATTEMPTS: {
|
|
132
|
-
title: "Too Many Attempts",
|
|
133
|
-
description: "You have made too many requests recently. Please wait a moment before trying again."
|
|
134
|
-
},
|
|
135
|
-
REQUIRES_VERIFICATION: {
|
|
136
|
-
title: "Verification Required",
|
|
137
|
-
description: "You need to verify your account before you can continue. Please check your email or phone."
|
|
138
|
-
},
|
|
139
|
-
UNAUTHORIZED: {
|
|
140
|
-
title: "Unauthorized",
|
|
141
|
-
description: "You are not authorized to perform this action. Please sign in again."
|
|
142
|
-
},
|
|
143
|
-
ACCESS_DENIED: {
|
|
144
|
-
title: "Access Denied",
|
|
145
|
-
description: "You do not have permission to access this resource. Please contact support if you believe this is an error."
|
|
146
|
-
},
|
|
147
|
-
HAS_NO_PASSWORD: {
|
|
148
|
-
title: "No Password Set",
|
|
149
|
-
description: "Your account does not have a password yet. Continue to set a password before signing in."
|
|
150
|
-
},
|
|
151
|
-
PASSWORD_ALREADY_SET: {
|
|
152
|
-
title: "Password Already Set",
|
|
153
|
-
description: "This account already has a password. Use the normal sign-in form instead."
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
var validCodes = Object.keys(AUTH_ERROR_MAPPING);
|
|
157
|
-
|
|
158
|
-
// src/utils/handle-error.ts
|
|
159
|
-
function isAuthError(err) {
|
|
160
|
-
return typeof err === "object" && err !== null && "message" in err && typeof err.message === "string";
|
|
161
|
-
}
|
|
162
|
-
function extractErrorCode(err) {
|
|
163
|
-
if (err.code && validCodes.includes(err.code)) {
|
|
164
|
-
return err.code;
|
|
165
|
-
}
|
|
166
|
-
if (err.message) {
|
|
167
|
-
const messageUpper = err.message.toUpperCase().trim();
|
|
168
|
-
if (validCodes.includes(messageUpper)) {
|
|
169
|
-
return messageUpper;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return "";
|
|
173
|
-
}
|
|
174
|
-
function sanitizeErrorMessage(message) {
|
|
175
|
-
const lowerMessage = message.toLowerCase();
|
|
176
|
-
const isDatabaseError = lowerMessage.includes("failed query") || lowerMessage.includes("select") || lowerMessage.includes("insert") || lowerMessage.includes("update") || lowerMessage.includes("delete") || lowerMessage.includes("from") || lowerMessage.includes("where") || lowerMessage.includes("limit") || lowerMessage.includes("params:") || lowerMessage.includes("query") || message.includes('"iam".') || message.includes('"tenants"') || message.includes('"users"') || message.includes('"sessions"') || message.includes('"accounts"') || lowerMessage.includes("relation") || lowerMessage.includes("column") || lowerMessage.includes("syntax error") || lowerMessage.includes("database") || lowerMessage.includes("postgres") || lowerMessage.includes("sql");
|
|
177
|
-
if (isDatabaseError) {
|
|
178
|
-
return "An error occurred while processing your request";
|
|
179
|
-
}
|
|
180
|
-
return message;
|
|
181
|
-
}
|
|
182
|
-
function handleAuthError(err, setError, t) {
|
|
183
|
-
const errorCode = extractErrorCode(err);
|
|
184
|
-
if (errorCode && AUTH_ERROR_MAPPING[errorCode]) {
|
|
185
|
-
const mapping = AUTH_ERROR_MAPPING[errorCode];
|
|
186
|
-
setError({
|
|
187
|
-
title: mapping.title,
|
|
188
|
-
description: mapping.description
|
|
189
|
-
});
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
const sanitizedMessage = sanitizeErrorMessage(
|
|
193
|
-
err.message || t("errors.fallback")
|
|
194
|
-
);
|
|
195
|
-
setError({
|
|
196
|
-
title: t("errors.fallback"),
|
|
197
|
-
description: sanitizedMessage
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
function handleGenericError(err, setError, t) {
|
|
201
|
-
const rawMessage = err instanceof Error ? err.message : t("errors.fallback");
|
|
202
|
-
const sanitizedMessage = sanitizeErrorMessage(rawMessage);
|
|
203
|
-
setError({
|
|
204
|
-
title: "Error",
|
|
205
|
-
description: sanitizedMessage
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
var handleError = (err, setError, t) => {
|
|
209
|
-
if (isAuthError(err)) {
|
|
210
|
-
handleAuthError(err, setError, t);
|
|
211
|
-
} else {
|
|
212
|
-
handleGenericError(err, setError, t);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
// src/utils/normalize-phone.ts
|
|
217
|
-
function normalizePhone(phone) {
|
|
218
|
-
const cleaned = phone.trim().replace(/\s/g, "");
|
|
219
|
-
if (cleaned.startsWith("+2519") || cleaned.startsWith("+2517")) {
|
|
220
|
-
return cleaned;
|
|
221
|
-
}
|
|
222
|
-
if (cleaned.startsWith("2519") || cleaned.startsWith("2517")) {
|
|
223
|
-
return `+${cleaned}`;
|
|
224
|
-
}
|
|
225
|
-
if (cleaned.startsWith("09") || cleaned.startsWith("07")) {
|
|
226
|
-
return `+251${cleaned.slice(1)}`;
|
|
227
|
-
}
|
|
228
|
-
if ((cleaned.startsWith("9") || cleaned.startsWith("7")) && cleaned.length === 9) {
|
|
229
|
-
return `+251${cleaned}`;
|
|
230
|
-
}
|
|
231
|
-
return cleaned;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// src/components/auth/auth-layout.tsx
|
|
235
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
236
|
-
var AuthLayout = ({
|
|
237
|
-
title,
|
|
238
|
-
description,
|
|
239
|
-
children,
|
|
240
|
-
footer,
|
|
241
|
-
logoImage
|
|
242
|
-
}) => {
|
|
243
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
244
|
-
/* @__PURE__ */ jsx2("div", { className: "flex size-8 mb-6 w-full items-center justify-center rounded-md", children: /* @__PURE__ */ jsx2(
|
|
245
|
-
"img",
|
|
246
|
-
{
|
|
247
|
-
src: logoImage || "",
|
|
248
|
-
alt: title,
|
|
249
|
-
width: 42,
|
|
250
|
-
height: 42
|
|
251
|
-
}
|
|
252
|
-
) }),
|
|
253
|
-
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
254
|
-
/* @__PURE__ */ jsx2("h1", { className: "text-2xl font-bold tracking-tight", children: title }),
|
|
255
|
-
description && /* @__PURE__ */ jsx2("p", { className: "mt-2 text-sm text-muted-foreground", children: description })
|
|
256
|
-
] }),
|
|
257
|
-
children,
|
|
258
|
-
footer && /* @__PURE__ */ jsx2("div", { className: "mt-2 w-full", children: /* @__PURE__ */ jsx2("div", { className: "w-full text-center text-sm text-muted-foreground", children: footer }) })
|
|
259
|
-
] });
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
// src/components/auth/sign-in.tsx
|
|
263
|
-
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
264
|
-
var isPhone = (s) => /^\+?[0-9()[\]\s-]{6,}$/.test(s);
|
|
265
|
-
function PasswordInput({ field, show, onToggle }) {
|
|
266
|
-
const { formItemId, error } = useFormField();
|
|
267
|
-
return /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
|
|
268
|
-
/* @__PURE__ */ jsx3(
|
|
269
|
-
Input,
|
|
270
|
-
{
|
|
271
|
-
...field,
|
|
272
|
-
id: formItemId,
|
|
273
|
-
type: show ? "text" : "password",
|
|
274
|
-
autoComplete: "current-password",
|
|
275
|
-
"aria-invalid": !!error,
|
|
276
|
-
className: "pr-10"
|
|
277
|
-
}
|
|
278
|
-
),
|
|
279
|
-
/* @__PURE__ */ jsx3(
|
|
280
|
-
Button,
|
|
281
|
-
{
|
|
282
|
-
type: "button",
|
|
283
|
-
variant: "ghost",
|
|
284
|
-
size: "icon",
|
|
285
|
-
className: "absolute right-0 top-0 h-full px-3 text-muted-foreground hover:text-foreground",
|
|
286
|
-
onClick: onToggle,
|
|
287
|
-
"aria-label": show ? "Hide password" : "Show password",
|
|
288
|
-
children: show ? /* @__PURE__ */ jsx3(IconEyeOff, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx3(IconEye, { className: "h-4 w-4" })
|
|
289
|
-
}
|
|
290
|
-
)
|
|
291
|
-
] });
|
|
292
|
-
}
|
|
293
|
-
var signInSchema = (t, phoneRegex) => z.object({
|
|
294
|
-
username: z.string().trim().min(1, { message: t("errors.requiredField") }).refine(
|
|
295
|
-
(val) => {
|
|
296
|
-
const isEmail = z.email().safeParse(val).success;
|
|
297
|
-
const isPhone2 = phoneRegex.test(val);
|
|
298
|
-
return isEmail || isPhone2;
|
|
299
|
-
},
|
|
300
|
-
{ message: t("errors.invalidEmailOrPhone") }
|
|
301
|
-
),
|
|
302
|
-
password: z.union([
|
|
303
|
-
z.literal(""),
|
|
304
|
-
z.string().min(8, t("errors.passwordLength")).max(128, t("errors.longPasswordError"))
|
|
305
|
-
]).optional()
|
|
306
|
-
});
|
|
307
|
-
var SignIn = ({ redirectUrl } = {}) => {
|
|
308
|
-
const { hooks, setAuth } = useApi();
|
|
309
|
-
const { config } = useConfig();
|
|
310
|
-
const mesob = useMesob2();
|
|
311
|
-
const t = useTranslator("Auth.signIn");
|
|
312
|
-
const Link = mesob?.navigation?.Link;
|
|
313
|
-
const [isLoading, setIsLoading] = useState2(false);
|
|
314
|
-
const [error, setError] = useState2(null);
|
|
315
|
-
const [showPasswordField, setShowPasswordField] = useState2(false);
|
|
316
|
-
const [showPassword, setShowPassword] = useState2(false);
|
|
317
|
-
const [username, setUsername] = useState2("");
|
|
318
|
-
const [isChecking, setIsChecking] = useState2(false);
|
|
319
|
-
const checkUserMutation = hooks.useMutation("post", "/check-account");
|
|
320
|
-
const signInMutation = hooks.useMutation("post", "/sign-in");
|
|
321
|
-
const phoneRegex = typeof config.phoneRegex === "string" ? new RegExp(config.phoneRegex) : config.phoneRegex || /^(\+2519|\+2517|2519|2517|09|07)\d{8}$/;
|
|
322
|
-
const defaultRedirect = redirectUrl || config.navigation?.defaultRedirectUrl || "/dashboard";
|
|
323
|
-
const forgotPasswordLink = config.navigation?.links?.forgotPassword || "/auth/forgot-password";
|
|
324
|
-
const signUpLink = config.navigation?.links?.signUp || "/auth/sign-up";
|
|
325
|
-
const setPasswordLink = config.navigation?.links?.setPassword || "/auth/set-password";
|
|
326
|
-
const onNavigate = config.navigation?.onNavigate || ((path) => {
|
|
327
|
-
if (typeof window !== "undefined") {
|
|
328
|
-
window.location.href = path;
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
const logoImage = config.ui.logoImage;
|
|
332
|
-
const form = useForm({
|
|
333
|
-
resolver: zodResolver(signInSchema(t, phoneRegex)),
|
|
334
|
-
defaultValues: { username: "", password: "" },
|
|
335
|
-
mode: "onBlur"
|
|
336
|
-
});
|
|
337
|
-
useEffect(() => {
|
|
338
|
-
if (error) {
|
|
339
|
-
toast.error(error.title || "Error", {
|
|
340
|
-
description: error.description
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
}, [error]);
|
|
344
|
-
const handleCheckAccount = async (usernameValue) => {
|
|
345
|
-
setIsChecking(true);
|
|
346
|
-
try {
|
|
347
|
-
const normalizedUsername = phoneRegex.test(usernameValue) ? normalizePhone(usernameValue) : usernameValue;
|
|
348
|
-
const result = await checkUserMutation.mutateAsync({
|
|
349
|
-
body: {
|
|
350
|
-
username: normalizedUsername
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
if (result.exists) {
|
|
354
|
-
if (result.requiresPasswordSetup) {
|
|
355
|
-
const redirectParam = defaultRedirect ? `&redirect=${encodeURIComponent(defaultRedirect)}` : "";
|
|
356
|
-
onNavigate(
|
|
357
|
-
`${setPasswordLink}?identifier=${encodeURIComponent(normalizedUsername)}${redirectParam}`
|
|
358
|
-
);
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
setUsername(normalizedUsername);
|
|
362
|
-
form.setValue("username", normalizedUsername);
|
|
363
|
-
setShowPasswordField(true);
|
|
364
|
-
} else {
|
|
365
|
-
const email = isPhone(normalizedUsername) ? "" : normalizedUsername;
|
|
366
|
-
const redirectParam = defaultRedirect ? `&redirect=${encodeURIComponent(defaultRedirect)}` : "";
|
|
367
|
-
if (email) {
|
|
368
|
-
onNavigate(
|
|
369
|
-
`${signUpLink}?email=${encodeURIComponent(email)}${redirectParam}`
|
|
370
|
-
);
|
|
371
|
-
} else {
|
|
372
|
-
onNavigate(
|
|
373
|
-
`${signUpLink}?phone=${encodeURIComponent(normalizedUsername)}${redirectParam}`
|
|
374
|
-
);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
} catch {
|
|
378
|
-
form.setError("username", { message: t("errors.checkAccountFailed") });
|
|
379
|
-
} finally {
|
|
380
|
-
setIsChecking(false);
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
const onSubmit = async (values) => {
|
|
384
|
-
if (showPasswordField) {
|
|
385
|
-
const pwd = values.password;
|
|
386
|
-
if (!pwd || pwd.length < 8) {
|
|
387
|
-
form.setError("password", { message: t("errors.passwordLength") });
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
await handlePasswordSubmit({ password: pwd });
|
|
391
|
-
} else {
|
|
392
|
-
await handleCheckAccount(values.username);
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
const handlePasswordSubmit = async (values) => {
|
|
396
|
-
setIsLoading(true);
|
|
397
|
-
setError(null);
|
|
398
|
-
try {
|
|
399
|
-
const res = await signInMutation.mutateAsync({
|
|
400
|
-
body: {
|
|
401
|
-
identifier: username,
|
|
402
|
-
password: values.password
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
if ("verificationId" in res && res.verificationId) {
|
|
406
|
-
const redirectParam = defaultRedirect ? `&redirect=${encodeURIComponent(defaultRedirect)}` : "";
|
|
407
|
-
const verifyPath = isPhone(username) ? `/auth/verify-phone?context=sign-in&verificationId=${res.verificationId}&identifier=${encodeURIComponent(username)}${redirectParam}` : `/auth/verify-email?verificationId=${res.verificationId}${redirectParam}`;
|
|
408
|
-
onNavigate(verifyPath);
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
if ("user" in res && "session" in res) {
|
|
412
|
-
setAuth(res);
|
|
413
|
-
}
|
|
414
|
-
onNavigate(defaultRedirect);
|
|
415
|
-
} catch (err) {
|
|
416
|
-
const authError = err;
|
|
417
|
-
const errorCode = authError.code || authError.message;
|
|
418
|
-
if (errorCode === "HAS_NO_PASSWORD") {
|
|
419
|
-
const redirectParam = defaultRedirect ? `&redirect=${encodeURIComponent(defaultRedirect)}` : "";
|
|
420
|
-
onNavigate(
|
|
421
|
-
`${setPasswordLink}?identifier=${encodeURIComponent(username)}${redirectParam}`
|
|
422
|
-
);
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
handleError(err, setError, t);
|
|
426
|
-
} finally {
|
|
427
|
-
setIsLoading(false);
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
const handleBack = () => {
|
|
431
|
-
setShowPasswordField(false);
|
|
432
|
-
setUsername("");
|
|
433
|
-
form.setValue("password", "");
|
|
434
|
-
};
|
|
435
|
-
const isSubmitting = isLoading || checkUserMutation.isPending || signInMutation.isPending || isChecking;
|
|
436
|
-
let submitLabel = t("form.continue");
|
|
437
|
-
if (isSubmitting) {
|
|
438
|
-
submitLabel = showPasswordField ? t("form.submitting") : t("form.checking");
|
|
439
|
-
} else if (showPasswordField) {
|
|
440
|
-
submitLabel = t("form.submit");
|
|
441
|
-
}
|
|
442
|
-
let errorContent = null;
|
|
443
|
-
if (error) {
|
|
444
|
-
if (typeof error === "string") {
|
|
445
|
-
errorContent = { title: "Error", description: error };
|
|
446
|
-
} else {
|
|
447
|
-
errorContent = error;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
const formContent = /* @__PURE__ */ jsx3(Form, { ...form, children: /* @__PURE__ */ jsxs2(
|
|
451
|
-
"form",
|
|
452
|
-
{
|
|
453
|
-
id: "sign-in-form",
|
|
454
|
-
onSubmit: form.handleSubmit(onSubmit),
|
|
455
|
-
className: "space-y-4",
|
|
456
|
-
children: [
|
|
457
|
-
showPasswordField ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
458
|
-
/* @__PURE__ */ jsxs2(FormItem, { children: [
|
|
459
|
-
/* @__PURE__ */ jsxs2(FormLabel, { className: "flex justify-between items-center", children: [
|
|
460
|
-
t("form.accountLabel"),
|
|
461
|
-
/* @__PURE__ */ jsx3(
|
|
462
|
-
Button,
|
|
463
|
-
{
|
|
464
|
-
type: "button",
|
|
465
|
-
variant: "link",
|
|
466
|
-
size: "sm",
|
|
467
|
-
className: "p-0 m-0 h-auto",
|
|
468
|
-
onClick: handleBack,
|
|
469
|
-
children: t("changeAccount")
|
|
470
|
-
}
|
|
471
|
-
)
|
|
472
|
-
] }),
|
|
473
|
-
/* @__PURE__ */ jsx3(
|
|
474
|
-
Input,
|
|
475
|
-
{
|
|
476
|
-
id: "sign-in-username",
|
|
477
|
-
type: "text",
|
|
478
|
-
value: username,
|
|
479
|
-
autoComplete: "username",
|
|
480
|
-
disabled: true
|
|
481
|
-
}
|
|
482
|
-
)
|
|
483
|
-
] }),
|
|
484
|
-
/* @__PURE__ */ jsx3(
|
|
485
|
-
FormField,
|
|
486
|
-
{
|
|
487
|
-
control: form.control,
|
|
488
|
-
name: "password",
|
|
489
|
-
render: ({ field }) => /* @__PURE__ */ jsxs2(FormItem, { children: [
|
|
490
|
-
/* @__PURE__ */ jsx3(FormLabel, { children: t("form.passwordLabel") }),
|
|
491
|
-
/* @__PURE__ */ jsx3(
|
|
492
|
-
PasswordInput,
|
|
493
|
-
{
|
|
494
|
-
field: { ...field, value: field.value ?? "" },
|
|
495
|
-
show: showPassword,
|
|
496
|
-
onToggle: () => setShowPassword(!showPassword)
|
|
497
|
-
}
|
|
498
|
-
),
|
|
499
|
-
/* @__PURE__ */ jsx3(FormMessage, {})
|
|
500
|
-
] })
|
|
501
|
-
}
|
|
502
|
-
)
|
|
503
|
-
] }) : /* @__PURE__ */ jsx3(
|
|
504
|
-
FormField,
|
|
505
|
-
{
|
|
506
|
-
control: form.control,
|
|
507
|
-
name: "username",
|
|
508
|
-
render: ({ field }) => /* @__PURE__ */ jsxs2(FormItem, { children: [
|
|
509
|
-
/* @__PURE__ */ jsx3(FormLabel, { children: t("form.accountLabel") }),
|
|
510
|
-
/* @__PURE__ */ jsx3(FormControl, { children: /* @__PURE__ */ jsx3(Input, { ...field, type: "text", autoComplete: "username" }) }),
|
|
511
|
-
/* @__PURE__ */ jsx3(FormMessage, {})
|
|
512
|
-
] })
|
|
513
|
-
}
|
|
514
|
-
),
|
|
515
|
-
/* @__PURE__ */ jsx3(
|
|
516
|
-
Button,
|
|
517
|
-
{
|
|
518
|
-
type: "submit",
|
|
519
|
-
className: "w-full",
|
|
520
|
-
disabled: isSubmitting,
|
|
521
|
-
loading: isSubmitting,
|
|
522
|
-
children: submitLabel
|
|
523
|
-
}
|
|
524
|
-
)
|
|
525
|
-
]
|
|
526
|
-
}
|
|
527
|
-
) });
|
|
528
|
-
return /* @__PURE__ */ jsx3("div", { className: "space-y-4", children: /* @__PURE__ */ jsxs2(
|
|
529
|
-
AuthLayout,
|
|
530
|
-
{
|
|
531
|
-
title: config.ui.name,
|
|
532
|
-
description: t("description"),
|
|
533
|
-
logoImage,
|
|
534
|
-
footer: showPasswordField ? /* @__PURE__ */ jsx3("div", { className: "flex items-center justify-center w-full", children: Link ? /* @__PURE__ */ jsx3(
|
|
535
|
-
Link,
|
|
536
|
-
{
|
|
537
|
-
href: forgotPasswordLink,
|
|
538
|
-
className: "text-primary inline-block hover:underline",
|
|
539
|
-
children: t("footer.forgotPassword")
|
|
540
|
-
}
|
|
541
|
-
) : /* @__PURE__ */ jsx3(
|
|
542
|
-
"a",
|
|
543
|
-
{
|
|
544
|
-
href: forgotPasswordLink,
|
|
545
|
-
onClick: (e) => {
|
|
546
|
-
e.preventDefault();
|
|
547
|
-
onNavigate(forgotPasswordLink);
|
|
548
|
-
},
|
|
549
|
-
className: "text-primary inline-block hover:underline",
|
|
550
|
-
children: t("footer.forgotPassword")
|
|
551
|
-
}
|
|
552
|
-
) }) : void 0,
|
|
553
|
-
children: [
|
|
554
|
-
formContent,
|
|
555
|
-
errorContent && /* @__PURE__ */ jsxs2(Alert, { variant: "destructive", className: "mt-4", children: [
|
|
556
|
-
/* @__PURE__ */ jsx3(IconAlertCircle, { className: "h-4 w-4" }),
|
|
557
|
-
/* @__PURE__ */ jsx3(AlertTitle, { children: errorContent.title }),
|
|
558
|
-
/* @__PURE__ */ jsx3(AlertDescription, { children: errorContent.description })
|
|
559
|
-
] })
|
|
560
|
-
]
|
|
561
|
-
}
|
|
562
|
-
) });
|
|
563
|
-
};
|
|
3
|
+
SignIn
|
|
4
|
+
} from "../../chunk-FBABIA5J.js";
|
|
5
|
+
import "../../chunk-V2W3WPCZ.js";
|
|
6
|
+
import "../../chunk-55BMNC4S.js";
|
|
7
|
+
import "../../chunk-DPH2PHK3.js";
|
|
8
|
+
import "../../chunk-QNCE2B5O.js";
|
|
9
|
+
import "../../chunk-72YRO3A7.js";
|
|
564
10
|
export {
|
|
565
11
|
SignIn
|
|
566
12
|
};
|