mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 15:04:30 +00:00 
			
		
		
		
	Simplify secure context check (#33906)
As discussed in https://github.com/go-gitea/gitea/pull/33820/files#r1997532169.
This commit is contained in:
		@@ -11,13 +11,10 @@ export async function initUserAuthWebAuthn() {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (window.location.protocol === 'http:') {
 | 
			
		||||
    // webauthn is only supported on secure contexts
 | 
			
		||||
    const isLocalhost = ['localhost', '127.0.0.1'].includes(window.location.hostname);
 | 
			
		||||
    if (!isLocalhost) {
 | 
			
		||||
      hideElem(elSignInPasskeyBtn);
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
  // webauthn is only supported on secure contexts
 | 
			
		||||
  if (!window.isSecureContext) {
 | 
			
		||||
    hideElem(elSignInPasskeyBtn);
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (!detectWebAuthnSupport()) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user