Skip to content

Commit 3add1c5

Browse files
committed
Added button for copy to clipboard.
1 parent 85b751f commit 3add1c5

File tree

1 file changed

+14
-6
lines changed
  • src/Umbraco.Forms.Integrations.Crm.Hubspot.OAuthCallback/Pages

1 file changed

+14
-6
lines changed

src/Umbraco.Forms.Integrations.Crm.Hubspot.OAuthCallback/Pages/Index.cshtml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@
66

77
<div class="text-center">
88
<h1 class="display-4">Umbraco Forms / Hubspot</h1>
9-
@if (string.IsNullOrEmpty(Model.AuthorizationCode))
10-
{
11-
<p>Authentication failed - no authorization code received.</p>
12-
}
13-
else
9+
@if (!string.IsNullOrEmpty(Model.AuthorizationCode))
1410
{
1511
<p>To complete the integration, please copy the following code and enter it in Umbraco using the form provided.</p>
1612

17-
<p><input type="text" value="@Model.AuthorizationCode" readonly style="width: 700px; font-size: 36px; text-align: center" /></p>
13+
<p><input id="auth-code" type="text" value="@Model.AuthorizationCode" readonly style="width: 700px; font-size: 36px; text-align: center" /></p>
14+
15+
<button onclick="copyToClipboard()">Copy To Clipboard</button>
1816
}
1917
</div>
18+
19+
<script>
20+
function copyToClipboard() {
21+
var authCodeInputElement = document.getElementById("auth-code");
22+
authCodeInputElement.select();
23+
authCodeInputElement.setSelectionRange(0, 99999);
24+
navigator.clipboard.writeText(authCodeInputElement.value);
25+
alert("Code copied to clipboard");
26+
}
27+
</script>

0 commit comments

Comments
 (0)