10000 Support disable passkey auth (#33348) by wxiaoguang · Pull Request #33819 · go-gitea/gitea · GitHub
[go: up one dir, main page]

Skip to content

Support disable passkey auth (#33348) #33819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 7, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix
  • Loading branch information
wxiaoguang committed Mar 7, 2025
commit b3136f94f0858db2a243628264bcd8639cd1037e
11 changes: 10 additions & 1 deletion web_src/js/features/user-auth-webauthn.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {encodeURLEncodedBase64, decodeURLEncodedBase64} from '../utils.ts';
import {showElem} from '../utils/dom.ts';
import {hideElem, showElem} from '../utils/dom.ts';
import {GET, POST} from '../modules/fetch.ts';

const {appSubUrl} = window.config;
Expand All @@ -11,6 +11,15 @@ 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;
}
}

if (!detectWebAuthnSupport()) {
return;
}
Expand Down
0