@adonis-agora/authkit-server 0.34.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/LICENSE +21 -0
- package/README.md +158 -0
- package/build/assets/grafana/authkit-dashboard.json +118 -0
- package/build/commands/clients_create.d.ts +27 -0
- package/build/commands/clients_create.js +121 -0
- package/build/commands/commands.json +292 -0
- package/build/commands/configure.d.ts +2 -0
- package/build/commands/configure.js +45 -0
- package/build/commands/doctor.d.ts +10 -0
- package/build/commands/doctor.js +113 -0
- package/build/commands/eject.d.ts +11 -0
- package/build/commands/eject.js +96 -0
- package/build/commands/expire_scan.d.ts +28 -0
- package/build/commands/expire_scan.js +92 -0
- package/build/commands/import_users.d.ts +17 -0
- package/build/commands/import_users.js +80 -0
- package/build/commands/keys_rotate.d.ts +21 -0
- package/build/commands/keys_rotate.js +126 -0
- package/build/commands/main.d.ts +12 -0
- package/build/commands/main.js +38 -0
- package/build/commands/settings_get.d.ts +18 -0
- package/build/commands/settings_get.js +43 -0
- package/build/commands/settings_list.d.ts +17 -0
- package/build/commands/settings_list.js +39 -0
- package/build/commands/settings_set.d.ts +20 -0
- package/build/commands/settings_set.js +55 -0
- package/build/commands/settings_unset.d.ts +18 -0
- package/build/commands/settings_unset.js +46 -0
- package/build/commands/ui_preset.d.ts +4 -0
- package/build/commands/ui_preset.js +32 -0
- package/build/database/migrations/make_authkit_oidc_table.d.ts +6 -0
- package/build/database/migrations/make_authkit_oidc_table.js +19 -0
- package/build/host/ui/admin.html +29 -0
- package/build/host/views/account/apps.edge +59 -0
- package/build/host/views/account/confirm.edge +70 -0
- package/build/host/views/account/email-confirmed.edge +16 -0
- package/build/host/views/account/login.edge +33 -0
- package/build/host/views/account/mfa.edge +152 -0
- package/build/host/views/account/orgs.edge +58 -0
- package/build/host/views/account/security.edge +215 -0
- package/build/host/views/account/tokens.edge +75 -0
- package/build/host/views/consent.edge +20 -0
- package/build/host/views/forgot.edge +43 -0
- package/build/host/views/login.edge +251 -0
- package/build/host/views/maintenance.edge +32 -0
- package/build/host/views/mfa-challenge.edge +107 -0
- package/build/host/views/otp-unlock.edge +40 -0
- package/build/host/views/partials/styles.edge +2 -0
- package/build/host/views/reset.edge +30 -0
- package/build/host/views/signup.edge +62 -0
- package/build/host/views/verify-email.edge +17 -0
- package/build/index.d.ts +115 -0
- package/build/index.js +76 -0
- package/build/password/common_passwords.txt +10000 -0
- package/build/providers/authkit_server_provider.d.ts +27 -0
- package/build/providers/authkit_server_provider.js +242 -0
- package/build/src/accounts/account_store.d.ts +578 -0
- package/build/src/accounts/account_store.js +60 -0
- package/build/src/accounts/lucid_account_store.d.ts +156 -0
- package/build/src/accounts/lucid_account_store.js +294 -0
- package/build/src/accounts/lucid_store/core.d.ts +9 -0
- package/build/src/accounts/lucid_store/core.js +306 -0
- package/build/src/accounts/lucid_store/mfa.d.ts +15 -0
- package/build/src/accounts/lucid_store/mfa.js +108 -0
- package/build/src/accounts/lucid_store/organizations.d.ts +13 -0
- package/build/src/accounts/lucid_store/organizations.js +294 -0
- package/build/src/accounts/lucid_store/password_hygiene.d.ts +20 -0
- package/build/src/accounts/lucid_store/password_hygiene.js +130 -0
- package/build/src/accounts/lucid_store/provider_identity.d.ts +8 -0
- package/build/src/accounts/lucid_store/provider_identity.js +59 -0
- package/build/src/accounts/lucid_store/shared.d.ts +113 -0
- package/build/src/accounts/lucid_store/shared.js +130 -0
- package/build/src/accounts/lucid_store/status_profile.d.ts +34 -0
- package/build/src/accounts/lucid_store/status_profile.js +100 -0
- package/build/src/accounts/lucid_store/webauthn.d.ts +8 -0
- package/build/src/accounts/lucid_store/webauthn.js +140 -0
- package/build/src/accounts/lucid_stores.d.ts +45 -0
- package/build/src/accounts/lucid_stores.js +30 -0
- package/build/src/adapters/adapter_contract.d.ts +37 -0
- package/build/src/adapters/adapter_contract.js +1 -0
- package/build/src/adapters/database_adapter.d.ts +21 -0
- package/build/src/adapters/database_adapter.js +79 -0
- package/build/src/adapters/factory.d.ts +30 -0
- package/build/src/adapters/factory.js +43 -0
- package/build/src/adapters/redis_adapter.d.ts +24 -0
- package/build/src/adapters/redis_adapter.js +122 -0
- package/build/src/audit/audit_sink.d.ts +63 -0
- package/build/src/audit/audit_sink.js +1 -0
- package/build/src/audit/lucid_audit_sink.d.ts +10 -0
- package/build/src/audit/lucid_audit_sink.js +99 -0
- package/build/src/commands/expire_scan_command.d.ts +60 -0
- package/build/src/commands/expire_scan_command.js +229 -0
- package/build/src/commands/import_clients.d.ts +40 -0
- package/build/src/commands/import_clients.js +79 -0
- package/build/src/commands/import_users.d.ts +51 -0
- package/build/src/commands/import_users.js +94 -0
- package/build/src/commands/resolve_config.d.ts +13 -0
- package/build/src/commands/resolve_config.js +18 -0
- package/build/src/commands/settings_commands.d.ts +47 -0
- package/build/src/commands/settings_commands.js +270 -0
- package/build/src/controllers/oidc_callback_controller.d.ts +22 -0
- package/build/src/controllers/oidc_callback_controller.js +33 -0
- package/build/src/define_config.d.ts +772 -0
- package/build/src/define_config.js +351 -0
- package/build/src/doctor/checks.d.ts +197 -0
- package/build/src/doctor/checks.js +858 -0
- package/build/src/events/dispatcher.d.ts +45 -0
- package/build/src/events/dispatcher.js +117 -0
- package/build/src/host/account_api/account_api_controller.d.ts +245 -0
- package/build/src/host/account_api/account_api_controller.js +827 -0
- package/build/src/host/account_deletion_ops.d.ts +80 -0
- package/build/src/host/account_deletion_ops.js +118 -0
- package/build/src/host/account_deletion_service.d.ts +63 -0
- package/build/src/host/account_deletion_service.js +133 -0
- package/build/src/host/account_export_service.d.ts +76 -0
- package/build/src/host/account_export_service.js +140 -0
- package/build/src/host/account_home.d.ts +11 -0
- package/build/src/host/account_home.js +11 -0
- package/build/src/host/account_lockout.d.ts +86 -0
- package/build/src/host/account_lockout.js +185 -0
- package/build/src/host/active_org_cookie.d.ts +28 -0
- package/build/src/host/active_org_cookie.js +47 -0
- package/build/src/host/admin_api/admin_api_guard.d.ts +16 -0
- package/build/src/host/admin_api/admin_api_guard.js +59 -0
- package/build/src/host/admin_api/admin_orgs_service.d.ts +125 -0
- package/build/src/host/admin_api/admin_orgs_service.js +324 -0
- package/build/src/host/admin_api/admin_users_service.d.ts +163 -0
- package/build/src/host/admin_api/admin_users_service.js +308 -0
- package/build/src/host/admin_api/api_clients_controller.d.ts +54 -0
- package/build/src/host/admin_api/api_clients_controller.js +89 -0
- package/build/src/host/admin_api/api_keys_controller.d.ts +19 -0
- package/build/src/host/admin_api/api_keys_controller.js +36 -0
- package/build/src/host/admin_api/api_misc_controller.d.ts +19 -0
- package/build/src/host/admin_api/api_misc_controller.js +44 -0
- package/build/src/host/admin_api/api_orgs_controller.d.ts +108 -0
- package/build/src/host/admin_api/api_orgs_controller.js +189 -0
- package/build/src/host/admin_api/api_settings_controller.d.ts +55 -0
- package/build/src/host/admin_api/api_settings_controller.js +134 -0
- package/build/src/host/admin_api/api_users_controller.d.ts +108 -0
- package/build/src/host/admin_api/api_users_controller.js +187 -0
- package/build/src/host/admin_api/dto.d.ts +131 -0
- package/build/src/host/admin_api/dto.js +122 -0
- package/build/src/host/admin_api/token_verify_service.d.ts +34 -0
- package/build/src/host/admin_api/token_verify_service.js +74 -0
- package/build/src/host/admin_clients_service.d.ts +88 -0
- package/build/src/host/admin_clients_service.js +181 -0
- package/build/src/host/admin_console/admin_shell_controller.d.ts +27 -0
- package/build/src/host/admin_console/admin_shell_controller.js +167 -0
- package/build/src/host/admin_console/console_audit_controller.d.ts +17 -0
- package/build/src/host/admin_console/console_audit_controller.js +25 -0
- package/build/src/host/admin_console/console_clients_controller.d.ts +53 -0
- package/build/src/host/admin_console/console_clients_controller.js +102 -0
- package/build/src/host/admin_console/console_impersonation_controller.d.ts +23 -0
- package/build/src/host/admin_console/console_impersonation_controller.js +45 -0
- package/build/src/host/admin_console/console_keys_controller.d.ts +24 -0
- package/build/src/host/admin_console/console_keys_controller.js +41 -0
- package/build/src/host/admin_console/console_orgs_controller.d.ts +96 -0
- package/build/src/host/admin_console/console_orgs_controller.js +238 -0
- package/build/src/host/admin_console/console_overview_controller.d.ts +27 -0
- package/build/src/host/admin_console/console_overview_controller.js +44 -0
- package/build/src/host/admin_console/console_roles_controller.d.ts +31 -0
- package/build/src/host/admin_console/console_roles_controller.js +108 -0
- package/build/src/host/admin_console/console_sessions_controller.d.ts +91 -0
- package/build/src/host/admin_console/console_sessions_controller.js +125 -0
- package/build/src/host/admin_console/console_settings_controller.d.ts +47 -0
- package/build/src/host/admin_console/console_settings_controller.js +115 -0
- package/build/src/host/admin_console/console_users_controller.d.ts +110 -0
- package/build/src/host/admin_console/console_users_controller.js +212 -0
- package/build/src/host/admin_prefix.d.ts +50 -0
- package/build/src/host/admin_prefix.js +77 -0
- package/build/src/host/admin_sessions_service.d.ts +119 -0
- package/build/src/host/admin_sessions_service.js +284 -0
- package/build/src/host/admin_stats_service.d.ts +44 -0
- package/build/src/host/admin_stats_service.js +130 -0
- package/build/src/host/admin_validators.d.ts +247 -0
- package/build/src/host/admin_validators.js +197 -0
- package/build/src/host/augmentations.d.ts +12 -0
- package/build/src/host/augmentations.js +1 -0
- package/build/src/host/auth_host_config.d.ts +22 -0
- package/build/src/host/auth_host_config.js +13 -0
- package/build/src/host/avatar_storage.d.ts +68 -0
- package/build/src/host/avatar_storage.js +166 -0
- package/build/src/host/bot_protection.d.ts +187 -0
- package/build/src/host/bot_protection.js +132 -0
- package/build/src/host/branding.d.ts +19 -0
- package/build/src/host/branding.js +8 -0
- package/build/src/host/config_locks.d.ts +38 -0
- package/build/src/host/config_locks.js +70 -0
- package/build/src/host/console_session.d.ts +27 -0
- package/build/src/host/console_session.js +36 -0
- package/build/src/host/controllers/account_apps_controller.d.ts +15 -0
- package/build/src/host/controllers/account_apps_controller.js +61 -0
- package/build/src/host/controllers/account_confirm_controller.d.ts +24 -0
- package/build/src/host/controllers/account_confirm_controller.js +144 -0
- package/build/src/host/controllers/account_mfa_controller.d.ts +28 -0
- package/build/src/host/controllers/account_mfa_controller.js +208 -0
- package/build/src/host/controllers/account_orgs_controller.d.ts +80 -0
- package/build/src/host/controllers/account_orgs_controller.js +401 -0
- package/build/src/host/controllers/account_security_controller.d.ts +43 -0
- package/build/src/host/controllers/account_security_controller.js +546 -0
- package/build/src/host/controllers/account_session_controller.d.ts +21 -0
- package/build/src/host/controllers/account_session_controller.js +113 -0
- package/build/src/host/controllers/account_tokens_controller.d.ts +7 -0
- package/build/src/host/controllers/account_tokens_controller.js +67 -0
- package/build/src/host/controllers/interaction_controller.d.ts +125 -0
- package/build/src/host/controllers/interaction_controller.js +981 -0
- package/build/src/host/controllers/pat_introspection_controller.d.ts +22 -0
- package/build/src/host/controllers/pat_introspection_controller.js +46 -0
- package/build/src/host/controllers/registration_controller.d.ts +18 -0
- package/build/src/host/controllers/registration_controller.js +382 -0
- package/build/src/host/controllers/social_controller.d.ts +8 -0
- package/build/src/host/controllers/social_controller.js +89 -0
- package/build/src/host/csrf.d.ts +29 -0
- package/build/src/host/csrf.js +14 -0
- package/build/src/host/default_mailer.d.ts +112 -0
- package/build/src/host/default_mailer.js +417 -0
- package/build/src/host/durable/account_deletion_workflow.d.ts +48 -0
- package/build/src/host/durable/account_deletion_workflow.js +86 -0
- package/build/src/host/durable/account_export_workflow.d.ts +68 -0
- package/build/src/host/durable/account_export_workflow.js +93 -0
- package/build/src/host/durable/index.d.ts +68 -0
- package/build/src/host/durable/index.js +77 -0
- package/build/src/host/email_templates.d.ts +39 -0
- package/build/src/host/email_templates.js +69 -0
- package/build/src/host/geo.d.ts +22 -0
- package/build/src/host/geo.js +39 -0
- package/build/src/host/i18n.d.ts +1416 -0
- package/build/src/host/i18n.js +1583 -0
- package/build/src/host/impersonation.d.ts +25 -0
- package/build/src/host/impersonation.js +31 -0
- package/build/src/host/key_rotation.d.ts +14 -0
- package/build/src/host/key_rotation.js +27 -0
- package/build/src/host/key_rotation_actions.d.ts +42 -0
- package/build/src/host/key_rotation_actions.js +27 -0
- package/build/src/host/login_attempt.d.ts +98 -0
- package/build/src/host/login_attempt.js +211 -0
- package/build/src/host/login_notify.d.ts +27 -0
- package/build/src/host/login_notify.js +142 -0
- package/build/src/host/middleware/account_auth.d.ts +7 -0
- package/build/src/host/middleware/account_auth.js +11 -0
- package/build/src/host/otp_lockout.d.ts +103 -0
- package/build/src/host/otp_lockout.js +221 -0
- package/build/src/host/rate_limit.d.ts +39 -0
- package/build/src/host/rate_limit.js +94 -0
- package/build/src/host/register_auth_host.d.ts +97 -0
- package/build/src/host/register_auth_host.js +466 -0
- package/build/src/host/renderers/edge_renderer.d.ts +12 -0
- package/build/src/host/renderers/edge_renderer.js +38 -0
- package/build/src/host/renderers/inertia_renderer.d.ts +70 -0
- package/build/src/host/renderers/inertia_renderer.js +54 -0
- package/build/src/host/runtime_settings.d.ts +181 -0
- package/build/src/host/runtime_settings.js +307 -0
- package/build/src/host/runtime_toggles.d.ts +807 -0
- package/build/src/host/runtime_toggles.js +784 -0
- package/build/src/host/security_notice_service.d.ts +36 -0
- package/build/src/host/security_notice_service.js +87 -0
- package/build/src/host/session_context.d.ts +23 -0
- package/build/src/host/session_context.js +89 -0
- package/build/src/host/sudo_mode.d.ts +56 -0
- package/build/src/host/sudo_mode.js +99 -0
- package/build/src/host/svg_chart.d.ts +15 -0
- package/build/src/host/svg_chart.js +45 -0
- package/build/src/host/trusted_device.d.ts +61 -0
- package/build/src/host/trusted_device.js +65 -0
- package/build/src/host/ui-dist/assets/index-CRWcmsex.js +137 -0
- package/build/src/host/ui-dist/assets/index-DTSmD4RU.css +1 -0
- package/build/src/host/ui-dist/index.html +17 -0
- package/build/src/host/user_agent.d.ts +18 -0
- package/build/src/host/user_agent.js +50 -0
- package/build/src/host/validators.d.ts +127 -0
- package/build/src/host/validators.js +53 -0
- package/build/src/keys/jwks_manager.d.ts +6 -0
- package/build/src/keys/jwks_manager.js +11 -0
- package/build/src/keys/keystore.d.ts +52 -0
- package/build/src/keys/keystore.js +68 -0
- package/build/src/keys/keystore_codec.d.ts +20 -0
- package/build/src/keys/keystore_codec.js +42 -0
- package/build/src/keys/keystore_crypto.d.ts +9 -0
- package/build/src/keys/keystore_crypto.js +27 -0
- package/build/src/keys/keystore_manager.d.ts +43 -0
- package/build/src/keys/keystore_manager.js +104 -0
- package/build/src/keys/keystore_vault.d.ts +113 -0
- package/build/src/keys/keystore_vault.js +265 -0
- package/build/src/mixins/json_column.d.ts +33 -0
- package/build/src/mixins/json_column.js +38 -0
- package/build/src/mixins/with_audit_log.d.ts +19 -0
- package/build/src/mixins/with_audit_log.js +39 -0
- package/build/src/mixins/with_auth_user.d.ts +24 -0
- package/build/src/mixins/with_auth_user.js +46 -0
- package/build/src/mixins/with_credentials.d.ts +20 -0
- package/build/src/mixins/with_credentials.js +29 -0
- package/build/src/mixins/with_mfa.d.ts +35 -0
- package/build/src/mixins/with_mfa.js +21 -0
- package/build/src/mixins/with_personal_access_token.d.ts +19 -0
- package/build/src/mixins/with_personal_access_token.js +42 -0
- package/build/src/mixins/with_provider_identity.d.ts +20 -0
- package/build/src/mixins/with_provider_identity.js +32 -0
- package/build/src/mixins/with_webauthn_credential.d.ts +37 -0
- package/build/src/mixins/with_webauthn_credential.js +46 -0
- package/build/src/observability/diagnostics_bridge.d.ts +6 -0
- package/build/src/observability/diagnostics_bridge.js +27 -0
- package/build/src/observability/metrics_controller.d.ts +5 -0
- package/build/src/observability/metrics_controller.js +24 -0
- package/build/src/observability/metrics_service.d.ts +2 -0
- package/build/src/observability/metrics_service.js +7 -0
- package/build/src/observability/otel_recorder.d.ts +10 -0
- package/build/src/observability/otel_recorder.js +59 -0
- package/build/src/observability/telescope/data_providers.d.ts +24 -0
- package/build/src/observability/telescope/data_providers.js +235 -0
- package/build/src/observability/telescope/extension.d.ts +29 -0
- package/build/src/observability/telescope/extension.js +167 -0
- package/build/src/observability/telescope/index.d.ts +8 -0
- package/build/src/observability/telescope/index.js +8 -0
- package/build/src/observability/wire_provider_events.d.ts +12 -0
- package/build/src/observability/wire_provider_events.js +30 -0
- package/build/src/password/common_passwords.d.ts +31 -0
- package/build/src/password/common_passwords.js +73 -0
- package/build/src/password/password_manager.d.ts +163 -0
- package/build/src/password/password_manager.js +191 -0
- package/build/src/password/policy.d.ts +71 -0
- package/build/src/password/policy.js +55 -0
- package/build/src/password/pwned.d.ts +36 -0
- package/build/src/password/pwned.js +52 -0
- package/build/src/pat/lucid_pat_store.d.ts +6 -0
- package/build/src/pat/lucid_pat_store.js +62 -0
- package/build/src/pat/pat_store.d.ts +31 -0
- package/build/src/pat/pat_store.js +1 -0
- package/build/src/pat/pat_tokens.d.ts +4 -0
- package/build/src/pat/pat_tokens.js +9 -0
- package/build/src/provider/build_provider.d.ts +45 -0
- package/build/src/provider/build_provider.js +219 -0
- package/build/src/provider/device_sources.d.ts +6 -0
- package/build/src/provider/device_sources.js +65 -0
- package/build/src/provider/interaction_actions.d.ts +36 -0
- package/build/src/provider/interaction_actions.js +55 -0
- package/build/src/provider/key_rotation_scheduler.d.ts +28 -0
- package/build/src/provider/key_rotation_scheduler.js +40 -0
- package/build/src/provider/keystore_reload.d.ts +21 -0
- package/build/src/provider/keystore_reload.js +39 -0
- package/build/src/provider/logout_sources.d.ts +13 -0
- package/build/src/provider/logout_sources.js +64 -0
- package/build/src/provider/oidc_service.d.ts +81 -0
- package/build/src/provider/oidc_service.js +254 -0
- package/build/src/provider/single_flight_lock.d.ts +18 -0
- package/build/src/provider/single_flight_lock.js +31 -0
- package/build/src/provider/token_exchange.d.ts +21 -0
- package/build/src/provider/token_exchange.js +124 -0
- package/build/src/register_routes.d.ts +16 -0
- package/build/src/register_routes.js +21 -0
- package/build/src/schema/ensure.d.ts +41 -0
- package/build/src/schema/ensure.js +262 -0
- package/build/stubs/config/authkit.stub +20 -0
- package/build/stubs/config/authkit_react.stub +52 -0
- package/build/stubs/main.d.ts +1 -0
- package/build/stubs/main.js +2 -0
- package/build/stubs/models/auth_user.stub +22 -0
- package/build/stubs/ui/edge/views/consent.edge +13 -0
- package/build/stubs/ui/edge/views/login.edge +19 -0
- package/build/stubs/ui/react/components/auth_shell.tsx +67 -0
- package/build/stubs/ui/react/pages/account/login.tsx +56 -0
- package/build/stubs/ui/react/pages/account/mfa.tsx +132 -0
- package/build/stubs/ui/react/pages/account/tokens.tsx +88 -0
- package/build/stubs/ui/react/pages/consent.tsx +39 -0
- package/build/stubs/ui/react/pages/forgot.tsx +44 -0
- package/build/stubs/ui/react/pages/login.tsx +171 -0
- package/build/stubs/ui/react/pages/mfa-challenge.tsx +72 -0
- package/build/stubs/ui/react/pages/reset.tsx +58 -0
- package/build/stubs/ui/react/pages/signup.tsx +78 -0
- package/build/stubs/ui/react/pages/verify-email.tsx +24 -0
- package/build/types.d.ts +7 -0
- package/build/types.js +1 -0
- package/package.json +147 -0
- package/stubs/config/authkit.stub +20 -0
- package/stubs/config/authkit_react.stub +52 -0
- package/stubs/main.ts +2 -0
- package/stubs/models/auth_user.stub +22 -0
- package/stubs/ui/edge/views/consent.edge +13 -0
- package/stubs/ui/edge/views/login.edge +19 -0
- package/stubs/ui/react/components/auth_shell.tsx +67 -0
- package/stubs/ui/react/pages/account/login.tsx +56 -0
- package/stubs/ui/react/pages/account/mfa.tsx +132 -0
- package/stubs/ui/react/pages/account/tokens.tsx +88 -0
- package/stubs/ui/react/pages/consent.tsx +39 -0
- package/stubs/ui/react/pages/forgot.tsx +44 -0
- package/stubs/ui/react/pages/login.tsx +171 -0
- package/stubs/ui/react/pages/mfa-challenge.tsx +72 -0
- package/stubs/ui/react/pages/reset.tsx +58 -0
- package/stubs/ui/react/pages/signup.tsx +78 -0
- package/stubs/ui/react/pages/verify-email.tsx +24 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const VALID = ['headless', 'edge', 'react'];
|
|
2
|
+
export function resolveUiPreset(value) {
|
|
3
|
+
if (value === undefined)
|
|
4
|
+
return 'edge';
|
|
5
|
+
if (!VALID.includes(value)) {
|
|
6
|
+
throw new Error(`authkit: --ui inválido "${value}". Use: ${VALID.join(' | ')}`);
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
/** Caminhos de stub (relativos ao stubsRoot) que o preset publica. */
|
|
11
|
+
export function uiStubPaths(preset) {
|
|
12
|
+
switch (preset) {
|
|
13
|
+
case 'headless':
|
|
14
|
+
return [];
|
|
15
|
+
case 'edge':
|
|
16
|
+
return []; // views são donas-da-lib (disco authkit::); nada a scaffoldar
|
|
17
|
+
case 'react':
|
|
18
|
+
return [
|
|
19
|
+
'ui/react/components/auth_shell.tsx',
|
|
20
|
+
'ui/react/pages/login.tsx',
|
|
21
|
+
'ui/react/pages/consent.tsx',
|
|
22
|
+
'ui/react/pages/signup.tsx',
|
|
23
|
+
'ui/react/pages/forgot.tsx',
|
|
24
|
+
'ui/react/pages/reset.tsx',
|
|
25
|
+
'ui/react/pages/verify-email.tsx',
|
|
26
|
+
'ui/react/pages/mfa-challenge.tsx',
|
|
27
|
+
'ui/react/pages/account/login.tsx',
|
|
28
|
+
'ui/react/pages/account/tokens.tsx',
|
|
29
|
+
'ui/react/pages/account/mfa.tsx',
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseSchema } from '@adonisjs/lucid/schema';
|
|
2
|
+
export default class extends BaseSchema {
|
|
3
|
+
tableName = 'authkit_oidc_payloads';
|
|
4
|
+
async up() {
|
|
5
|
+
this.schema.createTable(this.tableName, (table) => {
|
|
6
|
+
table.string('id', 255).notNullable();
|
|
7
|
+
table.string('model_name', 100).notNullable();
|
|
8
|
+
table.text('payload').notNullable();
|
|
9
|
+
table.string('grant_id', 255).nullable().index();
|
|
10
|
+
table.string('user_code', 255).nullable().index();
|
|
11
|
+
table.string('uid', 255).nullable().index();
|
|
12
|
+
table.timestamp('expires_at', { useTz: true }).nullable();
|
|
13
|
+
table.primary(['model_name', 'id']);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async down() {
|
|
17
|
+
this.schema.dropTable(this.tableName);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>AuthKit Admin</title>
|
|
7
|
+
<style>
|
|
8
|
+
*,*::before,*::after{box-sizing:border-box}
|
|
9
|
+
body{margin:0;font-family:system-ui,sans-serif;background:#09090b;color:#fafafa;min-height:100vh;display:flex;align-items:center;justify-content:center}
|
|
10
|
+
#app{width:100%}
|
|
11
|
+
.loading{display:flex;flex-direction:column;align-items:center;gap:12px;color:#a1a1aa;font-size:14px}
|
|
12
|
+
.spinner{width:32px;height:32px;border:2px solid #27272a;border-top-color:#6366f1;border-radius:50%;animation:spin .7s linear infinite}
|
|
13
|
+
@keyframes spin{to{transform:rotate(360deg)}}
|
|
14
|
+
</style>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<!--
|
|
18
|
+
AuthKit Admin Console — React SPA shell.
|
|
19
|
+
Mission B will replace this placeholder with the full bundled React SPA.
|
|
20
|
+
The server injects window.__AUTHKIT__ before this comment (see admin_shell_controller.ts).
|
|
21
|
+
-->
|
|
22
|
+
<div id="app">
|
|
23
|
+
<div class="loading">
|
|
24
|
+
<div class="spinner"></div>
|
|
25
|
+
<span>Loading AuthKit Admin…</span>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="pt-br"><head><meta charset="utf-8"><title>{{ t('account.apps.page_title') }}</title>
|
|
3
|
+
@include('authkit::partials/styles')
|
|
4
|
+
</head>
|
|
5
|
+
<body class="min-h-screen bg-gray-100 p-4">
|
|
6
|
+
<div class="mx-auto max-w-2xl">
|
|
7
|
+
<div class="flex items-center justify-between py-6">
|
|
8
|
+
<div>
|
|
9
|
+
<div class="text-xs font-semibold uppercase tracking-widest text-gray-400">{{ t('common.brand_eyebrow') }}</div>
|
|
10
|
+
<h1 class="text-xl font-semibold text-gray-900">{{ t('account.apps.title') }}</h1>
|
|
11
|
+
<p class="mt-1 text-sm text-gray-500">{{ t('account.apps.intro') }}</p>
|
|
12
|
+
</div>
|
|
13
|
+
<form method="POST" action="/account/logout">
|
|
14
|
+
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
15
|
+
<button type="submit" class="text-sm text-gray-500 hover:underline">{{ t('account.apps.logout') }}</button>
|
|
16
|
+
</form>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<nav class="mb-6 flex gap-4 text-sm font-medium">
|
|
20
|
+
<a href="/account/tokens" class="text-gray-500 hover:underline">{{ t('account.tokens.title') }}</a>
|
|
21
|
+
<a href="/account/security" class="text-gray-500 hover:underline">{{ t('account.security.title') }}</a>
|
|
22
|
+
<a href="/account/apps" class="text-gray-900 underline">{{ t('account.apps.title') }}</a>
|
|
23
|
+
</nav>
|
|
24
|
+
|
|
25
|
+
@if(revoked)
|
|
26
|
+
<div class="mb-6 rounded-lg border border-emerald-300 bg-emerald-50 p-4">
|
|
27
|
+
<p class="text-sm font-medium text-emerald-900">{{ revoked }}</p>
|
|
28
|
+
</div>
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
@if(!supported)
|
|
32
|
+
<div class="rounded-xl bg-white p-6 text-sm text-gray-500 shadow-sm ring-1 ring-black/5">
|
|
33
|
+
{{ t('account.apps.not_supported') }}
|
|
34
|
+
</div>
|
|
35
|
+
@else
|
|
36
|
+
<div class="overflow-hidden rounded-xl bg-white shadow-sm ring-1 ring-black/5">
|
|
37
|
+
@if(apps.length === 0)
|
|
38
|
+
<p class="p-6 text-sm text-gray-500">{{ t('account.apps.empty') }}</p>
|
|
39
|
+
@else
|
|
40
|
+
@each(app in apps)
|
|
41
|
+
<div class="flex items-center justify-between border-b border-gray-100 p-4 last:border-0">
|
|
42
|
+
<div>
|
|
43
|
+
<p class="text-sm font-medium text-gray-900">{{ app.name }}</p>
|
|
44
|
+
<p class="text-xs text-gray-500">{{ t('account.apps.tokens', { accessTokens: app.accessTokens, refreshTokens: app.refreshTokens }) }}</p>
|
|
45
|
+
</div>
|
|
46
|
+
<form method="POST" action="/account/apps/{{ app.clientId }}/revoke"
|
|
47
|
+
onsubmit="return confirm('{{ t('account.apps.revoke_confirm') }}')">
|
|
48
|
+
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
49
|
+
<button type="submit" class="rounded-lg border border-red-300 px-3 py-1.5 text-sm font-semibold text-red-700 hover:bg-red-50">
|
|
50
|
+
{{ t('account.apps.revoke') }}
|
|
51
|
+
</button>
|
|
52
|
+
</form>
|
|
53
|
+
</div>
|
|
54
|
+
@end
|
|
55
|
+
@end
|
|
56
|
+
</div>
|
|
57
|
+
@end
|
|
58
|
+
</div>
|
|
59
|
+
</body></html>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="pt-br"><head><meta charset="utf-8"><title>{{ t('account.confirm.page_title') }}</title>
|
|
3
|
+
@include('authkit::partials/styles')
|
|
4
|
+
</head>
|
|
5
|
+
<body class="min-h-screen bg-gray-100 flex items-center justify-center p-4">
|
|
6
|
+
<div class="w-full max-w-sm">
|
|
7
|
+
<div class="rounded-2xl bg-white p-8 shadow-sm ring-1 ring-black/5">
|
|
8
|
+
<div class="mb-6">
|
|
9
|
+
<h1 class="text-xl font-semibold text-gray-900">{{ t('account.confirm.title') }}</h1>
|
|
10
|
+
<p class="mt-1 text-sm text-gray-500">{{ t('account.confirm.intro') }}</p>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
@if(error)
|
|
14
|
+
<div class="mb-4 rounded-lg bg-red-50 px-4 py-3 text-sm text-red-700 ring-1 ring-red-200">{{ error }}</div>
|
|
15
|
+
@end
|
|
16
|
+
|
|
17
|
+
@if(passwordless && !passkeyAvailable)
|
|
18
|
+
<div class="rounded-lg bg-amber-50 px-4 py-3 text-sm text-amber-800 ring-1 ring-amber-200">{{ t('account.confirm.passwordless_notice') }}</div>
|
|
19
|
+
@else
|
|
20
|
+
@if(!passwordless)
|
|
21
|
+
<form method="POST" action="/account/confirm">
|
|
22
|
+
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
23
|
+
@if(returnTo)
|
|
24
|
+
<input type="hidden" name="return_to" value="{{ returnTo }}">
|
|
25
|
+
@end
|
|
26
|
+
<div class="mb-4">
|
|
27
|
+
<label for="password" class="mb-1 block text-sm font-medium text-gray-700">{{ t('account.confirm.password_label') }}</label>
|
|
28
|
+
<input id="password" type="password" name="password" autofocus
|
|
29
|
+
class="w-full rounded-lg border border-gray-200 px-3 py-2 text-sm outline-none focus:border-gray-400 focus:ring-1 focus:ring-gray-400">
|
|
30
|
+
</div>
|
|
31
|
+
<button type="submit"
|
|
32
|
+
class="w-full rounded-lg bg-gray-900 py-2 text-sm font-medium text-white hover:bg-gray-700">{{ t('account.confirm.submit') }}</button>
|
|
33
|
+
</form>
|
|
34
|
+
@end
|
|
35
|
+
|
|
36
|
+
@if(passkeyAvailable)
|
|
37
|
+
<div class="{{ !passwordless ? 'mt-4 border-t border-gray-100 pt-4' : '' }}">
|
|
38
|
+
<button type="button" id="confirm-passkey-btn"
|
|
39
|
+
class="w-full rounded-lg border border-gray-200 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50">{{ t('account.confirm.passkey_button') }}</button>
|
|
40
|
+
</div>
|
|
41
|
+
<form id="passkey-confirm-form" method="POST" action="/account/confirm/passkey" class="hidden">
|
|
42
|
+
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
43
|
+
@if(returnTo)
|
|
44
|
+
<input type="hidden" name="return_to" value="{{ returnTo }}">
|
|
45
|
+
@end
|
|
46
|
+
<input type="hidden" name="response" id="passkey-confirm-response">
|
|
47
|
+
</form>
|
|
48
|
+
<script type="module">
|
|
49
|
+
import { startAuthentication } from 'https://cdn.jsdelivr.net/npm/@simplewebauthn/browser@13/dist/bundle/index.esm.js';
|
|
50
|
+
document.getElementById('confirm-passkey-btn')?.addEventListener('click', async () => {
|
|
51
|
+
try {
|
|
52
|
+
const optRes = await fetch('/account/confirm/passkey/options', {
|
|
53
|
+
method: 'POST',
|
|
54
|
+
headers: { 'x-csrf-token': document.querySelector('[name="_csrf"]').value },
|
|
55
|
+
});
|
|
56
|
+
const opts = await optRes.json();
|
|
57
|
+
const assertionResult = await startAuthentication({ optionsJSON: opts });
|
|
58
|
+
document.getElementById('passkey-confirm-response').value = JSON.stringify(assertionResult);
|
|
59
|
+
document.getElementById('passkey-confirm-form').submit();
|
|
60
|
+
} catch (e) {
|
|
61
|
+
console.error(e);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
</script>
|
|
65
|
+
@end
|
|
66
|
+
@end
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</body>
|
|
70
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="pt-br"><head><meta charset="utf-8"><title>{{ t('account.email_confirmed.page_title') }}</title>
|
|
3
|
+
@include('authkit::partials/styles')
|
|
4
|
+
</head>
|
|
5
|
+
<body class="min-h-screen flex items-center justify-center bg-gray-100 p-4">
|
|
6
|
+
<div class="w-full max-w-sm rounded-2xl bg-white p-8 text-center shadow-xl ring-1 ring-black/5">
|
|
7
|
+
<div class="text-xs font-semibold uppercase tracking-widest text-gray-400">{{ t('common.brand_eyebrow') }}</div>
|
|
8
|
+
@if(ok)
|
|
9
|
+
<h1 class="mt-2 text-xl font-semibold text-emerald-700">{{ t('account.email_confirmed.ok_title') }}</h1>
|
|
10
|
+
<p class="mt-2 text-sm text-gray-600">{{ t('account.email_confirmed.ok_body') }}</p>
|
|
11
|
+
@else
|
|
12
|
+
<h1 class="mt-2 text-xl font-semibold text-red-700">{{ t('account.email_confirmed.invalid_title') }}</h1>
|
|
13
|
+
<p class="mt-2 text-sm text-gray-600">{{ t('account.email_confirmed.invalid_body') }}</p>
|
|
14
|
+
@end
|
|
15
|
+
</div>
|
|
16
|
+
</body></html>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="pt-br"><head><meta charset="utf-8"><title>{{ t('account.login.page_title') }}</title>
|
|
3
|
+
@include('authkit::partials/styles')
|
|
4
|
+
</head>
|
|
5
|
+
<body class="min-h-screen flex items-center justify-center bg-gray-100 p-4">
|
|
6
|
+
<form method="POST" action="/account/login"
|
|
7
|
+
class="w-full max-w-sm rounded-2xl bg-white p-8 shadow-xl ring-1 ring-black/5">
|
|
8
|
+
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
9
|
+
@if(returnTo)
|
|
10
|
+
<input type="hidden" name="return_to" value="{{ returnTo }}">
|
|
11
|
+
@end
|
|
12
|
+
<div class="text-xs font-semibold uppercase tracking-widest text-gray-400">{{ t('common.brand_eyebrow') }}</div>
|
|
13
|
+
<h1 class="mt-2 text-xl font-semibold text-gray-900">{{ t('account.login.title') }}</h1>
|
|
14
|
+
<p class="mt-1 text-sm text-gray-500">{{ t('account.login.intro') }}</p>
|
|
15
|
+
|
|
16
|
+
@if(error)
|
|
17
|
+
<p class="mt-4 text-sm text-red-600">{{ error }}</p>
|
|
18
|
+
@end
|
|
19
|
+
|
|
20
|
+
<label for="email" class="mt-6 mb-1 block text-sm font-medium text-gray-700">{{ t('account.login.email_label') }}</label>
|
|
21
|
+
<input id="email" name="email" type="email" required autofocus
|
|
22
|
+
class="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm outline-none transition focus:border-gray-900" />
|
|
23
|
+
|
|
24
|
+
<label for="password" class="mt-4 mb-1 block text-sm font-medium text-gray-700">{{ t('account.login.password_label') }}</label>
|
|
25
|
+
<input id="password" name="password" type="password" required
|
|
26
|
+
class="w-full rounded-lg border border-gray-300 px-3 py-2 text-sm outline-none transition focus:border-gray-900" />
|
|
27
|
+
|
|
28
|
+
<button type="submit"
|
|
29
|
+
class="mt-6 w-full rounded-lg bg-gray-900 py-2.5 text-sm font-semibold text-white transition hover:opacity-90">
|
|
30
|
+
{{ t('account.login.submit') }}
|
|
31
|
+
</button>
|
|
32
|
+
</form>
|
|
33
|
+
</body></html>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="pt-br"><head><meta charset="utf-8"><title>{{ t('account.mfa.page_title') }}</title>
|
|
3
|
+
@include('authkit::partials/styles')
|
|
4
|
+
</head>
|
|
5
|
+
<body class="min-h-screen bg-gray-100 p-4">
|
|
6
|
+
<div class="mx-auto max-w-2xl">
|
|
7
|
+
<div class="flex items-center justify-between py-6">
|
|
8
|
+
<div>
|
|
9
|
+
<div class="text-xs font-semibold uppercase tracking-widest text-gray-400">{{ t('common.brand_eyebrow') }}</div>
|
|
10
|
+
<h1 class="text-xl font-semibold text-gray-900">{{ t('account.mfa.title') }}</h1>
|
|
11
|
+
</div>
|
|
12
|
+
<form method="POST" action="/account/logout">
|
|
13
|
+
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
14
|
+
<button type="submit" class="text-sm text-gray-500 hover:underline">{{ t('account.mfa.logout') }}</button>
|
|
15
|
+
</form>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
@if(error)
|
|
19
|
+
<p class="mb-4 text-sm text-red-600">{{ error }}</p>
|
|
20
|
+
@end
|
|
21
|
+
|
|
22
|
+
{{-- Recovery codes mostrados uma única vez após confirmar o enrollment --}}
|
|
23
|
+
@if(recoveryCodes && recoveryCodes.length > 0)
|
|
24
|
+
<div class="mb-6 rounded-lg border border-emerald-300 bg-emerald-50 p-4">
|
|
25
|
+
<p class="text-sm font-medium text-emerald-900">
|
|
26
|
+
{{ t('account.mfa.recovery_codes_notice') }}
|
|
27
|
+
</p>
|
|
28
|
+
<ul class="mt-3 grid grid-cols-2 gap-2">
|
|
29
|
+
@each(rc in recoveryCodes)
|
|
30
|
+
<li><code class="block rounded bg-white px-3 py-2 text-sm text-emerald-800 ring-1 ring-emerald-200">{{ rc }}</code></li>
|
|
31
|
+
@end
|
|
32
|
+
</ul>
|
|
33
|
+
</div>
|
|
34
|
+
@end
|
|
35
|
+
|
|
36
|
+
@if(enrolling)
|
|
37
|
+
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
38
|
+
<p class="text-sm text-gray-600">
|
|
39
|
+
{{ t('account.mfa.enroll_intro') }}
|
|
40
|
+
</p>
|
|
41
|
+
@if(qrDataUrl)
|
|
42
|
+
<img src="{{ qrDataUrl }}" alt="{{ t('account.mfa.qr_alt') }}" class="mx-auto my-4 h-48 w-48" />
|
|
43
|
+
@end
|
|
44
|
+
@if(secret)
|
|
45
|
+
<p class="text-center text-xs text-gray-500">{{ t('account.mfa.manual_intro') }}</p>
|
|
46
|
+
<code class="mx-auto mt-1 block w-fit break-all rounded bg-gray-100 px-3 py-2 text-sm text-gray-800">{{ secret }}</code>
|
|
47
|
+
@end
|
|
48
|
+
|
|
49
|
+
<form method="POST" action="/account/mfa/confirm" class="mt-6">
|
|
50
|
+
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
51
|
+
<label for="code" class="mb-1 block text-sm font-medium text-gray-700">{{ t('account.mfa.confirm_code_label') }}</label>
|
|
52
|
+
<input id="code" name="code" inputmode="numeric" pattern="[0-9]*" maxlength="6" autofocus
|
|
53
|
+
class="w-full rounded-lg border border-gray-300 px-3 py-2 text-center text-lg tracking-[0.4em] outline-none focus:border-gray-900" />
|
|
54
|
+
<button type="submit" class="mt-4 w-full rounded-lg bg-gray-900 py-2.5 text-sm font-semibold text-white">
|
|
55
|
+
{{ t('account.mfa.activate') }}
|
|
56
|
+
</button>
|
|
57
|
+
</form>
|
|
58
|
+
</div>
|
|
59
|
+
@elseif(enabled)
|
|
60
|
+
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
61
|
+
<p class="text-sm text-gray-700">
|
|
62
|
+
{{{ t('account.mfa.enabled_html') }}}
|
|
63
|
+
</p>
|
|
64
|
+
<form method="POST" action="/account/mfa/disable" class="mt-4">
|
|
65
|
+
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
66
|
+
<button type="submit" class="rounded-lg border border-red-300 px-4 py-2 text-sm font-semibold text-red-600 hover:bg-red-50">
|
|
67
|
+
{{ t('account.mfa.disable') }}
|
|
68
|
+
</button>
|
|
69
|
+
</form>
|
|
70
|
+
</div>
|
|
71
|
+
@else
|
|
72
|
+
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
73
|
+
<p class="text-sm text-gray-700">
|
|
74
|
+
{{ t('account.mfa.disabled_intro') }}
|
|
75
|
+
</p>
|
|
76
|
+
<form method="POST" action="/account/mfa/enroll" class="mt-4">
|
|
77
|
+
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
78
|
+
<button type="submit" class="rounded-lg bg-gray-900 px-4 py-2 text-sm font-semibold text-white">
|
|
79
|
+
{{ t('account.mfa.enable') }}
|
|
80
|
+
</button>
|
|
81
|
+
</form>
|
|
82
|
+
</div>
|
|
83
|
+
@end
|
|
84
|
+
|
|
85
|
+
@if(passkeysSupported)
|
|
86
|
+
{{-- Passkeys / chaves de acesso (WebAuthn) — 2º fator alternativo ao TOTP. --}}
|
|
87
|
+
<div class="mt-6 rounded-xl bg-white p-6 shadow-sm ring-1 ring-black/5">
|
|
88
|
+
<h2 class="text-base font-semibold text-gray-900">{{ t('mfa.passkey.section_title') }}</h2>
|
|
89
|
+
<p class="mt-1 text-sm text-gray-600">{{ t('mfa.passkey.section_intro') }}</p>
|
|
90
|
+
|
|
91
|
+
@if(passkeys && passkeys.length > 0)
|
|
92
|
+
<ul class="mt-4 space-y-2">
|
|
93
|
+
@each(pk in passkeys)
|
|
94
|
+
<li class="flex items-center justify-between rounded-lg border border-gray-200 px-3 py-2">
|
|
95
|
+
<span class="text-sm text-gray-800">{{ pk.label ? pk.label : t('mfa.passkey.unnamed') }}</span>
|
|
96
|
+
<form method="POST" action="/account/mfa/passkeys/{{ pk.id }}/remove">
|
|
97
|
+
<input type="hidden" name="_csrf" value="{{ csrfToken }}">
|
|
98
|
+
<button type="submit" class="text-sm text-red-600 hover:underline">{{ t('mfa.passkey.remove') }}</button>
|
|
99
|
+
</form>
|
|
100
|
+
</li>
|
|
101
|
+
@end
|
|
102
|
+
</ul>
|
|
103
|
+
@else
|
|
104
|
+
<p class="mt-4 text-sm text-gray-400">{{ t('mfa.passkey.empty') }}</p>
|
|
105
|
+
@end
|
|
106
|
+
|
|
107
|
+
<button type="button" id="passkey-add"
|
|
108
|
+
class="mt-4 rounded-lg border border-gray-300 px-4 py-2 text-sm font-semibold text-gray-700 hover:bg-gray-50">
|
|
109
|
+
{{ t('mfa.passkey.add') }}
|
|
110
|
+
</button>
|
|
111
|
+
<p id="passkey-error" class="mt-3 hidden text-sm text-red-600">{{ t('mfa.passkey.register_error') }}</p>
|
|
112
|
+
</div>
|
|
113
|
+
@end
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
@if(passkeysSupported)
|
|
117
|
+
<script type="module">
|
|
118
|
+
import { startRegistration } from 'https://cdn.jsdelivr.net/npm/@simplewebauthn/browser@13/dist/bundle/index.js'
|
|
119
|
+
const btn = document.getElementById('passkey-add')
|
|
120
|
+
const errEl = document.getElementById('passkey-error')
|
|
121
|
+
const csrf = '{{ csrfToken }}'
|
|
122
|
+
btn?.addEventListener('click', async () => {
|
|
123
|
+
errEl.classList.add('hidden')
|
|
124
|
+
btn.disabled = true
|
|
125
|
+
try {
|
|
126
|
+
// 1) Opções de registro (challenge guardado na sessão server-side).
|
|
127
|
+
const optsRes = await fetch('/account/mfa/passkeys/options', {
|
|
128
|
+
method: 'POST',
|
|
129
|
+
headers: { 'content-type': 'application/json', 'x-csrf-token': csrf },
|
|
130
|
+
body: JSON.stringify({}),
|
|
131
|
+
})
|
|
132
|
+
if (!optsRes.ok) throw new Error('options')
|
|
133
|
+
const optionsJSON = await optsRes.json()
|
|
134
|
+
// 2) Cerimônia de registro no authenticator.
|
|
135
|
+
const attResp = await startRegistration({ optionsJSON })
|
|
136
|
+
// 3) Verifica/persiste no servidor.
|
|
137
|
+
const verifyRes = await fetch('/account/mfa/passkeys/verify', {
|
|
138
|
+
method: 'POST',
|
|
139
|
+
headers: { 'content-type': 'application/json', 'x-csrf-token': csrf },
|
|
140
|
+
body: JSON.stringify({ response: attResp }),
|
|
141
|
+
})
|
|
142
|
+
if (!verifyRes.ok) throw new Error('verify')
|
|
143
|
+
// 4) Recarrega para mostrar a nova passkey.
|
|
144
|
+
window.location.reload()
|
|
145
|
+
} catch (e) {
|
|
146
|
+
errEl.classList.remove('hidden')
|
|
147
|
+
btn.disabled = false
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
</script>
|
|
151
|
+
@end
|
|
152
|
+
</body></html>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>{{ t('account.orgs.page_title') }}</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
@if(!supported)
|
|
9
|
+
<p>{{ t('account.orgs.not_supported') }}</p>
|
|
10
|
+
@else
|
|
11
|
+
<h1>{{ t('account.orgs.title') }}</h1>
|
|
12
|
+
|
|
13
|
+
@if(orgs.length === 0)
|
|
14
|
+
<p>{{ t('account.orgs.empty') }}</p>
|
|
15
|
+
@else
|
|
16
|
+
@each(org in orgs)
|
|
17
|
+
<div>
|
|
18
|
+
<strong>{{ org.name }}</strong> ({{ org.slug }})
|
|
19
|
+
@if(org.isActive)
|
|
20
|
+
<span>{{ t('account.orgs.active_badge') }}</span>
|
|
21
|
+
<form method="POST" action="/account/orgs/deactivate">
|
|
22
|
+
<button>{{ t('account.orgs.deactivate') }}</button>
|
|
23
|
+
</form>
|
|
24
|
+
@else
|
|
25
|
+
<form method="POST" action="/account/orgs/{{ org.id }}/activate">
|
|
26
|
+
<button>{{ t('account.orgs.activate') }}</button>
|
|
27
|
+
</form>
|
|
28
|
+
@end
|
|
29
|
+
<form method="POST" action="/account/orgs/{{ org.id }}/leave">
|
|
30
|
+
<button>{{ t('account.orgs.leave') }}</button>
|
|
31
|
+
</form>
|
|
32
|
+
</div>
|
|
33
|
+
@end
|
|
34
|
+
@end
|
|
35
|
+
|
|
36
|
+
@if(pendingInvitations.length > 0)
|
|
37
|
+
<h2>{{ t('account.orgs.invitations_section') }}</h2>
|
|
38
|
+
@each(inv in pendingInvitations)
|
|
39
|
+
<div>
|
|
40
|
+
{{ t('account.orgs.invitation_from', { orgName: inv.orgName, role: inv.role }) }}
|
|
41
|
+
<form method="POST" action="/account/orgs/invitations/{{ inv.id }}/accept">
|
|
42
|
+
<button>{{ t('account.orgs.invitation_accept') }}</button>
|
|
43
|
+
</form>
|
|
44
|
+
</div>
|
|
45
|
+
@end
|
|
46
|
+
@end
|
|
47
|
+
|
|
48
|
+
@if(allowSelfCreate)
|
|
49
|
+
<h2>{{ t('account.orgs.create_section') }}</h2>
|
|
50
|
+
<form method="POST" action="/account/orgs">
|
|
51
|
+
<input name="name" placeholder="{{ t('account.orgs.create_name_label') }}">
|
|
52
|
+
<input name="slug" placeholder="{{ t('account.orgs.create_slug_label') }}">
|
|
53
|
+
<button>{{ t('account.orgs.create_submit') }}</button>
|
|
54
|
+
</form>
|
|
55
|
+
@end
|
|
56
|
+
@end
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|