Refactor form submission handling and enhance debug logging for registration process
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 45s

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 c1e93f8989
commit 8e398778ce

View File

@@ -13,7 +13,7 @@
<div class="bg-white rounded-xl shadow-lg p-8"> <div class="bg-white rounded-xl shadow-lg p-8">
<form <form
class="space-y-6" class="space-y-6"
@submit.prevent="usePasskey ? handleRegisterWithPasskey() : handleRegister()" @submit.prevent="handleFormSubmit"
> >
<!-- Registration Mode --> <!-- Registration Mode -->
<div class="flex items-center justify-between bg-gray-50 border border-gray-200 rounded-lg p-3"> <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 isPasskeySupported = ref(false)
const passkeySupportReason = ref('') const passkeySupportReason = ref('')
const setPasswordForPasskey = ref(true) 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 showDebugInfo = ref(false)
const debugChallenge = ref('') const debugChallenge = ref('')
const debugRpId = ref('') const debugRpId = ref('')
@@ -314,10 +332,19 @@ const handleRegister = async () => {
} }
const handleRegisterWithPasskey = async () => { const handleRegisterWithPasskey = async () => {
console.log('[DEBUG] ===== handleRegisterWithPasskey CALLED =====')
console.log('[DEBUG] Function entry point reached')
errorMessage.value = '' errorMessage.value = ''
successMessage.value = '' successMessage.value = ''
console.log('[DEBUG] Checking passkey support:', {
isPasskeySupported: isPasskeySupported.value,
passkeySupportReason: passkeySupportReason.value
})
if (!isPasskeySupported.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).' errorMessage.value = passkeySupportReason.value || 'Passkeys sind in diesem Browser/unter dieser URL nicht verfügbar (HTTPS erforderlich).'
return return
} }