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
@ -528,7 +528,7 @@ export function setupIframePairingButtons() {
|
|||||||
export function setupMainPairing(): void {
|
export function setupMainPairing(): void {
|
||||||
const container = getCorrectDOM('login-4nk-component') as HTMLElement;
|
const container = getCorrectDOM('login-4nk-component') as HTMLElement;
|
||||||
const mainStatus = container.querySelector('#main-status') as HTMLElement;
|
const mainStatus = container.querySelector('#main-status') as HTMLElement;
|
||||||
|
|
||||||
if (mainStatus) {
|
if (mainStatus) {
|
||||||
mainStatus.innerHTML = `
|
mainStatus.innerHTML = `
|
||||||
<div class="auth-container">
|
<div class="auth-container">
|
||||||
@ -538,7 +538,7 @@ export function setupMainPairing(): void {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('🔐 Main pairing setup - authentication will be automatic');
|
console.log('🔐 Main pairing setup - authentication will be automatic');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2542,35 +2542,20 @@ async function onCreateButtonClick() {
|
|||||||
console.log('🔍 DEBUG: protocol:', window.location.protocol);
|
console.log('🔍 DEBUG: protocol:', window.location.protocol);
|
||||||
|
|
||||||
const { secureCredentialsService } = await import('../services/secure-credentials.service');
|
const { secureCredentialsService } = await import('../services/secure-credentials.service');
|
||||||
updateCreatorStatus('🔐 Click to authenticate with browser...');
|
updateCreatorStatus('🔐 Authenticating with browser...');
|
||||||
|
|
||||||
// Force user interaction before WebAuthn
|
// Auto-trigger WebAuthn authentication
|
||||||
console.log('🔍 DEBUG: Waiting for user interaction...');
|
console.log('🔍 DEBUG: Auto-triggering WebAuthn authentication...');
|
||||||
|
|
||||||
// Create a button that requires user click
|
try {
|
||||||
const authButton = document.createElement('button');
|
// This should trigger the browser popup automatically
|
||||||
authButton.textContent = '🔐 Authenticate with Browser';
|
await secureCredentialsService.generateSecureCredentials('4nk-pairing-password');
|
||||||
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;';
|
console.log('✅ WebAuthn credentials obtained');
|
||||||
|
updateCreatorStatus('✅ Browser authentication successful');
|
||||||
// Show button and wait for click
|
} catch (error) {
|
||||||
document.body.appendChild(authButton);
|
console.error('❌ WebAuthn failed:', error);
|
||||||
|
updateCreatorStatus('❌ Browser authentication failed');
|
||||||
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();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('⚠️ WebAuthn failed, continuing with fallback:', error);
|
console.warn('⚠️ WebAuthn failed, continuing with fallback:', error);
|
||||||
updateCreatorStatus('⚠️ Using fallback authentication');
|
updateCreatorStatus('⚠️ Using fallback authentication');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user