1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

Change WebAuthn connectors from using inline onclick to external (#969)

This commit is contained in:
Oscar Hinton 2021-05-12 17:19:20 +02:00 committed by GitHub
parent 51f3fee75d
commit a3506e833a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 10 deletions

View File

@ -25,7 +25,7 @@
</div>
<hr>
<p class="text-center mb-0">
<button id="webauthn-button" onClick="javascript:init()" class="btn btn-primary btn-lg"></button>
<button id="webauthn-button" class="btn btn-primary btn-lg"></button>
</p>
</div>
</div>

View File

@ -19,7 +19,10 @@ document.addEventListener('DOMContentLoaded', async () => {
document.getElementById('msg').innerText = translate('webAuthnFallbackMsg');
document.getElementById('remember-label').innerText = translate('rememberMe');
document.getElementById('webauthn-button').innerText = translate('webAuthnAuthenticate');
const button = document.getElementById('webauthn-button');
button.innerText = translate('webAuthnAuthenticate');
button.onclick = start;
document.getElementById('spinner').classList.add('d-none');
const content = document.getElementById('content');
@ -31,10 +34,6 @@ function translate(id: string) {
return locales[id]?.message || '';
}
(window as any).init = () => {
start();
};
function start() {
if (sentSuccess) {
return;

View File

@ -9,7 +9,7 @@
<body style="background: transparent;">
<img src="../images/u2fkey.jpg" class="rounded img-fluid mb-3">
<div class="text-center">
<button id="webauthn-button" class="btn btn-primary" onclick="javascript:executeWebAuthn()"></button>
<button id="webauthn-button" class="btn btn-primary"></button>
</div>
</body>

View File

@ -9,7 +9,9 @@ document.addEventListener('DOMContentLoaded', () => {
const text = getQsParam('btnText');
if (text) {
document.getElementById('webauthn-button').innerText = decodeURI(text);
const button = document.getElementById('webauthn-button');
button.innerText = decodeURI(text);
button.onclick = executeWebAuthn;
}
});
@ -76,8 +78,6 @@ function executeWebAuthn() {
.catch(err => error('WebAuth Error: ' + err));
}
(window as any).executeWebAuthn = executeWebAuthn;
function onMessage() {
window.addEventListener('message', event => {
if (!event.origin || event.origin === '' || event.origin !== parentOrigin) {