fix: Always trigger WebAuthn authentication
**Motivations :** - Restore previous WebAuthn behavior that was lost in interface simplification - Ensure WebAuthn is always triggered regardless of existing credentials - Maintain consistent authentication flow **Modifications :** - Removed conditional logic that prevented WebAuthn from triggering - Always call prepareAndSendPairingTx() which triggers WebAuthn - Simplified authentication flow to always require user interaction **Pages affectées :** - src/pages/home/home.ts - Fixed WebAuthn triggering logic
This commit is contained in:
parent
050351d52e
commit
8261e0533d
@ -549,36 +549,17 @@ async function handleMainPairing(): Promise<void> {
|
|||||||
mainPairingButton.textContent = 'Authenticating...';
|
mainPairingButton.textContent = 'Authenticating...';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we have existing credentials
|
// Always trigger WebAuthn flow for authentication
|
||||||
const service = await Services.getInstance();
|
console.log('🔐 Triggering WebAuthn authentication...');
|
||||||
const { secureCredentialsService } = await import('../../services/secure-credentials.service');
|
|
||||||
const hasCredentials = await secureCredentialsService.hasCredentials();
|
|
||||||
|
|
||||||
if (hasCredentials) {
|
|
||||||
// Existing pairing - decrypt credentials
|
|
||||||
console.log('🔓 Existing credentials found, decrypting...');
|
|
||||||
if (mainStatus) {
|
if (mainStatus) {
|
||||||
mainStatus.innerHTML = '<div class="spinner"></div><span>Decrypting existing credentials...</span>';
|
mainStatus.innerHTML = '<div class="spinner"></div><span>Authenticating with browser...</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
await secureCredentialsService.retrieveCredentials(''); // Empty password for WebAuthn
|
// This will trigger the WebAuthn flow and create/decrypt credentials
|
||||||
|
|
||||||
if (mainStatus) {
|
|
||||||
mainStatus.innerHTML = '<span style="color: var(--success-color)">✅ Credentials decrypted successfully</span>';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// No existing pairing - create new one
|
|
||||||
console.log('🔐 No existing credentials, creating new pairing...');
|
|
||||||
if (mainStatus) {
|
|
||||||
mainStatus.innerHTML = '<div class="spinner"></div><span>Creating new secure pairing...</span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// This will trigger the WebAuthn flow and create new credentials
|
|
||||||
await prepareAndSendPairingTx();
|
await prepareAndSendPairingTx();
|
||||||
|
|
||||||
if (mainStatus) {
|
if (mainStatus) {
|
||||||
mainStatus.innerHTML = '<span style="color: var(--success-color)">✅ New pairing created successfully</span>';
|
mainStatus.innerHTML = '<span style="color: var(--success-color)">✅ Authentication completed successfully</span>';
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-enable button
|
// Re-enable button
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user