Logo
Explore Help
Sign In
darkhelm/notifications-admin
1
0
Fork 0
You've already forked notifications-admin
mirror of https://github.com/GSA/notifications-admin.git synced 2026-07-06 01:19:00 -04:00
Code Issues Packages Projects Releases Wiki Activity
Files
d4c19140e8523fa532e3f2ebca2d4ec6b579ccdb
notifications-admin/app/templates/components/webauthn-api-check.html

8 lines
260 B
HTML
Raw Normal View History

Prevent registration if WebAuthn is not supported This hides the "Register" button and shows an error that's specific to one of two ways a browser may not support WebAuthn: - JavaScript is disabled (there's no possible fallback for this). - WebAuthn API is not supported (e.g. on Internet Explorer). We could add a similar check for the API in the JS code to handle the button click, but hiding it seems like enough protection. In order to avoid elements flashing when the page loads, this uses a view macro to embed a script at the start of the body element, which is the same approach used for the "js-enabled" class flag [1]. Tested with Chrome and IE 11. [1]: https://github.com/alphagov/govuk-frontend/blob/main/src/govuk/template.njk#L31
2021-05-13 14:52:32 +01:00
{% macro webauthn_api_check() %}
<script>
if ('credentials' in window.navigator) {
document.body.className = ((document.body.className) ? document.body.className + ' webauthn-api-enabled' : 'webauthn-api-enabled');
}
</script>
{% endmacro %}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.0 Page: 2201ms Template: 57ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API