Refactor form submission handling and enhance debug logging for registration process

Update the form submission method to a unified handler, improving code clarity and maintainability. Add detailed debug logging to track form submission events and registration method calls, aiding in troubleshooting and providing better insights during the registration process.
This commit is contained in:
Torsten Schulz (local)
2026-01-07 22:24:18 +01:00
parent 2686964ad6
commit 71df1ee28c

View File

@@ -13,7 +13,7 @@
<div class="bg-white rounded-xl shadow-lg p-8">
<form
class="space-y-6"
@submit.prevent="usePasskey ? handleRegisterWithPasskey() : handleRegister()"
@submit.prevent="handleFormSubmit"
>
<!-- Registration Mode -->
<div class="flex items-center justify-between bg-gray-50 border border-gray-200 rounded-lg p-3">
@@ -243,6 +243,24 @@ const usePasskey = ref(false)
const isPasskeySupported = ref(false)
const passkeySupportReason = ref('')
const setPasswordForPasskey = ref(true)
// Debug: Log beim Form-Submit
const handleFormSubmit = (event) => {
console.log('[DEBUG] ===== FORM SUBMIT EVENT =====')
console.log('[DEBUG] Form submitted', {
usePasskey: usePasskey.value,
name: formData.value.name,
email: formData.value.email
})
if (usePasskey.value) {
console.log('[DEBUG] Calling handleRegisterWithPasskey...')
handleRegisterWithPasskey()
} else {
console.log('[DEBUG] Calling handleRegister...')
handleRegister()
}
}
const showDebugInfo = ref(false)
const debugChallenge = ref('')
const debugRpId = ref('')
@@ -314,10 +332,19 @@ const handleRegister = async () => {
}
const handleRegisterWithPasskey = async () => {
console.log('[DEBUG] ===== handleRegisterWithPasskey CALLED =====')
console.log('[DEBUG] Function entry point reached')
errorMessage.value = ''
successMessage.value = ''
console.log('[DEBUG] Checking passkey support:', {
isPasskeySupported: isPasskeySupported.value,
passkeySupportReason: passkeySupportReason.value
})
if (!isPasskeySupported.value) {
console.warn('[DEBUG] Passkey not supported, returning early')
errorMessage.value = passkeySupportReason.value || 'Passkeys sind in diesem Browser/unter dieser URL nicht verfügbar (HTTPS erforderlich).'
return
}