Remove deprecated Passkey-related documentation and test files
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 47s
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 47s
This commit deletes several files related to Passkey functionality, including CORS_TEST_ANLEITUNG.md, CROSS_DEVICE_DEBUG.md, CROSS_DEVICE_PROBLEM_ZUSAMMENFASSUNG.md, SMARTPHONE_TEST_ANLEITUNG.md, test-cors.html, test-smartphone.html, and Vue components for Passkey registration and recovery. These removals are part of a broader effort to streamline the codebase and focus on core authentication methods while Passkey support is under review.
This commit is contained in:
@@ -1,142 +0,0 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-gray-900 text-white flex items-center justify-center p-4">
|
||||
<div class="max-w-md w-full bg-gray-800 rounded-lg p-6 space-y-4">
|
||||
<h1 class="text-2xl font-bold text-center">Passkey-Registrierung</h1>
|
||||
|
||||
<div v-if="status === 'loading'" class="text-center">
|
||||
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-white mx-auto mb-4"></div>
|
||||
<p>Lade Registrierungsoptionen...</p>
|
||||
</div>
|
||||
|
||||
<div v-else-if="status === 'waiting'" class="text-center">
|
||||
<div class="animate-pulse text-4xl mb-4">🔐</div>
|
||||
<p class="text-lg mb-2">Warte auf Passkey-Authentifizierung...</p>
|
||||
<p class="text-sm text-gray-400">Bitte bestätigen Sie die Registrierung auf diesem Gerät.</p>
|
||||
</div>
|
||||
|
||||
<div v-else-if="status === 'error'" class="text-center text-red-400">
|
||||
<p class="text-lg font-semibold mb-2">Fehler</p>
|
||||
<p>{{ errorMessage }}</p>
|
||||
<button
|
||||
@click="retry"
|
||||
class="mt-4 px-4 py-2 bg-primary-600 hover:bg-primary-700 rounded"
|
||||
>
|
||||
Erneut versuchen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-else-if="status === 'success'" class="text-center text-green-400">
|
||||
<p class="text-lg font-semibold mb-2">✅ Erfolgreich!</p>
|
||||
<p>Die Credential-Response wurde an den Desktop-Browser gesendet.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
|
||||
const status = ref('loading')
|
||||
const errorMessage = ref('')
|
||||
const registrationId = ref('')
|
||||
|
||||
// Hole registrationId aus URL-Parameter
|
||||
onMounted(async () => {
|
||||
const route = useRoute()
|
||||
registrationId.value = route.query.registrationId || ''
|
||||
|
||||
if (!registrationId.value) {
|
||||
status.value = 'error'
|
||||
errorMessage.value = 'Keine registrationId in der URL gefunden.'
|
||||
return
|
||||
}
|
||||
|
||||
await startRegistration()
|
||||
})
|
||||
|
||||
async function startRegistration() {
|
||||
try {
|
||||
status.value = 'loading'
|
||||
|
||||
// Hole Options vom Server
|
||||
console.log('[DEBUG] Fetching options for registrationId:', registrationId.value)
|
||||
const optionsResponse = await fetch(`/api/auth/register-passkey-options/${registrationId.value}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
|
||||
if (!optionsResponse.ok) {
|
||||
throw new Error(`Options request failed: ${optionsResponse.status}`)
|
||||
}
|
||||
|
||||
const optionsData = await optionsResponse.json()
|
||||
|
||||
if (!optionsData.success || !optionsData.options) {
|
||||
throw new Error('Invalid options response')
|
||||
}
|
||||
|
||||
console.log('[DEBUG] Options received:', {
|
||||
hasChallenge: !!optionsData.options.challenge,
|
||||
rpId: optionsData.options.rp?.id,
|
||||
timeout: optionsData.options.timeout
|
||||
})
|
||||
|
||||
// Importiere @simplewebauthn/browser
|
||||
const mod = await import('@simplewebauthn/browser')
|
||||
|
||||
if (!mod.startRegistration) {
|
||||
throw new Error('startRegistration ist nicht verfügbar')
|
||||
}
|
||||
|
||||
status.value = 'waiting'
|
||||
|
||||
console.log('[DEBUG] Calling startRegistration on smartphone...')
|
||||
|
||||
// Rufe startRegistration auf
|
||||
const credential = await mod.startRegistration({ optionsJSON: optionsData.options })
|
||||
|
||||
console.log('[DEBUG] Credential received:', {
|
||||
id: credential.id,
|
||||
type: credential.type
|
||||
})
|
||||
|
||||
// Sende Credential-Response an den Server
|
||||
const verifyResponse = await fetch('/api/auth/register-passkey', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
registrationId: registrationId.value,
|
||||
credential
|
||||
})
|
||||
})
|
||||
|
||||
if (!verifyResponse.ok) {
|
||||
const errorData = await verifyResponse.json().catch(() => ({}))
|
||||
throw new Error(errorData.message || `Verification failed: ${verifyResponse.status}`)
|
||||
}
|
||||
|
||||
const verifyData = await verifyResponse.json()
|
||||
|
||||
if (verifyData.success) {
|
||||
status.value = 'success'
|
||||
console.log('[DEBUG] Registration successful!')
|
||||
} else {
|
||||
throw new Error(verifyData.message || 'Registrierung fehlgeschlagen')
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('[DEBUG] Registration error:', error)
|
||||
status.value = 'error'
|
||||
errorMessage.value = error.message || 'Unbekannter Fehler'
|
||||
}
|
||||
}
|
||||
|
||||
function retry() {
|
||||
status.value = 'loading'
|
||||
startRegistration()
|
||||
}
|
||||
</script>
|
||||
@@ -1,191 +0,0 @@
|
||||
<template>
|
||||
<div class="min-h-full flex items-center justify-center py-16 px-4 sm:px-6 lg:px-8 bg-gray-50">
|
||||
<div class="max-w-md w-full space-y-8">
|
||||
<div class="text-center">
|
||||
<h2 class="text-3xl font-display font-bold text-gray-900">
|
||||
Passkey wiederherstellen
|
||||
</h2>
|
||||
<p class="mt-2 text-sm text-gray-600">
|
||||
Fügen Sie einen neuen Passkey hinzu, wenn Sie Ihr Gerät gewechselt haben.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl shadow-lg p-8">
|
||||
<!-- Token Flow -->
|
||||
<div v-if="token" class="space-y-4">
|
||||
<div
|
||||
v-if="errorMessage"
|
||||
class="bg-red-50 border border-red-200 rounded-lg p-4"
|
||||
>
|
||||
<p class="text-sm text-red-800 flex items-center">
|
||||
<AlertCircle :size="18" class="mr-2" />
|
||||
{{ errorMessage }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="successMessage"
|
||||
class="bg-green-50 border border-green-200 rounded-lg p-4"
|
||||
>
|
||||
<p class="text-sm text-green-800 flex items-center">
|
||||
<Check :size="18" class="mr-2" />
|
||||
{{ successMessage }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="w-full px-6 py-3 bg-gray-900 hover:bg-gray-800 disabled:bg-gray-400 text-white font-semibold rounded-lg transition-colors flex items-center justify-center"
|
||||
:disabled="isLoading || !isPasskeySupported"
|
||||
@click="addPasskeyViaToken"
|
||||
>
|
||||
<Loader2 v-if="isLoading" :size="20" class="mr-2 animate-spin" />
|
||||
<span>
|
||||
{{ isLoading ? 'Wird vorbereitet...' : (isPasskeySupported ? 'Neuen Passkey hinzufügen' : 'Passkeys nicht verfügbar') }}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div class="text-center">
|
||||
<NuxtLink to="/login" class="text-sm text-primary-600 hover:text-primary-700 font-medium">
|
||||
Zurück zum Login
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Request Link Flow -->
|
||||
<form v-else class="space-y-6" @submit.prevent="requestLink">
|
||||
<div>
|
||||
<label for="email" class="block text-sm font-medium text-gray-700 mb-2">
|
||||
E-Mail-Adresse
|
||||
</label>
|
||||
<input
|
||||
id="email"
|
||||
v-model="email"
|
||||
type="email"
|
||||
required
|
||||
autocomplete="email"
|
||||
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-600 focus:border-transparent transition-all"
|
||||
placeholder="ihre-email@example.com"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="errorMessage"
|
||||
class="bg-red-50 border border-red-200 rounded-lg p-4"
|
||||
>
|
||||
<p class="text-sm text-red-800 flex items-center">
|
||||
<AlertCircle :size="18" class="mr-2" />
|
||||
{{ errorMessage }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="successMessage"
|
||||
class="bg-green-50 border border-green-200 rounded-lg p-4"
|
||||
>
|
||||
<p class="text-sm text-green-800 flex items-center">
|
||||
<Check :size="18" class="mr-2" />
|
||||
{{ successMessage }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full px-6 py-3 bg-primary-600 hover:bg-primary-700 disabled:bg-gray-400 text-white font-semibold rounded-lg transition-colors flex items-center justify-center"
|
||||
:disabled="isLoading"
|
||||
>
|
||||
<Loader2 v-if="isLoading" :size="20" class="mr-2 animate-spin" />
|
||||
<span>{{ isLoading ? 'Wird gesendet...' : 'Recovery-Link per E-Mail senden' }}</span>
|
||||
</button>
|
||||
|
||||
<div class="text-center">
|
||||
<NuxtLink to="/login" class="text-sm text-primary-600 hover:text-primary-700 font-medium">
|
||||
Zurück zum Login
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="bg-primary-50 border border-primary-100 rounded-lg p-4">
|
||||
<p class="text-sm text-primary-800">
|
||||
<Info :size="16" class="inline mr-1" />
|
||||
Wir schicken immer die gleiche Rückmeldung, egal ob ein Konto existiert.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { AlertCircle, Check, Loader2, Info } from 'lucide-vue-next'
|
||||
|
||||
const route = useRoute()
|
||||
const token = ref(String(route.query.token || ''))
|
||||
|
||||
const email = ref('')
|
||||
const isLoading = ref(false)
|
||||
const errorMessage = ref('')
|
||||
const successMessage = ref('')
|
||||
|
||||
const isPasskeySupported = ref(false)
|
||||
if (process.client) {
|
||||
isPasskeySupported.value = !!window.PublicKeyCredential
|
||||
}
|
||||
|
||||
const requestLink = async () => {
|
||||
errorMessage.value = ''
|
||||
successMessage.value = ''
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await $fetch('/api/auth/passkeys/recovery/request', {
|
||||
method: 'POST',
|
||||
body: { email: email.value }
|
||||
})
|
||||
successMessage.value = res.message || 'Falls ein Konto existiert, wurde eine E-Mail gesendet.'
|
||||
} catch (e) {
|
||||
errorMessage.value = e?.data?.message || 'Fehler beim Senden der E-Mail.'
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const addPasskeyViaToken = async () => {
|
||||
errorMessage.value = ''
|
||||
successMessage.value = ''
|
||||
if (!isPasskeySupported.value) {
|
||||
errorMessage.value = 'Passkeys sind in diesem Browser/unter dieser URL nicht verfügbar (HTTPS erforderlich).'
|
||||
return
|
||||
}
|
||||
|
||||
isLoading.value = true
|
||||
try {
|
||||
const opts = await $fetch('/api/auth/passkeys/recovery/options', {
|
||||
method: 'GET',
|
||||
query: { token: token.value }
|
||||
})
|
||||
|
||||
const mod = await import('@simplewebauthn/browser')
|
||||
// @simplewebauthn/browser v13+ erwartet { optionsJSON: options }
|
||||
const credential = await mod.startRegistration({ optionsJSON: opts.options })
|
||||
|
||||
const res = await $fetch('/api/auth/passkeys/recovery/complete', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
recoveryId: opts.recoveryId,
|
||||
credential
|
||||
}
|
||||
})
|
||||
|
||||
successMessage.value = res.message || 'Passkey hinzugefügt.'
|
||||
} catch (e) {
|
||||
errorMessage.value = e?.data?.message || e?.message || 'Passkey konnte nicht hinzugefügt werden.'
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
useHead({ title: 'Passkey wiederherstellen - Harheimer TC' })
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user