hazo_auth 1.4.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -38
- package/SETUP_CHECKLIST.md +708 -0
- package/dist/app/api/hazo_auth/change_password/route.d.ts +8 -0
- package/dist/app/api/hazo_auth/change_password/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/change_password/route.js +98 -0
- package/dist/app/api/hazo_auth/forgot_password/route.d.ts +8 -0
- package/dist/app/api/hazo_auth/forgot_password/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/forgot_password/route.js +78 -0
- package/dist/app/api/hazo_auth/get_auth/route.d.ts +10 -0
- package/dist/app/api/hazo_auth/get_auth/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/get_auth/route.js +63 -0
- package/dist/app/api/hazo_auth/invalidate_cache/route.d.ts +14 -0
- package/dist/app/api/hazo_auth/invalidate_cache/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/invalidate_cache/route.js +96 -0
- package/dist/app/api/hazo_auth/library_photos/route.d.ts +13 -0
- package/dist/app/api/hazo_auth/library_photos/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/library_photos/route.js +55 -0
- package/dist/app/api/hazo_auth/login/route.d.ts +12 -0
- package/dist/app/api/hazo_auth/login/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/login/route.js +140 -0
- package/dist/app/api/hazo_auth/logout/route.d.ts +8 -0
- package/dist/app/api/hazo_auth/logout/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/logout/route.js +71 -0
- package/dist/app/api/hazo_auth/me/route.d.ts +3 -0
- package/dist/app/api/hazo_auth/me/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/me/route.js +34 -0
- package/dist/app/api/hazo_auth/profile_picture/[filename]/route.d.ts +7 -0
- package/dist/app/api/hazo_auth/profile_picture/[filename]/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/profile_picture/[filename]/route.js +43 -0
- package/dist/app/api/hazo_auth/register/route.d.ts +9 -0
- package/dist/app/api/hazo_auth/register/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/register/route.js +80 -0
- package/dist/app/api/hazo_auth/remove_profile_picture/route.d.ts +8 -0
- package/dist/app/api/hazo_auth/remove_profile_picture/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/remove_profile_picture/route.js +64 -0
- package/dist/app/api/hazo_auth/resend_verification/route.d.ts +8 -0
- package/dist/app/api/hazo_auth/resend_verification/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/resend_verification/route.js +79 -0
- package/dist/app/api/hazo_auth/reset_password/route.d.ts +8 -0
- package/dist/app/api/hazo_auth/reset_password/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/reset_password/route.js +76 -0
- package/dist/app/api/hazo_auth/update_user/route.d.ts +9 -0
- package/dist/app/api/hazo_auth/update_user/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/update_user/route.js +95 -0
- package/dist/app/api/hazo_auth/upload_profile_picture/route.d.ts +9 -0
- package/dist/app/api/hazo_auth/upload_profile_picture/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/upload_profile_picture/route.js +204 -0
- package/dist/app/api/hazo_auth/validate_reset_token/route.d.ts +6 -0
- package/dist/app/api/hazo_auth/validate_reset_token/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/validate_reset_token/route.js +58 -0
- package/dist/app/api/hazo_auth/verify_email/route.d.ts +11 -0
- package/dist/app/api/hazo_auth/verify_email/route.d.ts.map +1 -0
- package/dist/app/api/hazo_auth/verify_email/route.js +63 -0
- package/dist/cli/generate.d.ts +2 -0
- package/dist/cli/generate.d.ts.map +1 -0
- package/dist/cli/generate.js +117 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +120 -0
- package/dist/cli/validate.d.ts +15 -0
- package/dist/cli/validate.d.ts.map +1 -0
- package/dist/cli/validate.js +509 -0
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts +2 -2
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/config/email_verification_field_config.js +1 -1
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts +2 -2
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/hooks/use_email_verification.js +2 -2
- package/dist/components/layouts/email_verification/index.d.ts +3 -3
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/index.js +9 -9
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts +2 -2
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.js +1 -1
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts +2 -2
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +2 -2
- package/dist/components/layouts/forgot_password/index.d.ts +2 -2
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/index.js +8 -8
- package/dist/components/layouts/login/config/login_field_config.d.ts +2 -2
- package/dist/components/layouts/login/config/login_field_config.d.ts.map +1 -1
- package/dist/components/layouts/login/config/login_field_config.js +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.d.ts +2 -2
- package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.js +4 -4
- package/dist/components/layouts/login/index.d.ts +2 -2
- package/dist/components/layouts/login/index.d.ts.map +1 -1
- package/dist/components/layouts/login/index.js +9 -9
- package/dist/components/layouts/my_settings/components/editable_field.js +3 -3
- package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts +1 -1
- package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/password_change_dialog.js +4 -4
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +7 -7
- package/dist/components/layouts/my_settings/components/profile_picture_display.js +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.js +3 -3
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +5 -5
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.js +4 -4
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts +1 -1
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/config/my_settings_field_config.js +1 -1
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts +1 -1
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/hooks/use_my_settings.js +1 -1
- package/dist/components/layouts/my_settings/index.d.ts +2 -2
- package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/index.js +9 -9
- package/dist/components/layouts/register/config/register_field_config.d.ts +2 -2
- package/dist/components/layouts/register/config/register_field_config.d.ts.map +1 -1
- package/dist/components/layouts/register/config/register_field_config.js +1 -1
- package/dist/components/layouts/register/hooks/use_register_form.d.ts +3 -3
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
- package/dist/components/layouts/register/hooks/use_register_form.js +2 -2
- package/dist/components/layouts/register/index.d.ts +2 -2
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/register/index.js +9 -9
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts +2 -2
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/config/reset_password_field_config.js +1 -1
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts +3 -3
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +2 -2
- package/dist/components/layouts/reset_password/index.d.ts +2 -2
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/index.js +8 -8
- package/dist/components/layouts/shared/components/already_logged_in_guard.js +4 -4
- package/dist/components/layouts/shared/components/auth_page_shell.js +3 -3
- package/dist/components/layouts/shared/components/form_action_buttons.d.ts +1 -1
- package/dist/components/layouts/shared/components/form_action_buttons.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/form_action_buttons.js +1 -1
- package/dist/components/layouts/shared/components/form_field_wrapper.js +2 -2
- package/dist/components/layouts/shared/components/logout_button.js +2 -2
- package/dist/components/layouts/shared/components/password_field.js +3 -3
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts +1 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.js +4 -4
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.js +2 -2
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +3 -3
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.js +1 -1
- package/dist/components/layouts/shared/components/two_column_auth_layout.js +1 -1
- package/dist/components/layouts/shared/components/unauthorized_guard.js +2 -2
- package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts +1 -1
- package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts.map +1 -1
- package/dist/components/layouts/shared/utils/validation.d.ts +1 -1
- package/dist/components/layouts/shared/utils/validation.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/roles_matrix.js +7 -7
- package/dist/components/layouts/user_management/index.js +11 -11
- package/dist/components/ui/alert-dialog.js +2 -2
- package/dist/components/ui/avatar.js +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +45 -0
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/hazo_ui_tooltip.js +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.d.ts +2 -2
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/sidebar.js +8 -8
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/tooltip.js +1 -1
- package/dist/components/ui/vertical-tabs.js +1 -1
- package/dist/hooks/use-mobile.d.ts.map +1 -1
- package/dist/hooks/use-mobile.js +17 -3
- package/dist/lib/already_logged_in_config.server.js +1 -1
- package/dist/lib/app_logger.js +1 -1
- package/dist/lib/auth/auth_cache.d.ts +1 -1
- package/dist/lib/auth/auth_cache.d.ts.map +1 -1
- package/dist/lib/auth/auth_utils.server.js +2 -2
- package/dist/lib/auth/hazo_get_auth.server.d.ts +1 -1
- package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_auth.server.js +7 -7
- package/dist/lib/auth/server_auth.js +2 -2
- package/dist/lib/auth_utility_config.server.js +1 -1
- package/dist/lib/config/config_loader.server.js +1 -1
- package/dist/lib/email_verification_config.server.js +1 -1
- package/dist/lib/file_types_config.server.js +1 -1
- package/dist/lib/forgot_password_config.server.js +1 -1
- package/dist/lib/hazo_connect_instance.server.js +2 -2
- package/dist/lib/hazo_connect_setup.server.js +2 -2
- package/dist/lib/login_config.server.js +2 -2
- package/dist/lib/messages_config.server.js +1 -1
- package/dist/lib/my_settings_config.server.js +7 -7
- package/dist/lib/password_requirements_config.server.js +1 -1
- package/dist/lib/profile_pic_menu_config.server.js +1 -1
- package/dist/lib/profile_picture_config.server.js +2 -2
- package/dist/lib/register_config.server.js +4 -4
- package/dist/lib/reset_password_config.server.js +3 -3
- package/dist/lib/services/email_service.js +2 -2
- package/dist/lib/services/email_verification_service.js +3 -3
- package/dist/lib/services/login_service.js +3 -3
- package/dist/lib/services/password_change_service.js +3 -3
- package/dist/lib/services/password_reset_service.js +3 -3
- package/dist/lib/services/profile_picture_remove_service.js +3 -3
- package/dist/lib/services/profile_picture_service.d.ts +1 -1
- package/dist/lib/services/profile_picture_service.d.ts.map +1 -1
- package/dist/lib/services/profile_picture_service.js +5 -5
- package/dist/lib/services/registration_service.js +8 -8
- package/dist/lib/services/token_service.js +2 -2
- package/dist/lib/services/user_profiles_service.js +2 -2
- package/dist/lib/services/user_update_service.d.ts +1 -1
- package/dist/lib/services/user_update_service.d.ts.map +1 -1
- package/dist/lib/services/user_update_service.js +4 -4
- package/dist/lib/ui_shell_config.server.js +1 -1
- package/dist/lib/ui_sizes_config.server.js +1 -1
- package/dist/lib/user_fields_config.server.js +1 -1
- package/dist/lib/user_management_config.server.js +1 -1
- package/dist/lib/utils/error_sanitizer.d.ts +1 -1
- package/dist/lib/utils/error_sanitizer.d.ts.map +1 -1
- package/dist/server/config/config_loader.d.ts +1 -1
- package/dist/server/config/config_loader.d.ts.map +1 -1
- package/dist/server/config/config_loader.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/logging/logger_service.d.ts +1 -1
- package/dist/server/logging/logger_service.d.ts.map +1 -1
- package/dist/server/routes/change_password.d.ts +2 -0
- package/dist/server/routes/change_password.d.ts.map +1 -0
- package/dist/server/routes/change_password.js +2 -0
- package/dist/server/routes/forgot_password.d.ts +2 -0
- package/dist/server/routes/forgot_password.d.ts.map +1 -0
- package/dist/server/routes/forgot_password.js +2 -0
- package/dist/server/routes/get_auth.d.ts +2 -0
- package/dist/server/routes/get_auth.d.ts.map +1 -0
- package/dist/server/routes/get_auth.js +2 -0
- package/dist/server/routes/index.d.ts +18 -0
- package/dist/server/routes/index.d.ts.map +1 -0
- package/dist/server/routes/index.js +24 -0
- package/dist/server/routes/invalidate_cache.d.ts +2 -0
- package/dist/server/routes/invalidate_cache.d.ts.map +1 -0
- package/dist/server/routes/invalidate_cache.js +2 -0
- package/dist/server/routes/library_photos.d.ts +2 -0
- package/dist/server/routes/library_photos.d.ts.map +1 -0
- package/dist/server/routes/library_photos.js +2 -0
- package/dist/server/routes/login.d.ts +2 -0
- package/dist/server/routes/login.d.ts.map +1 -0
- package/dist/server/routes/login.js +2 -0
- package/dist/server/routes/logout.d.ts +2 -0
- package/dist/server/routes/logout.d.ts.map +1 -0
- package/dist/server/routes/logout.js +2 -0
- package/dist/server/routes/me.d.ts +2 -0
- package/dist/server/routes/me.d.ts.map +1 -0
- package/dist/server/routes/me.js +2 -0
- package/dist/server/routes/profile_picture_filename.d.ts +2 -0
- package/dist/server/routes/profile_picture_filename.d.ts.map +1 -0
- package/dist/server/routes/profile_picture_filename.js +3 -0
- package/dist/server/routes/register.d.ts +2 -0
- package/dist/server/routes/register.d.ts.map +1 -0
- package/dist/server/routes/register.js +2 -0
- package/dist/server/routes/remove_profile_picture.d.ts +2 -0
- package/dist/server/routes/remove_profile_picture.d.ts.map +1 -0
- package/dist/server/routes/remove_profile_picture.js +2 -0
- package/dist/server/routes/resend_verification.d.ts +2 -0
- package/dist/server/routes/resend_verification.d.ts.map +1 -0
- package/dist/server/routes/resend_verification.js +2 -0
- package/dist/server/routes/reset_password.d.ts +2 -0
- package/dist/server/routes/reset_password.d.ts.map +1 -0
- package/dist/server/routes/reset_password.js +2 -0
- package/dist/server/routes/update_user.d.ts +2 -0
- package/dist/server/routes/update_user.d.ts.map +1 -0
- package/dist/server/routes/update_user.js +2 -0
- package/dist/server/routes/upload_profile_picture.d.ts +2 -0
- package/dist/server/routes/upload_profile_picture.d.ts.map +1 -0
- package/dist/server/routes/upload_profile_picture.js +2 -0
- package/dist/server/routes/validate_reset_token.d.ts +2 -0
- package/dist/server/routes/validate_reset_token.d.ts.map +1 -0
- package/dist/server/routes/validate_reset_token.js +2 -0
- package/dist/server/routes/verify_email.d.ts +2 -0
- package/dist/server/routes/verify_email.d.ts.map +1 -0
- package/dist/server/routes/verify_email.js +2 -0
- package/dist/server/server.js +2 -2
- package/package.json +14 -115
- package/components.json +0 -22
- package/instrumentation.ts +0 -32
- package/migrations/001_add_token_type_to_refresh_tokens.sql +0 -14
- package/migrations/002_add_name_to_hazo_users.sql +0 -7
- package/migrations/003_add_url_on_logon_to_hazo_users.sql +0 -8
- package/next.config.mjs +0 -67
- package/postcss.config.mjs +0 -8
- package/public/file.svg +0 -1
- package/public/globe.svg +0 -1
- package/public/next.svg +0 -1
- package/public/vercel.svg +0 -1
- package/public/window.svg +0 -1
- package/scripts/apply_migration.ts +0 -118
- package/scripts/init_users.ts +0 -378
- package/src/app/api/hazo_auth/auth/upload_profile_picture/route.ts +0 -268
- package/src/app/api/hazo_auth/change_password/route.ts +0 -132
- package/src/app/api/hazo_auth/forgot_password/route.ts +0 -107
- package/src/app/api/hazo_auth/get_auth/route.ts +0 -89
- package/src/app/api/hazo_auth/invalidate_cache/route.ts +0 -139
- package/src/app/api/hazo_auth/library_photos/route.ts +0 -73
- package/src/app/api/hazo_auth/login/route.ts +0 -181
- package/src/app/api/hazo_auth/logout/route.ts +0 -89
- package/src/app/api/hazo_auth/me/route.ts +0 -47
- package/src/app/api/hazo_auth/profile_picture/[filename]/route.ts +0 -67
- package/src/app/api/hazo_auth/register/route.ts +0 -109
- package/src/app/api/hazo_auth/remove_profile_picture/route.ts +0 -86
- package/src/app/api/hazo_auth/resend_verification/route.ts +0 -108
- package/src/app/api/hazo_auth/reset_password/route.ts +0 -107
- package/src/app/api/hazo_auth/update_user/route.ts +0 -126
- package/src/app/api/hazo_auth/upload_profile_picture/route.ts +0 -268
- package/src/app/api/hazo_auth/user_management/permissions/route.ts +0 -367
- package/src/app/api/hazo_auth/user_management/roles/route.ts +0 -442
- package/src/app/api/hazo_auth/user_management/users/roles/route.ts +0 -367
- package/src/app/api/hazo_auth/user_management/users/route.ts +0 -239
- package/src/app/api/hazo_auth/validate_reset_token/route.ts +0 -83
- package/src/app/api/hazo_auth/verify_email/route.ts +0 -88
- package/src/app/api/migrations/apply/route.ts +0 -91
- package/src/app/favicon.ico +0 -0
- package/src/app/fonts/GeistMonoVF.woff +0 -0
- package/src/app/fonts/GeistVF.woff +0 -0
- package/src/app/globals.css +0 -89
- package/src/app/hazo_auth/forgot_password/forgot_password_page_client.tsx +0 -60
- package/src/app/hazo_auth/forgot_password/page.tsx +0 -24
- package/src/app/hazo_auth/login/login_page_client.tsx +0 -86
- package/src/app/hazo_auth/login/page.tsx +0 -38
- package/src/app/hazo_auth/my_settings/my_settings_page_client.tsx +0 -120
- package/src/app/hazo_auth/my_settings/page.tsx +0 -40
- package/src/app/hazo_auth/register/page.tsx +0 -36
- package/src/app/hazo_auth/register/register_page_client.tsx +0 -81
- package/src/app/hazo_auth/reset_password/page.tsx +0 -29
- package/src/app/hazo_auth/reset_password/reset_password_page_client.tsx +0 -81
- package/src/app/hazo_auth/user_management/page.tsx +0 -14
- package/src/app/hazo_auth/user_management/user_management_page_client.tsx +0 -16
- package/src/app/hazo_auth/verify_email/page.tsx +0 -24
- package/src/app/hazo_auth/verify_email/verify_email_page_client.tsx +0 -60
- package/src/app/hazo_connect/api/sqlite/data/route.ts +0 -203
- package/src/app/hazo_connect/api/sqlite/schema/route.ts +0 -45
- package/src/app/hazo_connect/api/sqlite/tables/route.ts +0 -36
- package/src/app/hazo_connect/sqlite_admin/page.tsx +0 -51
- package/src/app/hazo_connect/sqlite_admin/sqlite-admin-client.tsx +0 -984
- package/src/app/layout.tsx +0 -43
- package/src/app/page.tsx +0 -170
- package/src/components/index.ts +0 -7
- package/src/components/layouts/email_verification/config/email_verification_field_config.ts +0 -86
- package/src/components/layouts/email_verification/hooks/use_email_verification.ts +0 -297
- package/src/components/layouts/email_verification/index.tsx +0 -297
- package/src/components/layouts/forgot_password/config/forgot_password_field_config.ts +0 -58
- package/src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts +0 -179
- package/src/components/layouts/forgot_password/index.tsx +0 -168
- package/src/components/layouts/index.ts +0 -26
- package/src/components/layouts/login/config/login_field_config.ts +0 -67
- package/src/components/layouts/login/hooks/use_login_form.ts +0 -286
- package/src/components/layouts/login/index.tsx +0 -252
- package/src/components/layouts/my_settings/components/editable_field.tsx +0 -177
- package/src/components/layouts/my_settings/components/password_change_dialog.tsx +0 -301
- package/src/components/layouts/my_settings/components/profile_picture_dialog.tsx +0 -385
- package/src/components/layouts/my_settings/components/profile_picture_display.tsx +0 -66
- package/src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx +0 -143
- package/src/components/layouts/my_settings/components/profile_picture_library_tab.tsx +0 -311
- package/src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx +0 -341
- package/src/components/layouts/my_settings/config/my_settings_field_config.ts +0 -61
- package/src/components/layouts/my_settings/hooks/use_my_settings.ts +0 -458
- package/src/components/layouts/my_settings/index.tsx +0 -351
- package/src/components/layouts/register/config/register_field_config.ts +0 -101
- package/src/components/layouts/register/hooks/use_register_form.ts +0 -275
- package/src/components/layouts/register/index.tsx +0 -226
- package/src/components/layouts/reset_password/config/reset_password_field_config.ts +0 -86
- package/src/components/layouts/reset_password/hooks/use_reset_password_form.ts +0 -276
- package/src/components/layouts/reset_password/index.tsx +0 -294
- package/src/components/layouts/shared/components/already_logged_in_guard.tsx +0 -95
- package/src/components/layouts/shared/components/auth_page_shell.tsx +0 -36
- package/src/components/layouts/shared/components/field_error_message.tsx +0 -29
- package/src/components/layouts/shared/components/form_action_buttons.tsx +0 -64
- package/src/components/layouts/shared/components/form_field_wrapper.tsx +0 -44
- package/src/components/layouts/shared/components/form_header.tsx +0 -36
- package/src/components/layouts/shared/components/logout_button.tsx +0 -76
- package/src/components/layouts/shared/components/password_field.tsx +0 -72
- package/src/components/layouts/shared/components/profile_pic_menu.tsx +0 -321
- package/src/components/layouts/shared/components/profile_pic_menu_wrapper.tsx +0 -40
- package/src/components/layouts/shared/components/sidebar_layout_wrapper.tsx +0 -214
- package/src/components/layouts/shared/components/standalone_layout_wrapper.tsx +0 -53
- package/src/components/layouts/shared/components/two_column_auth_layout.tsx +0 -44
- package/src/components/layouts/shared/components/unauthorized_guard.tsx +0 -78
- package/src/components/layouts/shared/components/visual_panel.tsx +0 -41
- package/src/components/layouts/shared/config/layout_customization.ts +0 -95
- package/src/components/layouts/shared/data/layout_data_client.ts +0 -19
- package/src/components/layouts/shared/hooks/use_auth_status.ts +0 -103
- package/src/components/layouts/shared/hooks/use_hazo_auth.ts +0 -158
- package/src/components/layouts/shared/index.ts +0 -34
- package/src/components/layouts/shared/utils/ip_address.ts +0 -37
- package/src/components/layouts/shared/utils/validation.ts +0 -66
- package/src/components/layouts/user_management/components/roles_matrix.tsx +0 -607
- package/src/components/layouts/user_management/index.tsx +0 -1295
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/avatar.tsx +0 -50
- package/src/components/ui/button.tsx +0 -57
- package/src/components/ui/checkbox.tsx +0 -30
- package/src/components/ui/dialog.tsx +0 -122
- package/src/components/ui/dropdown-menu.tsx +0 -201
- package/src/components/ui/hazo_ui_tooltip.tsx +0 -67
- package/src/components/ui/index.ts +0 -22
- package/src/components/ui/input.tsx +0 -22
- package/src/components/ui/label.tsx +0 -26
- package/src/components/ui/separator.tsx +0 -31
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/sidebar.tsx +0 -773
- package/src/components/ui/skeleton.tsx +0 -15
- package/src/components/ui/sonner.tsx +0 -31
- package/src/components/ui/switch.tsx +0 -29
- package/src/components/ui/table.tsx +0 -120
- package/src/components/ui/tabs.tsx +0 -55
- package/src/components/ui/tooltip.tsx +0 -32
- package/src/components/ui/vertical-tabs.tsx +0 -59
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/index.ts +0 -7
- package/src/lib/already_logged_in_config.server.ts +0 -46
- package/src/lib/app_logger.ts +0 -24
- package/src/lib/auth/auth_cache.ts +0 -220
- package/src/lib/auth/auth_rate_limiter.ts +0 -121
- package/src/lib/auth/auth_types.ts +0 -65
- package/src/lib/auth/auth_utils.server.ts +0 -196
- package/src/lib/auth/hazo_get_auth.server.ts +0 -333
- package/src/lib/auth/index.ts +0 -23
- package/src/lib/auth/server_auth.ts +0 -88
- package/src/lib/auth_utility_config.server.ts +0 -136
- package/src/lib/config/config_loader.server.ts +0 -164
- package/src/lib/email_verification_config.server.ts +0 -32
- package/src/lib/file_types_config.server.ts +0 -25
- package/src/lib/forgot_password_config.server.ts +0 -32
- package/src/lib/hazo_connect_instance.server.ts +0 -101
- package/src/lib/hazo_connect_setup.server.ts +0 -194
- package/src/lib/hazo_connect_setup.ts +0 -54
- package/src/lib/index.ts +0 -44
- package/src/lib/login_config.server.ts +0 -71
- package/src/lib/messages_config.server.ts +0 -45
- package/src/lib/migrations/apply_migration.ts +0 -105
- package/src/lib/my_settings_config.server.ts +0 -135
- package/src/lib/password_requirements_config.server.ts +0 -39
- package/src/lib/profile_pic_menu_config.server.ts +0 -138
- package/src/lib/profile_picture_config.server.ts +0 -56
- package/src/lib/register_config.server.ts +0 -73
- package/src/lib/reset_password_config.server.ts +0 -75
- package/src/lib/services/email_service.ts +0 -581
- package/src/lib/services/email_verification_service.ts +0 -270
- package/src/lib/services/index.ts +0 -15
- package/src/lib/services/login_service.ts +0 -134
- package/src/lib/services/password_change_service.ts +0 -154
- package/src/lib/services/password_reset_service.ts +0 -405
- package/src/lib/services/profile_picture_remove_service.ts +0 -120
- package/src/lib/services/profile_picture_service.ts +0 -215
- package/src/lib/services/profile_picture_source_mapper.ts +0 -62
- package/src/lib/services/registration_service.ts +0 -184
- package/src/lib/services/token_service.ts +0 -240
- package/src/lib/services/user_profiles_service.ts +0 -143
- package/src/lib/services/user_update_service.ts +0 -141
- package/src/lib/ui_shell_config.server.ts +0 -73
- package/src/lib/ui_sizes_config.server.ts +0 -37
- package/src/lib/user_fields_config.server.ts +0 -31
- package/src/lib/user_management_config.server.ts +0 -39
- package/src/lib/utils/api_route_helpers.ts +0 -60
- package/src/lib/utils/error_sanitizer.ts +0 -75
- package/src/lib/utils.ts +0 -11
- package/src/middleware.ts +0 -94
- package/src/routes/index.ts +0 -34
- package/src/server/config/config_loader.ts +0 -496
- package/src/server/index.ts +0 -38
- package/src/server/logging/logger_service.ts +0 -56
- package/src/server/routes/root_router.ts +0 -16
- package/src/server/server.ts +0 -28
- package/src/server/types/app_types.ts +0 -74
- package/src/server/types/express.d.ts +0 -16
- package/src/stories/email_verification_layout.stories.tsx +0 -137
- package/src/stories/forgot_password_layout.stories.tsx +0 -85
- package/src/stories/login_layout.stories.tsx +0 -85
- package/src/stories/project_overview.stories.tsx +0 -33
- package/src/stories/register_layout.stories.tsx +0 -107
- package/tailwind.config.ts +0 -77
- package/tsconfig.build.json +0 -39
- package/tsconfig.json +0 -28
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
// file_description: email verification layout component built atop shared layout utilities
|
|
2
|
-
// section: client_directive
|
|
3
|
-
"use client";
|
|
4
|
-
|
|
5
|
-
// section: imports
|
|
6
|
-
import { Input } from "hazo_auth/components/ui/input";
|
|
7
|
-
import { Button } from "hazo_auth/components/ui/button";
|
|
8
|
-
import { FormFieldWrapper } from "hazo_auth/components/layouts/shared/components/form_field_wrapper";
|
|
9
|
-
import { FormHeader } from "hazo_auth/components/layouts/shared/components/form_header";
|
|
10
|
-
import { FormActionButtons } from "hazo_auth/components/layouts/shared/components/form_action_buttons";
|
|
11
|
-
import { TwoColumnAuthLayout } from "hazo_auth/components/layouts/shared/components/two_column_auth_layout";
|
|
12
|
-
import {
|
|
13
|
-
type ButtonPaletteOverrides,
|
|
14
|
-
type LayoutFieldMapOverrides,
|
|
15
|
-
type LayoutLabelOverrides,
|
|
16
|
-
} from "hazo_auth/components/layouts/shared/config/layout_customization";
|
|
17
|
-
import {
|
|
18
|
-
EMAIL_VERIFICATION_FIELD_IDS,
|
|
19
|
-
createEmailVerificationFieldDefinitions,
|
|
20
|
-
resolveEmailVerificationButtonPalette,
|
|
21
|
-
resolveEmailVerificationLabels,
|
|
22
|
-
EMAIL_VERIFICATION_SUCCESS_LABEL_DEFAULTS,
|
|
23
|
-
EMAIL_VERIFICATION_ERROR_LABEL_DEFAULTS,
|
|
24
|
-
type EmailVerificationSuccessLabels,
|
|
25
|
-
type EmailVerificationErrorLabels,
|
|
26
|
-
} from "hazo_auth/components/layouts/email_verification/config/email_verification_field_config";
|
|
27
|
-
import {
|
|
28
|
-
use_email_verification,
|
|
29
|
-
type UseEmailVerificationResult,
|
|
30
|
-
} from "hazo_auth/components/layouts/email_verification/hooks/use_email_verification";
|
|
31
|
-
import { type LayoutDataClient } from "hazo_auth/components/layouts/shared/data/layout_data_client";
|
|
32
|
-
import { CheckCircle, XCircle, Loader2 } from "lucide-react";
|
|
33
|
-
import { AlreadyLoggedInGuard } from "hazo_auth/components/layouts/shared/components/already_logged_in_guard";
|
|
34
|
-
|
|
35
|
-
// section: types
|
|
36
|
-
export type EmailVerificationLayoutProps<TClient = unknown> = {
|
|
37
|
-
image_src: string;
|
|
38
|
-
image_alt: string;
|
|
39
|
-
image_background_color?: string;
|
|
40
|
-
field_overrides?: LayoutFieldMapOverrides;
|
|
41
|
-
labels?: LayoutLabelOverrides;
|
|
42
|
-
button_colors?: ButtonPaletteOverrides;
|
|
43
|
-
success_labels?: Partial<EmailVerificationSuccessLabels>;
|
|
44
|
-
error_labels?: Partial<EmailVerificationErrorLabels>;
|
|
45
|
-
redirect_delay?: number;
|
|
46
|
-
login_path?: string;
|
|
47
|
-
already_logged_in_message?: string;
|
|
48
|
-
showLogoutButton?: boolean;
|
|
49
|
-
showReturnHomeButton?: boolean;
|
|
50
|
-
returnHomeButtonLabel?: string;
|
|
51
|
-
returnHomePath?: string;
|
|
52
|
-
data_client: LayoutDataClient<TClient>;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const ORDERED_FIELDS: EmailVerificationFieldId[] = [
|
|
56
|
-
EMAIL_VERIFICATION_FIELD_IDS.EMAIL,
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
type EmailVerificationFieldId = (typeof EMAIL_VERIFICATION_FIELD_IDS)[keyof typeof EMAIL_VERIFICATION_FIELD_IDS];
|
|
60
|
-
|
|
61
|
-
// section: component
|
|
62
|
-
export default function email_verification_layout<TClient>({
|
|
63
|
-
image_src,
|
|
64
|
-
image_alt,
|
|
65
|
-
image_background_color = "#f1f5f9",
|
|
66
|
-
field_overrides,
|
|
67
|
-
labels,
|
|
68
|
-
button_colors,
|
|
69
|
-
success_labels,
|
|
70
|
-
error_labels,
|
|
71
|
-
redirect_delay = 5,
|
|
72
|
-
login_path = "/hazo_auth/login",
|
|
73
|
-
data_client,
|
|
74
|
-
already_logged_in_message,
|
|
75
|
-
showLogoutButton = true,
|
|
76
|
-
showReturnHomeButton = false,
|
|
77
|
-
returnHomeButtonLabel = "Return home",
|
|
78
|
-
returnHomePath = "/",
|
|
79
|
-
}: EmailVerificationLayoutProps<TClient>) {
|
|
80
|
-
const fieldDefinitions = createEmailVerificationFieldDefinitions(field_overrides);
|
|
81
|
-
const resolvedLabels = resolveEmailVerificationLabels(labels);
|
|
82
|
-
const resolvedButtonPalette = resolveEmailVerificationButtonPalette(button_colors);
|
|
83
|
-
const resolvedSuccessLabels = {
|
|
84
|
-
...EMAIL_VERIFICATION_SUCCESS_LABEL_DEFAULTS,
|
|
85
|
-
...(success_labels ?? {}),
|
|
86
|
-
};
|
|
87
|
-
const resolvedErrorLabels = {
|
|
88
|
-
...EMAIL_VERIFICATION_ERROR_LABEL_DEFAULTS,
|
|
89
|
-
...(error_labels ?? {}),
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const verification = use_email_verification({
|
|
93
|
-
dataClient: data_client,
|
|
94
|
-
redirectDelay: redirect_delay,
|
|
95
|
-
loginPath: login_path,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const renderFields = (formState: UseEmailVerificationResult) => {
|
|
99
|
-
return ORDERED_FIELDS.map((fieldId) => {
|
|
100
|
-
const fieldDefinition = fieldDefinitions[fieldId];
|
|
101
|
-
const fieldValue = formState.values[fieldId];
|
|
102
|
-
const fieldError = formState.errors[fieldId];
|
|
103
|
-
|
|
104
|
-
const inputElement = (
|
|
105
|
-
<Input
|
|
106
|
-
id={fieldDefinition.id}
|
|
107
|
-
type={fieldDefinition.type}
|
|
108
|
-
value={fieldValue}
|
|
109
|
-
onChange={(event) =>
|
|
110
|
-
formState.handleFieldChange(fieldId, event.target.value)
|
|
111
|
-
}
|
|
112
|
-
onBlur={
|
|
113
|
-
fieldId === EMAIL_VERIFICATION_FIELD_IDS.EMAIL
|
|
114
|
-
? formState.handleEmailBlur
|
|
115
|
-
: undefined
|
|
116
|
-
}
|
|
117
|
-
autoComplete={fieldDefinition.autoComplete}
|
|
118
|
-
placeholder={fieldDefinition.placeholder}
|
|
119
|
-
aria-label={fieldDefinition.ariaLabel}
|
|
120
|
-
className="cls_email_verification_layout_field_input"
|
|
121
|
-
/>
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
// Only show email error if field has been touched (blurred)
|
|
125
|
-
const shouldShowError =
|
|
126
|
-
fieldId === EMAIL_VERIFICATION_FIELD_IDS.EMAIL
|
|
127
|
-
? formState.emailTouched && fieldError
|
|
128
|
-
? fieldError
|
|
129
|
-
: undefined
|
|
130
|
-
: fieldError;
|
|
131
|
-
|
|
132
|
-
return (
|
|
133
|
-
<FormFieldWrapper
|
|
134
|
-
key={fieldId}
|
|
135
|
-
fieldId={fieldDefinition.id}
|
|
136
|
-
label={fieldDefinition.label}
|
|
137
|
-
input={inputElement}
|
|
138
|
-
errorMessage={shouldShowError}
|
|
139
|
-
/>
|
|
140
|
-
);
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
// Verifying state
|
|
145
|
-
if (verification.isVerifying) {
|
|
146
|
-
return (
|
|
147
|
-
<AlreadyLoggedInGuard
|
|
148
|
-
image_src={image_src}
|
|
149
|
-
image_alt={image_alt}
|
|
150
|
-
image_background_color={image_background_color}
|
|
151
|
-
message={already_logged_in_message}
|
|
152
|
-
showLogoutButton={showLogoutButton}
|
|
153
|
-
showReturnHomeButton={showReturnHomeButton}
|
|
154
|
-
returnHomeButtonLabel={returnHomeButtonLabel}
|
|
155
|
-
returnHomePath={returnHomePath}
|
|
156
|
-
requireEmailVerified={false}
|
|
157
|
-
>
|
|
158
|
-
<TwoColumnAuthLayout
|
|
159
|
-
imageSrc={image_src}
|
|
160
|
-
imageAlt={image_alt}
|
|
161
|
-
imageBackgroundColor={image_background_color}
|
|
162
|
-
formContent={
|
|
163
|
-
<div className="cls_email_verification_verifying flex flex-col items-center justify-center gap-4 py-8">
|
|
164
|
-
<Loader2 className="h-12 w-12 animate-spin text-slate-600" aria-hidden="true" />
|
|
165
|
-
<div className="cls_email_verification_verifying_text text-center">
|
|
166
|
-
<h1 className="cls_email_verification_verifying_heading text-2xl font-semibold text-slate-900">
|
|
167
|
-
{resolvedLabels.heading}
|
|
168
|
-
</h1>
|
|
169
|
-
<p className="cls_email_verification_verifying_subheading mt-2 text-sm text-slate-600">
|
|
170
|
-
{resolvedLabels.subHeading}
|
|
171
|
-
</p>
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
}
|
|
175
|
-
/>
|
|
176
|
-
</AlreadyLoggedInGuard>
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Success state
|
|
181
|
-
if (verification.isVerified) {
|
|
182
|
-
return (
|
|
183
|
-
<AlreadyLoggedInGuard
|
|
184
|
-
image_src={image_src}
|
|
185
|
-
image_alt={image_alt}
|
|
186
|
-
image_background_color={image_background_color}
|
|
187
|
-
message={already_logged_in_message}
|
|
188
|
-
showLogoutButton={showLogoutButton}
|
|
189
|
-
showReturnHomeButton={showReturnHomeButton}
|
|
190
|
-
returnHomeButtonLabel={returnHomeButtonLabel}
|
|
191
|
-
returnHomePath={returnHomePath}
|
|
192
|
-
requireEmailVerified={false}
|
|
193
|
-
>
|
|
194
|
-
<TwoColumnAuthLayout
|
|
195
|
-
imageSrc={image_src}
|
|
196
|
-
imageAlt={image_alt}
|
|
197
|
-
imageBackgroundColor={image_background_color}
|
|
198
|
-
formContent={
|
|
199
|
-
<div className="cls_email_verification_success flex flex-col gap-6">
|
|
200
|
-
<div className="cls_email_verification_success_content flex flex-col items-center gap-4 text-center">
|
|
201
|
-
<CheckCircle className="h-16 w-16 text-green-600" aria-hidden="true" />
|
|
202
|
-
<div className="cls_email_verification_success_text">
|
|
203
|
-
<h1 className="cls_email_verification_success_heading text-2xl font-semibold text-slate-900">
|
|
204
|
-
{resolvedSuccessLabels.heading}
|
|
205
|
-
</h1>
|
|
206
|
-
<p className="cls_email_verification_success_message mt-2 text-sm text-slate-600">
|
|
207
|
-
{resolvedSuccessLabels.message}
|
|
208
|
-
</p>
|
|
209
|
-
</div>
|
|
210
|
-
<div className="cls_email_verification_redirect_info mt-2 text-sm text-slate-500">
|
|
211
|
-
{resolvedSuccessLabels.redirectMessage} {verification.redirectCountdown} seconds...
|
|
212
|
-
</div>
|
|
213
|
-
</div>
|
|
214
|
-
<div className="cls_email_verification_success_actions flex justify-center">
|
|
215
|
-
<Button
|
|
216
|
-
type="button"
|
|
217
|
-
onClick={verification.handleGoToLogin}
|
|
218
|
-
className="cls_email_verification_go_to_login_button"
|
|
219
|
-
style={{
|
|
220
|
-
backgroundColor: resolvedButtonPalette.submitBackground,
|
|
221
|
-
color: resolvedButtonPalette.submitText,
|
|
222
|
-
}}
|
|
223
|
-
>
|
|
224
|
-
{resolvedSuccessLabels.goToLoginButton}
|
|
225
|
-
</Button>
|
|
226
|
-
</div>
|
|
227
|
-
</div>
|
|
228
|
-
}
|
|
229
|
-
/>
|
|
230
|
-
</AlreadyLoggedInGuard>
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// Error state with resend form
|
|
235
|
-
return (
|
|
236
|
-
<AlreadyLoggedInGuard
|
|
237
|
-
image_src={image_src}
|
|
238
|
-
image_alt={image_alt}
|
|
239
|
-
image_background_color={image_background_color}
|
|
240
|
-
message={already_logged_in_message}
|
|
241
|
-
showLogoutButton={showLogoutButton}
|
|
242
|
-
showReturnHomeButton={showReturnHomeButton}
|
|
243
|
-
returnHomeButtonLabel={returnHomeButtonLabel}
|
|
244
|
-
returnHomePath={returnHomePath}
|
|
245
|
-
requireEmailVerified={false}
|
|
246
|
-
>
|
|
247
|
-
<TwoColumnAuthLayout
|
|
248
|
-
imageSrc={image_src}
|
|
249
|
-
imageAlt={image_alt}
|
|
250
|
-
imageBackgroundColor={image_background_color}
|
|
251
|
-
formContent={
|
|
252
|
-
<>
|
|
253
|
-
<div className="cls_email_verification_error_header flex flex-col items-center gap-4 text-center">
|
|
254
|
-
<XCircle className="h-12 w-12 text-red-600" aria-hidden="true" />
|
|
255
|
-
<div className="cls_email_verification_error_text">
|
|
256
|
-
<h1 className="cls_email_verification_error_heading text-2xl font-semibold text-slate-900">
|
|
257
|
-
{resolvedErrorLabels.heading}
|
|
258
|
-
</h1>
|
|
259
|
-
<p className="cls_email_verification_error_message mt-2 text-sm text-slate-600">
|
|
260
|
-
{verification.errorMessage || resolvedErrorLabels.message}
|
|
261
|
-
</p>
|
|
262
|
-
</div>
|
|
263
|
-
</div>
|
|
264
|
-
<div className="cls_email_verification_resend_form">
|
|
265
|
-
<FormHeader
|
|
266
|
-
heading={resolvedErrorLabels.resendFormHeading}
|
|
267
|
-
subHeading="Enter your email address to receive a new verification link."
|
|
268
|
-
/>
|
|
269
|
-
<form
|
|
270
|
-
className="cls_email_verification_layout_form_fields flex flex-col gap-5"
|
|
271
|
-
onSubmit={verification.handleResendSubmit}
|
|
272
|
-
aria-label="Resend verification email form"
|
|
273
|
-
>
|
|
274
|
-
{renderFields(verification)}
|
|
275
|
-
<FormActionButtons
|
|
276
|
-
submitLabel={resolvedLabels.submitButton}
|
|
277
|
-
cancelLabel={resolvedLabels.cancelButton}
|
|
278
|
-
buttonPalette={resolvedButtonPalette}
|
|
279
|
-
isSubmitDisabled={verification.isSubmitDisabled}
|
|
280
|
-
onCancel={verification.handleCancel}
|
|
281
|
-
submitAriaLabel="Submit resend verification email form"
|
|
282
|
-
cancelAriaLabel="Cancel resend verification email form"
|
|
283
|
-
/>
|
|
284
|
-
{verification.isSubmitting && (
|
|
285
|
-
<div className="cls_email_verification_submitting_indicator text-sm text-slate-600 text-center">
|
|
286
|
-
Sending verification email...
|
|
287
|
-
</div>
|
|
288
|
-
)}
|
|
289
|
-
</form>
|
|
290
|
-
</div>
|
|
291
|
-
</>
|
|
292
|
-
}
|
|
293
|
-
/>
|
|
294
|
-
</AlreadyLoggedInGuard>
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// file_description: forgot password layout specific configuration helpers
|
|
2
|
-
// section: imports
|
|
3
|
-
import type { LayoutFieldMap, LayoutFieldMapOverrides } from "hazo_auth/components/layouts/shared/config/layout_customization";
|
|
4
|
-
import {
|
|
5
|
-
resolveButtonPalette,
|
|
6
|
-
resolveFieldDefinitions,
|
|
7
|
-
resolveLabels,
|
|
8
|
-
type ButtonPaletteDefaults,
|
|
9
|
-
type ButtonPaletteOverrides,
|
|
10
|
-
type LayoutLabelDefaults,
|
|
11
|
-
type LayoutLabelOverrides,
|
|
12
|
-
} from "hazo_auth/components/layouts/shared/config/layout_customization";
|
|
13
|
-
|
|
14
|
-
// section: field_identifiers
|
|
15
|
-
export const FORGOT_PASSWORD_FIELD_IDS = {
|
|
16
|
-
EMAIL: "email_address",
|
|
17
|
-
} as const;
|
|
18
|
-
|
|
19
|
-
export type ForgotPasswordFieldId = (typeof FORGOT_PASSWORD_FIELD_IDS)[keyof typeof FORGOT_PASSWORD_FIELD_IDS];
|
|
20
|
-
|
|
21
|
-
// section: field_definitions
|
|
22
|
-
const FORGOT_PASSWORD_FIELD_DEFINITIONS: LayoutFieldMap = {
|
|
23
|
-
[FORGOT_PASSWORD_FIELD_IDS.EMAIL]: {
|
|
24
|
-
id: FORGOT_PASSWORD_FIELD_IDS.EMAIL,
|
|
25
|
-
label: "Email address",
|
|
26
|
-
type: "email",
|
|
27
|
-
autoComplete: "email",
|
|
28
|
-
placeholder: "Enter your email address",
|
|
29
|
-
ariaLabel: "Email address input field",
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const createForgotPasswordFieldDefinitions = (
|
|
34
|
-
overrides?: LayoutFieldMapOverrides,
|
|
35
|
-
) => resolveFieldDefinitions(FORGOT_PASSWORD_FIELD_DEFINITIONS, overrides);
|
|
36
|
-
|
|
37
|
-
// section: label_defaults
|
|
38
|
-
const FORGOT_PASSWORD_LABEL_DEFAULTS: LayoutLabelDefaults = {
|
|
39
|
-
heading: "Forgot your password?",
|
|
40
|
-
subHeading: "Enter your email address and we'll send you a link to reset your password.",
|
|
41
|
-
submitButton: "Send reset link",
|
|
42
|
-
cancelButton: "Cancel",
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const resolveForgotPasswordLabels = (overrides?: LayoutLabelOverrides) =>
|
|
46
|
-
resolveLabels(FORGOT_PASSWORD_LABEL_DEFAULTS, overrides);
|
|
47
|
-
|
|
48
|
-
// section: button_palette_defaults
|
|
49
|
-
const FORGOT_PASSWORD_BUTTON_PALETTE_DEFAULTS: ButtonPaletteDefaults = {
|
|
50
|
-
submitBackground: "#0f172a",
|
|
51
|
-
submitText: "#ffffff",
|
|
52
|
-
cancelBorder: "#cbd5f5",
|
|
53
|
-
cancelText: "#0f172a",
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const resolveForgotPasswordButtonPalette = (overrides?: ButtonPaletteOverrides) =>
|
|
57
|
-
resolveButtonPalette(FORGOT_PASSWORD_BUTTON_PALETTE_DEFAULTS, overrides);
|
|
58
|
-
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
// file_description: encapsulate forgot password form state, validation, and data interactions
|
|
2
|
-
// section: imports
|
|
3
|
-
import { useCallback, useMemo, useState } from "react";
|
|
4
|
-
import { toast } from "sonner";
|
|
5
|
-
import type { LayoutDataClient } from "hazo_auth/components/layouts/shared/data/layout_data_client";
|
|
6
|
-
import { FORGOT_PASSWORD_FIELD_IDS, type ForgotPasswordFieldId } from "hazo_auth/components/layouts/forgot_password/config/forgot_password_field_config";
|
|
7
|
-
import { validateEmail } from "hazo_auth/components/layouts/shared/utils/validation";
|
|
8
|
-
|
|
9
|
-
// section: types
|
|
10
|
-
export type ForgotPasswordFormValues = Record<ForgotPasswordFieldId, string>;
|
|
11
|
-
export type ForgotPasswordFormErrors = Partial<Record<ForgotPasswordFieldId, string>> & {
|
|
12
|
-
submit?: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type UseForgotPasswordFormParams<TClient = unknown> = {
|
|
16
|
-
dataClient: LayoutDataClient<TClient>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type UseForgotPasswordFormResult = {
|
|
20
|
-
values: ForgotPasswordFormValues;
|
|
21
|
-
errors: ForgotPasswordFormErrors;
|
|
22
|
-
isSubmitDisabled: boolean;
|
|
23
|
-
isSubmitting: boolean;
|
|
24
|
-
emailTouched: boolean;
|
|
25
|
-
handleFieldChange: (fieldId: ForgotPasswordFieldId, value: string) => void;
|
|
26
|
-
handleEmailBlur: () => void;
|
|
27
|
-
handleSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
|
|
28
|
-
handleCancel: () => void;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// section: helpers
|
|
32
|
-
const buildInitialValues = (): ForgotPasswordFormValues => ({
|
|
33
|
-
[FORGOT_PASSWORD_FIELD_IDS.EMAIL]: "",
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// section: hook
|
|
37
|
-
export const use_forgot_password_form = <TClient,>({
|
|
38
|
-
dataClient,
|
|
39
|
-
}: UseForgotPasswordFormParams<TClient>): UseForgotPasswordFormResult => {
|
|
40
|
-
const [values, setValues] = useState<ForgotPasswordFormValues>(buildInitialValues);
|
|
41
|
-
const [errors, setErrors] = useState<ForgotPasswordFormErrors>({});
|
|
42
|
-
const [emailTouched, setEmailTouched] = useState<boolean>(false);
|
|
43
|
-
const [isSubmitting, setIsSubmitting] = useState<boolean>(false);
|
|
44
|
-
|
|
45
|
-
const isSubmitDisabled = useMemo(() => {
|
|
46
|
-
if (isSubmitting) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const hasEmptyField = Object.values(values).some((fieldValue) => fieldValue.trim() === "");
|
|
51
|
-
const hasErrors = Object.keys(errors).length > 0;
|
|
52
|
-
return hasEmptyField || hasErrors;
|
|
53
|
-
}, [errors, values, isSubmitting]);
|
|
54
|
-
|
|
55
|
-
const handleFieldChange = useCallback((fieldId: ForgotPasswordFieldId, value: string) => {
|
|
56
|
-
setValues((previousValues) => {
|
|
57
|
-
const nextValues: ForgotPasswordFormValues = {
|
|
58
|
-
...previousValues,
|
|
59
|
-
[fieldId]: value,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
setErrors((previousErrors) => {
|
|
63
|
-
const updatedErrors: ForgotPasswordFormErrors = { ...previousErrors };
|
|
64
|
-
|
|
65
|
-
// Only validate email on change if it has been touched (blurred)
|
|
66
|
-
if (fieldId === FORGOT_PASSWORD_FIELD_IDS.EMAIL && emailTouched) {
|
|
67
|
-
const emailError = validateEmail(value);
|
|
68
|
-
if (emailError) {
|
|
69
|
-
updatedErrors[FORGOT_PASSWORD_FIELD_IDS.EMAIL] = emailError;
|
|
70
|
-
} else {
|
|
71
|
-
delete updatedErrors[FORGOT_PASSWORD_FIELD_IDS.EMAIL];
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return updatedErrors;
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
return nextValues;
|
|
79
|
-
});
|
|
80
|
-
}, [emailTouched]);
|
|
81
|
-
|
|
82
|
-
const handleEmailBlur = useCallback(() => {
|
|
83
|
-
setEmailTouched(true);
|
|
84
|
-
// Validate email on blur
|
|
85
|
-
setErrors((previousErrors) => {
|
|
86
|
-
const updatedErrors: ForgotPasswordFormErrors = { ...previousErrors };
|
|
87
|
-
const emailValue = values[FORGOT_PASSWORD_FIELD_IDS.EMAIL];
|
|
88
|
-
const emailError = validateEmail(emailValue);
|
|
89
|
-
if (emailError) {
|
|
90
|
-
updatedErrors[FORGOT_PASSWORD_FIELD_IDS.EMAIL] = emailError;
|
|
91
|
-
} else {
|
|
92
|
-
delete updatedErrors[FORGOT_PASSWORD_FIELD_IDS.EMAIL];
|
|
93
|
-
}
|
|
94
|
-
return updatedErrors;
|
|
95
|
-
});
|
|
96
|
-
}, [values]);
|
|
97
|
-
|
|
98
|
-
const handleSubmit = useCallback(
|
|
99
|
-
async (event: React.FormEvent<HTMLFormElement>) => {
|
|
100
|
-
event.preventDefault();
|
|
101
|
-
|
|
102
|
-
// Final validation
|
|
103
|
-
const emailError = validateEmail(values[FORGOT_PASSWORD_FIELD_IDS.EMAIL]);
|
|
104
|
-
|
|
105
|
-
if (emailError) {
|
|
106
|
-
setErrors({
|
|
107
|
-
[FORGOT_PASSWORD_FIELD_IDS.EMAIL]: emailError,
|
|
108
|
-
});
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
setIsSubmitting(true);
|
|
113
|
-
setErrors({});
|
|
114
|
-
|
|
115
|
-
try {
|
|
116
|
-
const response = await fetch("/api/hazo_auth/forgot_password", {
|
|
117
|
-
method: "POST",
|
|
118
|
-
headers: {
|
|
119
|
-
"Content-Type": "application/json",
|
|
120
|
-
},
|
|
121
|
-
body: JSON.stringify({
|
|
122
|
-
email: values[FORGOT_PASSWORD_FIELD_IDS.EMAIL],
|
|
123
|
-
}),
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
const data = await response.json();
|
|
127
|
-
|
|
128
|
-
if (!response.ok) {
|
|
129
|
-
throw new Error(data.error || "Password reset request failed");
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Show success notification
|
|
133
|
-
toast.success("Password reset link sent", {
|
|
134
|
-
description: "If an account with that email exists, a password reset link has been sent.",
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
// Reset form on success
|
|
138
|
-
setValues(buildInitialValues());
|
|
139
|
-
setErrors({});
|
|
140
|
-
setEmailTouched(false);
|
|
141
|
-
} catch (error) {
|
|
142
|
-
const errorMessage =
|
|
143
|
-
error instanceof Error ? error.message : "Password reset request failed. Please try again.";
|
|
144
|
-
|
|
145
|
-
// Show error notification
|
|
146
|
-
toast.error("Password reset failed", {
|
|
147
|
-
description: errorMessage,
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
// Set error state
|
|
151
|
-
setErrors({
|
|
152
|
-
submit: errorMessage,
|
|
153
|
-
});
|
|
154
|
-
} finally {
|
|
155
|
-
setIsSubmitting(false);
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
[values, dataClient],
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
const handleCancel = useCallback(() => {
|
|
162
|
-
setValues(buildInitialValues());
|
|
163
|
-
setErrors({});
|
|
164
|
-
setEmailTouched(false);
|
|
165
|
-
}, []);
|
|
166
|
-
|
|
167
|
-
return {
|
|
168
|
-
values,
|
|
169
|
-
errors,
|
|
170
|
-
isSubmitDisabled,
|
|
171
|
-
isSubmitting,
|
|
172
|
-
emailTouched,
|
|
173
|
-
handleFieldChange,
|
|
174
|
-
handleEmailBlur,
|
|
175
|
-
handleSubmit,
|
|
176
|
-
handleCancel,
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
// file_description: forgot password layout component built atop shared layout utilities
|
|
2
|
-
// section: client_directive
|
|
3
|
-
"use client";
|
|
4
|
-
|
|
5
|
-
// section: imports
|
|
6
|
-
import { Input } from "hazo_auth/components/ui/input";
|
|
7
|
-
import { FormFieldWrapper } from "hazo_auth/components/layouts/shared/components/form_field_wrapper";
|
|
8
|
-
import { FormHeader } from "hazo_auth/components/layouts/shared/components/form_header";
|
|
9
|
-
import { FormActionButtons } from "hazo_auth/components/layouts/shared/components/form_action_buttons";
|
|
10
|
-
import { TwoColumnAuthLayout } from "hazo_auth/components/layouts/shared/components/two_column_auth_layout";
|
|
11
|
-
import { AlreadyLoggedInGuard } from "hazo_auth/components/layouts/shared/components/already_logged_in_guard";
|
|
12
|
-
import {
|
|
13
|
-
type ButtonPaletteOverrides,
|
|
14
|
-
type LayoutFieldMapOverrides,
|
|
15
|
-
type LayoutLabelOverrides,
|
|
16
|
-
} from "hazo_auth/components/layouts/shared/config/layout_customization";
|
|
17
|
-
import {
|
|
18
|
-
FORGOT_PASSWORD_FIELD_IDS,
|
|
19
|
-
createForgotPasswordFieldDefinitions,
|
|
20
|
-
resolveForgotPasswordButtonPalette,
|
|
21
|
-
resolveForgotPasswordLabels,
|
|
22
|
-
} from "hazo_auth/components/layouts/forgot_password/config/forgot_password_field_config";
|
|
23
|
-
import {
|
|
24
|
-
use_forgot_password_form,
|
|
25
|
-
type UseForgotPasswordFormResult,
|
|
26
|
-
} from "hazo_auth/components/layouts/forgot_password/hooks/use_forgot_password_form";
|
|
27
|
-
import { type LayoutDataClient } from "hazo_auth/components/layouts/shared/data/layout_data_client";
|
|
28
|
-
|
|
29
|
-
// section: types
|
|
30
|
-
export type ForgotPasswordLayoutProps<TClient = unknown> = {
|
|
31
|
-
image_src: string;
|
|
32
|
-
image_alt: string;
|
|
33
|
-
image_background_color?: string;
|
|
34
|
-
field_overrides?: LayoutFieldMapOverrides;
|
|
35
|
-
labels?: LayoutLabelOverrides;
|
|
36
|
-
button_colors?: ButtonPaletteOverrides;
|
|
37
|
-
data_client: LayoutDataClient<TClient>;
|
|
38
|
-
alreadyLoggedInMessage?: string;
|
|
39
|
-
showLogoutButton?: boolean;
|
|
40
|
-
showReturnHomeButton?: boolean;
|
|
41
|
-
returnHomeButtonLabel?: string;
|
|
42
|
-
returnHomePath?: string;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const ORDERED_FIELDS: ForgotPasswordFieldId[] = [
|
|
46
|
-
FORGOT_PASSWORD_FIELD_IDS.EMAIL,
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
type ForgotPasswordFieldId = (typeof FORGOT_PASSWORD_FIELD_IDS)[keyof typeof FORGOT_PASSWORD_FIELD_IDS];
|
|
50
|
-
|
|
51
|
-
// section: component
|
|
52
|
-
export default function forgot_password_layout<TClient>({
|
|
53
|
-
image_src,
|
|
54
|
-
image_alt,
|
|
55
|
-
image_background_color = "#f1f5f9",
|
|
56
|
-
field_overrides,
|
|
57
|
-
labels,
|
|
58
|
-
button_colors,
|
|
59
|
-
data_client,
|
|
60
|
-
alreadyLoggedInMessage = "You are already logged in",
|
|
61
|
-
showLogoutButton = true,
|
|
62
|
-
showReturnHomeButton = false,
|
|
63
|
-
returnHomeButtonLabel = "Return home",
|
|
64
|
-
returnHomePath = "/",
|
|
65
|
-
}: ForgotPasswordLayoutProps<TClient>) {
|
|
66
|
-
const fieldDefinitions = createForgotPasswordFieldDefinitions(field_overrides);
|
|
67
|
-
const resolvedLabels = resolveForgotPasswordLabels(labels);
|
|
68
|
-
const resolvedButtonPalette = resolveForgotPasswordButtonPalette(button_colors);
|
|
69
|
-
|
|
70
|
-
const form = use_forgot_password_form({
|
|
71
|
-
dataClient: data_client,
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const renderFields = (formState: UseForgotPasswordFormResult) => {
|
|
75
|
-
return ORDERED_FIELDS.map((fieldId) => {
|
|
76
|
-
const fieldDefinition = fieldDefinitions[fieldId];
|
|
77
|
-
const fieldValue = formState.values[fieldId];
|
|
78
|
-
const fieldError = formState.errors[fieldId];
|
|
79
|
-
|
|
80
|
-
const inputElement = (
|
|
81
|
-
<Input
|
|
82
|
-
id={fieldDefinition.id}
|
|
83
|
-
type={fieldDefinition.type}
|
|
84
|
-
value={fieldValue}
|
|
85
|
-
onChange={(event) =>
|
|
86
|
-
formState.handleFieldChange(fieldId, event.target.value)
|
|
87
|
-
}
|
|
88
|
-
onBlur={
|
|
89
|
-
fieldId === FORGOT_PASSWORD_FIELD_IDS.EMAIL
|
|
90
|
-
? formState.handleEmailBlur
|
|
91
|
-
: undefined
|
|
92
|
-
}
|
|
93
|
-
autoComplete={fieldDefinition.autoComplete}
|
|
94
|
-
placeholder={fieldDefinition.placeholder}
|
|
95
|
-
aria-label={fieldDefinition.ariaLabel}
|
|
96
|
-
className="cls_forgot_password_layout_field_input"
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
// Only show email error if field has been touched (blurred)
|
|
101
|
-
const shouldShowError =
|
|
102
|
-
fieldId === FORGOT_PASSWORD_FIELD_IDS.EMAIL
|
|
103
|
-
? formState.emailTouched && fieldError
|
|
104
|
-
? fieldError
|
|
105
|
-
: undefined
|
|
106
|
-
: fieldError;
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<FormFieldWrapper
|
|
110
|
-
key={fieldId}
|
|
111
|
-
fieldId={fieldDefinition.id}
|
|
112
|
-
label={fieldDefinition.label}
|
|
113
|
-
input={inputElement}
|
|
114
|
-
errorMessage={shouldShowError}
|
|
115
|
-
/>
|
|
116
|
-
);
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<AlreadyLoggedInGuard
|
|
122
|
-
image_src={image_src}
|
|
123
|
-
image_alt={image_alt}
|
|
124
|
-
image_background_color={image_background_color}
|
|
125
|
-
message={alreadyLoggedInMessage}
|
|
126
|
-
showLogoutButton={showLogoutButton}
|
|
127
|
-
showReturnHomeButton={showReturnHomeButton}
|
|
128
|
-
returnHomeButtonLabel={returnHomeButtonLabel}
|
|
129
|
-
returnHomePath={returnHomePath}
|
|
130
|
-
>
|
|
131
|
-
<TwoColumnAuthLayout
|
|
132
|
-
imageSrc={image_src}
|
|
133
|
-
imageAlt={image_alt}
|
|
134
|
-
imageBackgroundColor={image_background_color}
|
|
135
|
-
formContent={
|
|
136
|
-
<>
|
|
137
|
-
<FormHeader
|
|
138
|
-
heading={resolvedLabels.heading}
|
|
139
|
-
subHeading={resolvedLabels.subHeading}
|
|
140
|
-
/>
|
|
141
|
-
<form
|
|
142
|
-
className="cls_forgot_password_layout_form_fields flex flex-col gap-5"
|
|
143
|
-
onSubmit={form.handleSubmit}
|
|
144
|
-
aria-label="Forgot password form"
|
|
145
|
-
>
|
|
146
|
-
{renderFields(form)}
|
|
147
|
-
<FormActionButtons
|
|
148
|
-
submitLabel={resolvedLabels.submitButton}
|
|
149
|
-
cancelLabel={resolvedLabels.cancelButton}
|
|
150
|
-
buttonPalette={resolvedButtonPalette}
|
|
151
|
-
isSubmitDisabled={form.isSubmitDisabled}
|
|
152
|
-
onCancel={form.handleCancel}
|
|
153
|
-
submitAriaLabel="Submit forgot password form"
|
|
154
|
-
cancelAriaLabel="Cancel forgot password form"
|
|
155
|
-
/>
|
|
156
|
-
{form.isSubmitting && (
|
|
157
|
-
<div className="cls_forgot_password_submitting_indicator text-sm text-slate-600 text-center">
|
|
158
|
-
Sending reset link...
|
|
159
|
-
</div>
|
|
160
|
-
)}
|
|
161
|
-
</form>
|
|
162
|
-
</>
|
|
163
|
-
}
|
|
164
|
-
/>
|
|
165
|
-
</AlreadyLoggedInGuard>
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
|