fix: remove manual WebAuthn button and restore automatic authentication
**Motivations :** - Remove the manual 'Authenticate with Browser' button that was reappearing - Restore automatic WebAuthn authentication flow as requested by user - Ensure seamless user experience without manual intervention **Modifications :** - Removed dynamic button creation in sp-address.utils.ts onCreateButtonClick() - Changed WebAuthn flow from manual button click to automatic trigger - Updated status message from 'Click to authenticate' to 'Authenticating with browser...' - Simplified WebAuthn authentication to be automatic without user gesture requirement **Pages affectées :** - src/utils/sp-address.utils.ts: Removed manual button creation and restored auto WebAuthn
This commit is contained in:
parent
e393a4f615
commit
5def07797e
@ -2542,35 +2542,20 @@ async function onCreateButtonClick() {
|
||||
console.log('🔍 DEBUG: protocol:', window.location.protocol);
|
||||
|
||||
const { secureCredentialsService } = await import('../services/secure-credentials.service');
|
||||
updateCreatorStatus('🔐 Click to authenticate with browser...');
|
||||
updateCreatorStatus('🔐 Authenticating with browser...');
|
||||
|
||||
// Force user interaction before WebAuthn
|
||||
console.log('🔍 DEBUG: Waiting for user interaction...');
|
||||
// Auto-trigger WebAuthn authentication
|
||||
console.log('🔍 DEBUG: Auto-triggering WebAuthn authentication...');
|
||||
|
||||
// Create a button that requires user click
|
||||
const authButton = document.createElement('button');
|
||||
authButton.textContent = '🔐 Authenticate with Browser';
|
||||
authButton.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:9999;padding:20px;font-size:18px;background:#007bff;color:white;border:none;border-radius:8px;cursor:pointer;';
|
||||
|
||||
// Show button and wait for click
|
||||
document.body.appendChild(authButton);
|
||||
|
||||
await new Promise<void>((resolve) => {
|
||||
authButton.onclick = async () => {
|
||||
document.body.removeChild(authButton);
|
||||
try {
|
||||
// This should trigger the browser popup immediately after user click
|
||||
await secureCredentialsService.generateSecureCredentials('4nk-pairing-password');
|
||||
console.log('✅ WebAuthn credentials obtained');
|
||||
updateCreatorStatus('✅ Browser authentication successful');
|
||||
resolve();
|
||||
} catch (error) {
|
||||
console.error('❌ WebAuthn failed:', error);
|
||||
updateCreatorStatus('❌ Browser authentication failed');
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
});
|
||||
try {
|
||||
// This should trigger the browser popup automatically
|
||||
await secureCredentialsService.generateSecureCredentials('4nk-pairing-password');
|
||||
console.log('✅ WebAuthn credentials obtained');
|
||||
updateCreatorStatus('✅ Browser authentication successful');
|
||||
} catch (error) {
|
||||
console.error('❌ WebAuthn failed:', error);
|
||||
updateCreatorStatus('❌ Browser authentication failed');
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('⚠️ WebAuthn failed, continuing with fallback:', error);
|
||||
updateCreatorStatus('⚠️ Using fallback authentication');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user