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
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// file_description: API route for uploading profile pictures
|
|
2
|
+
// section: imports
|
|
3
|
+
import { NextResponse } from "next/server";
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { get_profile_picture_config } from "../../../../lib/profile_picture_config.server";
|
|
7
|
+
import { get_file_types_config } from "../../../../lib/file_types_config.server";
|
|
8
|
+
import { update_user_profile_picture } from "../../../../lib/services/profile_picture_service";
|
|
9
|
+
import { createCrudService } from "hazo_connect/server";
|
|
10
|
+
import { map_db_source_to_ui } from "../../../../lib/services/profile_picture_source_mapper";
|
|
11
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
12
|
+
import fs from "fs";
|
|
13
|
+
import path from "path";
|
|
14
|
+
// section: api_handler
|
|
15
|
+
export async function POST(request) {
|
|
16
|
+
const logger = create_app_logger();
|
|
17
|
+
try {
|
|
18
|
+
// Use centralized auth check
|
|
19
|
+
let user_id;
|
|
20
|
+
try {
|
|
21
|
+
const { require_auth } = await import("../../../../lib/auth/auth_utils.server");
|
|
22
|
+
const user = await require_auth(request);
|
|
23
|
+
user_id = user.user_id;
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (error instanceof Error && error.message === "Authentication required") {
|
|
27
|
+
logger.warn("profile_picture_upload_authentication_failed", {
|
|
28
|
+
filename: get_filename(),
|
|
29
|
+
line_number: get_line_number(),
|
|
30
|
+
error: "User not authenticated",
|
|
31
|
+
});
|
|
32
|
+
return NextResponse.json({ error: "Authentication required" }, { status: 401 });
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
// Check if upload is enabled
|
|
37
|
+
const config = get_profile_picture_config();
|
|
38
|
+
if (!config.allow_photo_upload) {
|
|
39
|
+
logger.warn("profile_picture_upload_disabled", {
|
|
40
|
+
filename: get_filename(),
|
|
41
|
+
line_number: get_line_number(),
|
|
42
|
+
user_id,
|
|
43
|
+
});
|
|
44
|
+
return NextResponse.json({ error: "Photo upload is not enabled" }, { status: 403 });
|
|
45
|
+
}
|
|
46
|
+
if (!config.upload_photo_path) {
|
|
47
|
+
logger.warn("profile_picture_upload_path_not_configured", {
|
|
48
|
+
filename: get_filename(),
|
|
49
|
+
line_number: get_line_number(),
|
|
50
|
+
user_id,
|
|
51
|
+
});
|
|
52
|
+
return NextResponse.json({ error: "Upload path is not configured" }, { status: 500 });
|
|
53
|
+
}
|
|
54
|
+
// Get FormData
|
|
55
|
+
const formData = await request.formData();
|
|
56
|
+
const file = formData.get("file");
|
|
57
|
+
if (!file) {
|
|
58
|
+
logger.warn("profile_picture_upload_no_file", {
|
|
59
|
+
filename: get_filename(),
|
|
60
|
+
line_number: get_line_number(),
|
|
61
|
+
user_id,
|
|
62
|
+
});
|
|
63
|
+
return NextResponse.json({ error: "No file provided" }, { status: 400 });
|
|
64
|
+
}
|
|
65
|
+
// Validate file type
|
|
66
|
+
const fileTypes = get_file_types_config();
|
|
67
|
+
const fileType = file.type;
|
|
68
|
+
if (!fileTypes.allowed_image_mime_types.includes(fileType)) {
|
|
69
|
+
logger.warn("profile_picture_upload_invalid_type", {
|
|
70
|
+
filename: get_filename(),
|
|
71
|
+
line_number: get_line_number(),
|
|
72
|
+
user_id,
|
|
73
|
+
fileType,
|
|
74
|
+
});
|
|
75
|
+
return NextResponse.json({ error: "Invalid file type. Only JPG and PNG files are allowed." }, { status: 400 });
|
|
76
|
+
}
|
|
77
|
+
// Validate file size (should already be compressed client-side, but check server-side too)
|
|
78
|
+
const fileSize = file.size;
|
|
79
|
+
if (fileSize > config.max_photo_size) {
|
|
80
|
+
logger.warn("profile_picture_upload_too_large", {
|
|
81
|
+
filename: get_filename(),
|
|
82
|
+
line_number: get_line_number(),
|
|
83
|
+
user_id,
|
|
84
|
+
fileSize,
|
|
85
|
+
maxSize: config.max_photo_size,
|
|
86
|
+
});
|
|
87
|
+
return NextResponse.json({ error: `File size exceeds maximum allowed size of ${config.max_photo_size} bytes` }, { status: 400 });
|
|
88
|
+
}
|
|
89
|
+
// Get current user profile picture info before updating
|
|
90
|
+
const hazoConnect = get_hazo_connect_instance();
|
|
91
|
+
const users_service = createCrudService(hazoConnect, "hazo_users");
|
|
92
|
+
const current_users = await users_service.findBy({ id: user_id });
|
|
93
|
+
let oldProfilePictureUrl = null;
|
|
94
|
+
let oldProfileSource = null;
|
|
95
|
+
if (Array.isArray(current_users) && current_users.length > 0) {
|
|
96
|
+
const current_user = current_users[0];
|
|
97
|
+
oldProfilePictureUrl = current_user.profile_picture_url || null;
|
|
98
|
+
oldProfileSource = current_user.profile_source || null;
|
|
99
|
+
}
|
|
100
|
+
// Determine file extension from MIME type
|
|
101
|
+
const mimeToExt = {
|
|
102
|
+
"image/jpeg": "jpg",
|
|
103
|
+
"image/jpg": "jpg",
|
|
104
|
+
"image/png": "png",
|
|
105
|
+
};
|
|
106
|
+
const fileExtension = mimeToExt[fileType] || "jpg";
|
|
107
|
+
const fileName = `${user_id}.${fileExtension}`;
|
|
108
|
+
// Resolve upload path
|
|
109
|
+
const uploadPath = path.isAbsolute(config.upload_photo_path)
|
|
110
|
+
? config.upload_photo_path
|
|
111
|
+
: path.resolve(process.cwd(), config.upload_photo_path);
|
|
112
|
+
// Create upload directory if it doesn't exist
|
|
113
|
+
if (!fs.existsSync(uploadPath)) {
|
|
114
|
+
fs.mkdirSync(uploadPath, { recursive: true });
|
|
115
|
+
}
|
|
116
|
+
// Save file
|
|
117
|
+
const filePath = path.join(uploadPath, fileName);
|
|
118
|
+
const arrayBuffer = await file.arrayBuffer();
|
|
119
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
120
|
+
fs.writeFileSync(filePath, buffer);
|
|
121
|
+
// Generate URL (relative to public or absolute)
|
|
122
|
+
// For Next.js, we'll serve from a public route or use absolute path
|
|
123
|
+
// For now, use a relative path that can be served via API or static file serving
|
|
124
|
+
const profilePictureUrl = `/api/hazo_auth/profile_picture/${fileName}`;
|
|
125
|
+
// Update user record
|
|
126
|
+
const updateResult = await update_user_profile_picture(hazoConnect, user_id, profilePictureUrl, "upload");
|
|
127
|
+
if (!updateResult.success) {
|
|
128
|
+
// Clean up uploaded file
|
|
129
|
+
try {
|
|
130
|
+
fs.unlinkSync(filePath);
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
// Ignore cleanup errors
|
|
134
|
+
}
|
|
135
|
+
logger.warn("profile_picture_upload_update_failed", {
|
|
136
|
+
filename: get_filename(),
|
|
137
|
+
line_number: get_line_number(),
|
|
138
|
+
user_id,
|
|
139
|
+
error: updateResult.error,
|
|
140
|
+
});
|
|
141
|
+
return NextResponse.json({ error: updateResult.error || "Failed to update profile picture" }, { status: 500 });
|
|
142
|
+
}
|
|
143
|
+
// Delete old profile picture file if it exists and was an uploaded file
|
|
144
|
+
if (oldProfilePictureUrl && oldProfileSource) {
|
|
145
|
+
const oldSourceUI = map_db_source_to_ui(oldProfileSource);
|
|
146
|
+
// Only delete if the old profile picture was an uploaded file
|
|
147
|
+
if (oldSourceUI === "upload") {
|
|
148
|
+
try {
|
|
149
|
+
// Extract filename from URL (e.g., /api/hazo_auth/profile_picture/user_id.jpg)
|
|
150
|
+
const oldFileName = oldProfilePictureUrl.split("/").pop();
|
|
151
|
+
if (oldFileName) {
|
|
152
|
+
// Check if it's a user-specific file (starts with user_id)
|
|
153
|
+
if (oldFileName.startsWith(user_id)) {
|
|
154
|
+
const oldFilePath = path.join(uploadPath, oldFileName);
|
|
155
|
+
// Only delete if it's a different file (different extension)
|
|
156
|
+
if (oldFilePath !== filePath && fs.existsSync(oldFilePath)) {
|
|
157
|
+
fs.unlinkSync(oldFilePath);
|
|
158
|
+
logger.info("profile_picture_old_file_deleted", {
|
|
159
|
+
filename: get_filename(),
|
|
160
|
+
line_number: get_line_number(),
|
|
161
|
+
user_id,
|
|
162
|
+
oldFileName,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
// Log error but don't fail the request
|
|
170
|
+
logger.warn("profile_picture_old_file_delete_failed", {
|
|
171
|
+
filename: get_filename(),
|
|
172
|
+
line_number: get_line_number(),
|
|
173
|
+
user_id,
|
|
174
|
+
oldProfilePictureUrl,
|
|
175
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
logger.info("profile_picture_upload_successful", {
|
|
181
|
+
filename: get_filename(),
|
|
182
|
+
line_number: get_line_number(),
|
|
183
|
+
user_id,
|
|
184
|
+
fileName,
|
|
185
|
+
fileSize,
|
|
186
|
+
});
|
|
187
|
+
return NextResponse.json({
|
|
188
|
+
success: true,
|
|
189
|
+
profile_picture_url: profilePictureUrl,
|
|
190
|
+
message: "Profile picture uploaded successfully",
|
|
191
|
+
}, { status: 200 });
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
const error_message = error instanceof Error ? error.message : "Unknown error";
|
|
195
|
+
const error_stack = error instanceof Error ? error.stack : undefined;
|
|
196
|
+
logger.error("profile_picture_upload_error", {
|
|
197
|
+
filename: get_filename(),
|
|
198
|
+
line_number: get_line_number(),
|
|
199
|
+
error_message,
|
|
200
|
+
error_stack,
|
|
201
|
+
});
|
|
202
|
+
return NextResponse.json({ error: "Failed to upload profile picture. Please try again." }, { status: 500 });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/hazo_auth/validate_reset_token/route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOxD,eAAO,MAAM,OAAO,kBAAkB,CAAC;AAGvC,wBAAsB,GAAG,CAAC,OAAO,EAAE,WAAW;;IAqE7C"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// file_description: API route for validating password reset token without resetting password
|
|
2
|
+
// section: imports
|
|
3
|
+
import { NextResponse } from "next/server";
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { validate_password_reset_token } from "../../../../lib/services/password_reset_service";
|
|
6
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
|
+
// section: route_config
|
|
9
|
+
export const dynamic = 'force-dynamic';
|
|
10
|
+
// section: api_handler
|
|
11
|
+
export async function GET(request) {
|
|
12
|
+
const logger = create_app_logger();
|
|
13
|
+
try {
|
|
14
|
+
const { searchParams } = new URL(request.url);
|
|
15
|
+
const token = searchParams.get("token");
|
|
16
|
+
// Validate input
|
|
17
|
+
if (!token) {
|
|
18
|
+
logger.warn("password_reset_token_validation_failed", {
|
|
19
|
+
filename: get_filename(),
|
|
20
|
+
line_number: get_line_number(),
|
|
21
|
+
error: "Token is required",
|
|
22
|
+
});
|
|
23
|
+
return NextResponse.json({ success: false, error: "Token is required" }, { status: 400 });
|
|
24
|
+
}
|
|
25
|
+
// Get singleton hazo_connect instance (reuses same connection across all routes)
|
|
26
|
+
const hazoConnect = get_hazo_connect_instance();
|
|
27
|
+
// Validate token using the password reset service
|
|
28
|
+
const result = await validate_password_reset_token(hazoConnect, {
|
|
29
|
+
token,
|
|
30
|
+
});
|
|
31
|
+
if (!result.success) {
|
|
32
|
+
logger.warn("password_reset_token_validation_failed", {
|
|
33
|
+
filename: get_filename(),
|
|
34
|
+
line_number: get_line_number(),
|
|
35
|
+
error: result.error,
|
|
36
|
+
});
|
|
37
|
+
return NextResponse.json({
|
|
38
|
+
success: false,
|
|
39
|
+
error: result.error || "Invalid or expired reset token",
|
|
40
|
+
}, { status: 400 });
|
|
41
|
+
}
|
|
42
|
+
return NextResponse.json({
|
|
43
|
+
success: true,
|
|
44
|
+
}, { status: 200 });
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
const error_message = error instanceof Error ? error.message : "Unknown error";
|
|
48
|
+
logger.error("password_reset_token_validation_error", {
|
|
49
|
+
filename: get_filename(),
|
|
50
|
+
line_number: get_line_number(),
|
|
51
|
+
error: error_message,
|
|
52
|
+
});
|
|
53
|
+
return NextResponse.json({
|
|
54
|
+
success: false,
|
|
55
|
+
error: "An error occurred while validating the reset token",
|
|
56
|
+
}, { status: 500 });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
2
|
+
export declare const dynamic = "force-dynamic";
|
|
3
|
+
export declare function GET(request: NextRequest): Promise<NextResponse<{
|
|
4
|
+
error: string;
|
|
5
|
+
}> | NextResponse<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
message: string;
|
|
8
|
+
user_id: string | undefined;
|
|
9
|
+
email: string | undefined;
|
|
10
|
+
}>>;
|
|
11
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/hazo_auth/verify_email/route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOxD,eAAO,MAAM,OAAO,kBAAkB,CAAC;AAGvC,wBAAsB,GAAG,CAAC,OAAO,EAAE,WAAW;;;;;;;IA0E7C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// file_description: API route for email verification using hazo_connect
|
|
2
|
+
// section: imports
|
|
3
|
+
import { NextResponse } from "next/server";
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { verify_email_token } from "../../../../lib/services/email_verification_service";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
|
+
// section: route_config
|
|
9
|
+
export const dynamic = 'force-dynamic';
|
|
10
|
+
// section: api_handler
|
|
11
|
+
export async function GET(request) {
|
|
12
|
+
const logger = create_app_logger();
|
|
13
|
+
try {
|
|
14
|
+
const { searchParams } = new URL(request.url);
|
|
15
|
+
const token = searchParams.get("token");
|
|
16
|
+
// Validate input
|
|
17
|
+
if (!token) {
|
|
18
|
+
logger.warn("email_verification_validation_failed", {
|
|
19
|
+
filename: get_filename(),
|
|
20
|
+
line_number: get_line_number(),
|
|
21
|
+
has_token: false,
|
|
22
|
+
});
|
|
23
|
+
return NextResponse.json({ error: "Verification token is required" }, { status: 400 });
|
|
24
|
+
}
|
|
25
|
+
// Get singleton hazo_connect instance (reuses same connection across all routes)
|
|
26
|
+
const hazoConnect = get_hazo_connect_instance();
|
|
27
|
+
// Verify email token using the email verification service
|
|
28
|
+
const result = await verify_email_token(hazoConnect, {
|
|
29
|
+
token,
|
|
30
|
+
});
|
|
31
|
+
if (!result.success) {
|
|
32
|
+
logger.warn("email_verification_failed", {
|
|
33
|
+
filename: get_filename(),
|
|
34
|
+
line_number: get_line_number(),
|
|
35
|
+
error: result.error,
|
|
36
|
+
});
|
|
37
|
+
return NextResponse.json({ error: result.error || "Email verification failed" }, { status: 400 });
|
|
38
|
+
}
|
|
39
|
+
logger.info("email_verification_successful", {
|
|
40
|
+
filename: get_filename(),
|
|
41
|
+
line_number: get_line_number(),
|
|
42
|
+
user_id: result.user_id,
|
|
43
|
+
email: result.email,
|
|
44
|
+
});
|
|
45
|
+
return NextResponse.json({
|
|
46
|
+
success: true,
|
|
47
|
+
message: "Email verified successfully",
|
|
48
|
+
user_id: result.user_id,
|
|
49
|
+
email: result.email,
|
|
50
|
+
}, { status: 200 });
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
const error_message = error instanceof Error ? error.message : "Unknown error";
|
|
54
|
+
const error_stack = error instanceof Error ? error.stack : undefined;
|
|
55
|
+
logger.error("email_verification_error", {
|
|
56
|
+
filename: get_filename(),
|
|
57
|
+
line_number: get_line_number(),
|
|
58
|
+
error_message,
|
|
59
|
+
error_stack,
|
|
60
|
+
});
|
|
61
|
+
return NextResponse.json({ error: "Email verification failed. Please try again." }, { status: 500 });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/cli/generate.ts"],"names":[],"mappings":"AA0EA,wBAAgB,eAAe,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAwE7D"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// file_description: route generation logic for hazo_auth
|
|
2
|
+
// This module creates API route files in consuming projects
|
|
3
|
+
import * as fs from "fs";
|
|
4
|
+
import * as path from "path";
|
|
5
|
+
// section: constants
|
|
6
|
+
const ROUTES = [
|
|
7
|
+
{ name: "login", path: "api/hazo_auth/login", method: "POST", export_name: "loginPOST" },
|
|
8
|
+
{ name: "register", path: "api/hazo_auth/register", method: "POST", export_name: "registerPOST" },
|
|
9
|
+
{ name: "logout", path: "api/hazo_auth/logout", method: "POST", export_name: "logoutPOST" },
|
|
10
|
+
{ name: "me", path: "api/hazo_auth/me", method: "GET", export_name: "meGET" },
|
|
11
|
+
{ name: "forgot_password", path: "api/hazo_auth/forgot_password", method: "POST", export_name: "forgotPasswordPOST" },
|
|
12
|
+
{ name: "reset_password", path: "api/hazo_auth/reset_password", method: "POST", export_name: "resetPasswordPOST" },
|
|
13
|
+
{ name: "verify_email", path: "api/hazo_auth/verify_email", method: "GET", export_name: "verifyEmailGET" },
|
|
14
|
+
{ name: "resend_verification", path: "api/hazo_auth/resend_verification", method: "POST", export_name: "resendVerificationPOST" },
|
|
15
|
+
{ name: "update_user", path: "api/hazo_auth/update_user", method: "PATCH", export_name: "updateUserPATCH" },
|
|
16
|
+
{ name: "change_password", path: "api/hazo_auth/change_password", method: "POST", export_name: "changePasswordPOST" },
|
|
17
|
+
{ name: "upload_profile_picture", path: "api/hazo_auth/upload_profile_picture", method: "POST", export_name: "uploadProfilePicturePOST" },
|
|
18
|
+
{ name: "remove_profile_picture", path: "api/hazo_auth/remove_profile_picture", method: "DELETE", export_name: "removeProfilePictureDELETE" },
|
|
19
|
+
{ name: "library_photos", path: "api/hazo_auth/library_photos", method: "GET", export_name: "libraryPhotosGET" },
|
|
20
|
+
{ name: "get_auth", path: "api/hazo_auth/get_auth", method: "POST", export_name: "getAuthPOST" },
|
|
21
|
+
{ name: "validate_reset_token", path: "api/hazo_auth/validate_reset_token", method: "GET", export_name: "validateResetTokenGET" },
|
|
22
|
+
{ name: "profile_picture_filename", path: "api/hazo_auth/profile_picture/[filename]", method: "GET", export_name: "profilePictureFilenameGET" },
|
|
23
|
+
{ name: "invalidate_cache", path: "api/hazo_auth/invalidate_cache", method: "POST", export_name: "invalidateCachePOST" },
|
|
24
|
+
];
|
|
25
|
+
// section: helpers
|
|
26
|
+
function get_project_root() {
|
|
27
|
+
return process.cwd();
|
|
28
|
+
}
|
|
29
|
+
function find_app_dir(project_root) {
|
|
30
|
+
const possible_dirs = [
|
|
31
|
+
path.join(project_root, "app"),
|
|
32
|
+
path.join(project_root, "src", "app"),
|
|
33
|
+
];
|
|
34
|
+
for (const dir of possible_dirs) {
|
|
35
|
+
if (fs.existsSync(dir)) {
|
|
36
|
+
return dir;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
function ensure_dir(dir_path) {
|
|
42
|
+
if (!fs.existsSync(dir_path)) {
|
|
43
|
+
fs.mkdirSync(dir_path, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function generate_route_content(route) {
|
|
47
|
+
return `// Generated by hazo_auth - do not edit manually
|
|
48
|
+
// Route: /${route.path}
|
|
49
|
+
// Method: ${route.method}
|
|
50
|
+
export { ${route.export_name} as ${route.method} } from "hazo_auth/server/routes";
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
function file_exists(filepath) {
|
|
54
|
+
return fs.existsSync(filepath);
|
|
55
|
+
}
|
|
56
|
+
// section: main
|
|
57
|
+
export function generate_routes(custom_app_dir) {
|
|
58
|
+
const project_root = get_project_root();
|
|
59
|
+
console.log("\n\x1b[1m🐸 hazo_auth Route Generator\x1b[0m");
|
|
60
|
+
console.log("=".repeat(50));
|
|
61
|
+
console.log(`Project root: ${project_root}\n`);
|
|
62
|
+
let app_dir = custom_app_dir
|
|
63
|
+
? path.join(project_root, custom_app_dir)
|
|
64
|
+
: find_app_dir(project_root);
|
|
65
|
+
if (!app_dir) {
|
|
66
|
+
console.error("\x1b[31mError: Could not find app directory.\x1b[0m");
|
|
67
|
+
console.log("Try specifying it with: npx hazo_auth generate-routes --dir=src/app");
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
if (!fs.existsSync(app_dir)) {
|
|
71
|
+
console.error(`\x1b[31mError: App directory not found: ${app_dir}\x1b[0m`);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
console.log(`App directory: ${app_dir.replace(project_root, ".")}\n`);
|
|
75
|
+
let created = 0;
|
|
76
|
+
let skipped = 0;
|
|
77
|
+
let errors = 0;
|
|
78
|
+
console.log("\x1b[1mGenerating routes...\x1b[0m\n");
|
|
79
|
+
for (const route of ROUTES) {
|
|
80
|
+
const route_dir = path.join(app_dir, route.path);
|
|
81
|
+
const route_file = path.join(route_dir, "route.ts");
|
|
82
|
+
if (file_exists(route_file)) {
|
|
83
|
+
console.log(`\x1b[33m[SKIP]\x1b[0m ${route.path}/route.ts (already exists)`);
|
|
84
|
+
skipped++;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
ensure_dir(route_dir);
|
|
89
|
+
const content = generate_route_content(route);
|
|
90
|
+
fs.writeFileSync(route_file, content, "utf-8");
|
|
91
|
+
console.log(`\x1b[32m[CREATE]\x1b[0m ${route.path}/route.ts`);
|
|
92
|
+
created++;
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
console.log(`\x1b[31m[ERROR]\x1b[0m ${route.path}/route.ts - ${err instanceof Error ? err.message : "Unknown error"}`);
|
|
96
|
+
errors++;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
console.log("\n" + "=".repeat(50));
|
|
100
|
+
console.log("\x1b[1mSummary:\x1b[0m");
|
|
101
|
+
console.log(` \x1b[32m✓ Created: ${created}\x1b[0m`);
|
|
102
|
+
console.log(` \x1b[33m⊘ Skipped: ${skipped}\x1b[0m`);
|
|
103
|
+
if (errors > 0) {
|
|
104
|
+
console.log(` \x1b[31m✗ Errors: ${errors}\x1b[0m`);
|
|
105
|
+
}
|
|
106
|
+
console.log();
|
|
107
|
+
if (created > 0) {
|
|
108
|
+
console.log("\x1b[32m🦊 Routes generated successfully!\x1b[0m");
|
|
109
|
+
console.log("\nNext steps:");
|
|
110
|
+
console.log(" 1. Run `npm run dev` to start your development server");
|
|
111
|
+
console.log(" 2. Test the routes with `curl http://localhost:3000/api/hazo_auth/me`");
|
|
112
|
+
console.log(" 3. Visit http://localhost:3000/api/hazo_auth/health to check setup status\n");
|
|
113
|
+
}
|
|
114
|
+
else if (skipped === ROUTES.length) {
|
|
115
|
+
console.log("\x1b[33m🦊 All routes already exist. No changes made.\x1b[0m\n");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// file_description: main CLI entry point for hazo_auth commands
|
|
3
|
+
// This file is the bin entry for the hazo_auth package
|
|
4
|
+
// section: imports
|
|
5
|
+
import { run_validation } from "./validate.js";
|
|
6
|
+
import { generate_routes } from "./generate.js";
|
|
7
|
+
// section: constants
|
|
8
|
+
const VERSION = "1.5.0";
|
|
9
|
+
const HELP_TEXT = `
|
|
10
|
+
\x1b[1m🐸 hazo_auth CLI v${VERSION}\x1b[0m
|
|
11
|
+
|
|
12
|
+
Usage: hazo_auth <command> [options]
|
|
13
|
+
|
|
14
|
+
Commands:
|
|
15
|
+
validate Check your hazo_auth setup and configuration
|
|
16
|
+
generate-routes Generate API route files in your project
|
|
17
|
+
|
|
18
|
+
Options:
|
|
19
|
+
--help, -h Show this help message
|
|
20
|
+
--version, -v Show version number
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
npx hazo_auth validate
|
|
24
|
+
npx hazo_auth generate-routes
|
|
25
|
+
npx hazo_auth generate-routes --dir=src/app
|
|
26
|
+
|
|
27
|
+
Documentation:
|
|
28
|
+
https://github.com/your-repo/hazo_auth/blob/main/SETUP_CHECKLIST.md
|
|
29
|
+
|
|
30
|
+
🦊
|
|
31
|
+
`;
|
|
32
|
+
// section: helpers
|
|
33
|
+
function parse_args() {
|
|
34
|
+
const argv = process.argv.slice(2);
|
|
35
|
+
const result = { args: [] };
|
|
36
|
+
for (const arg of argv) {
|
|
37
|
+
if (arg === "--help" || arg === "-h") {
|
|
38
|
+
result.help = true;
|
|
39
|
+
}
|
|
40
|
+
else if (arg === "--version" || arg === "-v") {
|
|
41
|
+
result.version = true;
|
|
42
|
+
}
|
|
43
|
+
else if (!arg.startsWith("-") && !result.command) {
|
|
44
|
+
result.command = arg;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
result.args.push(arg);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
function show_help() {
|
|
53
|
+
console.log(HELP_TEXT);
|
|
54
|
+
}
|
|
55
|
+
function show_version() {
|
|
56
|
+
console.log(`hazo_auth v${VERSION}`);
|
|
57
|
+
}
|
|
58
|
+
// section: command_handlers
|
|
59
|
+
async function handle_validate() {
|
|
60
|
+
const summary = run_validation();
|
|
61
|
+
process.exit(summary.failed > 0 ? 1 : 0);
|
|
62
|
+
}
|
|
63
|
+
function handle_generate_routes(args) {
|
|
64
|
+
// Parse --dir argument
|
|
65
|
+
let dir;
|
|
66
|
+
for (const arg of args) {
|
|
67
|
+
if (arg.startsWith("--dir=")) {
|
|
68
|
+
dir = arg.replace("--dir=", "");
|
|
69
|
+
}
|
|
70
|
+
else if (arg === "--help" || arg === "-h") {
|
|
71
|
+
console.log(`
|
|
72
|
+
hazo_auth generate-routes
|
|
73
|
+
|
|
74
|
+
Generate API route files in your Next.js project.
|
|
75
|
+
|
|
76
|
+
Usage:
|
|
77
|
+
hazo_auth generate-routes [options]
|
|
78
|
+
|
|
79
|
+
Options:
|
|
80
|
+
--dir=<path> Specify the app directory (default: auto-detect)
|
|
81
|
+
--help, -h Show this help message
|
|
82
|
+
|
|
83
|
+
Examples:
|
|
84
|
+
hazo_auth generate-routes
|
|
85
|
+
hazo_auth generate-routes --dir=src/app
|
|
86
|
+
`);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
generate_routes(dir);
|
|
91
|
+
}
|
|
92
|
+
// section: main
|
|
93
|
+
async function main() {
|
|
94
|
+
const { command, args, help, version } = parse_args();
|
|
95
|
+
if (version) {
|
|
96
|
+
show_version();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (help || !command) {
|
|
100
|
+
show_help();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
switch (command) {
|
|
104
|
+
case "validate":
|
|
105
|
+
await handle_validate();
|
|
106
|
+
break;
|
|
107
|
+
case "generate-routes":
|
|
108
|
+
handle_generate_routes(args);
|
|
109
|
+
break;
|
|
110
|
+
default:
|
|
111
|
+
console.error(`\x1b[31mUnknown command: ${command}\x1b[0m\n`);
|
|
112
|
+
console.log("Run 'hazo_auth --help' for usage information.");
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Run main
|
|
117
|
+
main().catch((error) => {
|
|
118
|
+
console.error("\x1b[31mError:\x1b[0m", error.message);
|
|
119
|
+
process.exit(1);
|
|
120
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type CheckStatus = "pass" | "fail" | "warn";
|
|
2
|
+
type CheckResult = {
|
|
3
|
+
name: string;
|
|
4
|
+
status: CheckStatus;
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
export type ValidationSummary = {
|
|
8
|
+
passed: number;
|
|
9
|
+
failed: number;
|
|
10
|
+
warnings: number;
|
|
11
|
+
results: CheckResult[];
|
|
12
|
+
};
|
|
13
|
+
export declare function run_validation(): ValidationSummary;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/cli/validate.ts"],"names":[],"mappings":"AAOA,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC;AA4dF,wBAAgB,cAAc,IAAI,iBAAiB,CAqElD"}
|