Skip to content

Commit b3fd9df

Browse files
committed
Add page for Dynamics authorization
1 parent b6c841d commit b3fd9df

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@page "/oauth/dynamics"
2+
@model Umbraco.Cms.Integrations.OAuthProxy.Pages.ShopifyModel
3+
@{
4+
ViewData["Title"] = "Authorization";
5+
}
6+
7+
<div class="text-center">
8+
<h1 class="display-4">Umbraco Integrations Authentication</h1>
9+
@if (!string.IsNullOrEmpty(Model.AuthorizationCode))
10+
{
11+
<div id="manual-complete" style="display: none">
12+
<p>To complete the integration, please copy the following code and enter it in Umbraco using the form provided.</p>
13+
14+
<p><input id="auth-code" type="text" value="@Model.AuthorizationCode" readonly style="width: 700px; font-size: 36px; text-align: center" /></p>
15+
16+
<button onclick="copyToClipboard()">Copy To Clipboard</button>
17+
</div>
18+
19+
<script>
20+
if (window.opener && typeof opener.postMessage === 'function') {
21+
opener.postMessage({ type: 'dynamics:oauth:success', url: location.href, code: '@Model.AuthorizationCode' }, '*');
22+
window.close();
23+
} else {
24+
document.getElementById("manual-complete").style.display = "block";
25+
} 1
26+
27+
function copyToClipboard() {
28+
var authCodeInputElement = document.getElementById("auth-code");
29+
authCodeInputElement.select();
30+
authCodeInputElement.setSelectionRange(0, 99999);
31+
navigator.clipboard.writeText(authCodeInputElement.value);
32+
alert("Code copied to clipboard");
33+
}
34+
</script>
35+
36+
}
37+
</div>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Microsoft.AspNetCore.Mvc.RazorPages;
2+
3+
namespace Umbraco.Cms.Integrations.OAuthProxy.Pages
4+
{
5+
public class DynamicsModel : PageModel
6+
{
7+
public string AuthorizationCode { get; set; }
8+
9+
public void OnGet()
10+
{
11+
AuthorizationCode = Request.Query["code"];
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)