fix(login): Copy to clipboard button in MFA login step now compatible in non-chrome browser (#9880)

related to issue [#9379](https://github.com/zitadel/zitadel/issues/9379)

# Which Problems Are Solved

Copy to clipboard button was not compatible with Webkit/ Firefox
browsers.

# How the Problems Are Solved

The previous function used addEventListener without a callback function
as a second argument. I simply added the callback function and left
existing code intact to fix the bug.

# Additional Changes

Added `type=button` to prevent submitting the form when clicking the
button.

# Additional Context

none

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
Connor
2025-05-28 07:06:27 +01:00
committed by GitHub
parent 4d66a786c8
commit 77b433367e
2 changed files with 2 additions and 2 deletions

View File

@@ -3,4 +3,4 @@ const copyToClipboard = str => {
};
let copyButton = document.getElementById("copy");
copyButton.addEventListener("click", copyToClipboard(copyButton.getAttribute("data-copy")));
copyButton.addEventListener("click", () => copyToClipboard(copyButton.getAttribute("data-copy")));

View File

@@ -28,7 +28,7 @@
<div class="lgn-row">
<span id="secret"> {{.Secret}} </span>
<span class="fill-space"></span>
<button id="copy" data-copy="{{ .Secret }}" class="lgn-icon-button">
<button id="copy" data-copy="{{ .Secret }}" class="lgn-icon-button" type="button">
<i class="lgn-icon-clipboard"></i>
</button>
</div>