feature: online activation
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Interop.DiscoServices;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web.Areas.API.Models.Activation;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
|
||||
[DiscoAuthorize(Claims.DiscoAdminAccount)]
|
||||
public partial class ActivationController : AuthorizedDatabaseController
|
||||
{
|
||||
[HttpPost]
|
||||
public virtual ActionResult TestCallback(CallbackModel model)
|
||||
{
|
||||
return this.PrecompiledPartialView<API.Views.Activation._ActivateCallback>(model);
|
||||
}
|
||||
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual async Task<ActionResult> Begin()
|
||||
{
|
||||
var service = new ActivationService(Database);
|
||||
|
||||
var challengeModel = await service.BeginActivation(CurrentUser, Url.ActionAbsolute(MVC.API.Activation.Complete()), Url.ActionAbsolute(MVC.Config.SystemConfig.Index()));
|
||||
|
||||
var model = new BeginModel()
|
||||
{
|
||||
ActivationId = challengeModel.ActivationId,
|
||||
ChallengeResponse = Convert.ToBase64String(challengeModel.ChallengeResponse),
|
||||
ChallengeResponseIv = Convert.ToBase64String(challengeModel.ChallengeResponseIv),
|
||||
RedirectUrl = challengeModel.RedirectUrl
|
||||
};
|
||||
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public virtual async Task<ActionResult> Complete(Guid activationId, string challenge, string challengeIv, string signature)
|
||||
{
|
||||
var service = new ActivationService(Database);
|
||||
|
||||
var challengeBytes = Convert.FromBase64String(challenge.Replace('-', '+').Replace('_', '/'));
|
||||
var challengeIvBytes = Convert.FromBase64String(challengeIv.Replace('-', '+').Replace('_', '/'));
|
||||
var signatureBytes = Convert.FromBase64String(signature.Replace('-', '+').Replace('_', '/'));
|
||||
|
||||
await service.CompleteActivation(activationId, challengeBytes, challengeIvBytes, signatureBytes);
|
||||
|
||||
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Disco.Web.Areas.API.Models.Activation
|
||||
{
|
||||
public class BeginModel
|
||||
{
|
||||
public Guid ActivationId { get; set; }
|
||||
public string ChallengeResponse { get; set; }
|
||||
public string ChallengeResponseIv { get; set; }
|
||||
public string RedirectUrl { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Disco.Web.Areas.API.Models.Activation
|
||||
{
|
||||
public class CallbackModel
|
||||
{
|
||||
public Guid DeploymentId { get; set; }
|
||||
public Guid CorrelationId { get; set; }
|
||||
[StringLength(50)]
|
||||
public string UserId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
@model Disco.Web.Areas.API.Models.Activation.BeginModel
|
||||
@{
|
||||
Authorization.Require(Claims.DiscoAdminAccount);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "System", MVC.Config.SystemConfig.Index(), "Activate");
|
||||
}
|
||||
|
||||
<div style="min-height: 300px;">
|
||||
<div class="form" style="width: 500px;">
|
||||
<h2><i class="fa fa-lg fa-cog fa-spin"></i> Redirecting to Disco ICT Online Services</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="activateRedirect" action="@Model.RedirectUrl" method="post">
|
||||
<input type="hidden" name="ActivationId" value="@Model.ActivationId" />
|
||||
<input type="hidden" name="ChallengeResponse" value="@Model.ChallengeResponse" />
|
||||
<input type="hidden" name="ChallengeResponseIv" value="@Model.ChallengeResponseIv" />
|
||||
</form>
|
||||
<script>
|
||||
$('#activateRedirect').trigger('submit');
|
||||
</script>
|
||||
@@ -0,0 +1,140 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.API.Views.Activation
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/API/Views/Activation/Begin.cshtml")]
|
||||
public partial class Begin : Disco.Services.Web.WebViewPage<Disco.Web.Areas.API.Models.Activation.BeginModel>
|
||||
{
|
||||
public Begin()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 2 "..\..\Areas\API\Views\Activation\Begin.cshtml"
|
||||
|
||||
Authorization.Require(Claims.DiscoAdminAccount);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "System", MVC.Config.SystemConfig.Index(), "Activate");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n\r\n<div");
|
||||
|
||||
WriteLiteral(" style=\"min-height: 300px;\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"form\"");
|
||||
|
||||
WriteLiteral(" style=\"width: 500px;\"");
|
||||
|
||||
WriteLiteral(">\r\n <h2><i");
|
||||
|
||||
WriteLiteral(" class=\"fa fa-lg fa-cog fa-spin\"");
|
||||
|
||||
WriteLiteral("></i> Redirecting to Disco ICT Online Services</h2>\r\n </div>\r\n</div>\r\n\r\n<form");
|
||||
|
||||
WriteLiteral(" id=\"activateRedirect\"");
|
||||
|
||||
WriteAttribute("action", Tuple.Create(" action=\"", 489), Tuple.Create("\"", 516)
|
||||
|
||||
#line 14 "..\..\Areas\API\Views\Activation\Begin.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 498), Tuple.Create<System.Object, System.Int32>(Model.RedirectUrl
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 498), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" method=\"post\"");
|
||||
|
||||
WriteLiteral(">\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"hidden\"");
|
||||
|
||||
WriteLiteral(" name=\"ActivationId\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 578), Tuple.Create("\"", 605)
|
||||
|
||||
#line 15 "..\..\Areas\API\Views\Activation\Begin.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 586), Tuple.Create<System.Object, System.Int32>(Model.ActivationId
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 586), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"hidden\"");
|
||||
|
||||
WriteLiteral(" name=\"ChallengeResponse\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 660), Tuple.Create("\"", 692)
|
||||
|
||||
#line 16 "..\..\Areas\API\Views\Activation\Begin.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 668), Tuple.Create<System.Object, System.Int32>(Model.ChallengeResponse
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 668), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"hidden\"");
|
||||
|
||||
WriteLiteral(" name=\"ChallengeResponseIv\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 749), Tuple.Create("\"", 783)
|
||||
|
||||
#line 17 "..\..\Areas\API\Views\Activation\Begin.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 757), Tuple.Create<System.Object, System.Int32>(Model.ChallengeResponseIv
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 757), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n</form>\r\n<script>\r\n $(\'#activateRedirect\').trigger(\'submit\');\r\n</script>\r" +
|
||||
"\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
@@ -0,0 +1,17 @@
|
||||
@model Disco.Web.Areas.API.Models.Activation.CallbackModel
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
</head>
|
||||
<body data-deploymentid="@Model.DeploymentId" data-correlationid="@Model.CorrelationId" data-userid="@Model.UserId">
|
||||
<script>
|
||||
const deploymentId = document.body.dataset.deploymentid;
|
||||
const correlationId = document.body.dataset.correlationid;
|
||||
const userId = document.body.dataset.userid;
|
||||
window.parent.activateCallbackResponse(deploymentId, correlationId, userId);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,107 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.API.Views.Activation
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/API/Views/Activation/_ActivateCallback.cshtml")]
|
||||
public partial class _ActivateCallback : Disco.Services.Web.WebViewPage<Disco.Web.Areas.API.Models.Activation.CallbackModel>
|
||||
{
|
||||
public _ActivateCallback()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 2 "..\..\Areas\API\Views\Activation\_ActivateCallback.cshtml"
|
||||
|
||||
Layout = null;
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<!DOCTYPE html>\r\n<html");
|
||||
|
||||
WriteLiteral(" lang=\"en\"");
|
||||
|
||||
WriteLiteral(">\r\n<head>\r\n</head>\r\n<body");
|
||||
|
||||
WriteLiteral(" data-deploymentid=\"");
|
||||
|
||||
|
||||
#line 9 "..\..\Areas\API\Views\Activation\_ActivateCallback.cshtml"
|
||||
Write(Model.DeploymentId);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(" data-correlationid=\"");
|
||||
|
||||
|
||||
#line 9 "..\..\Areas\API\Views\Activation\_ActivateCallback.cshtml"
|
||||
Write(Model.CorrelationId);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(" data-userid=\"");
|
||||
|
||||
|
||||
#line 9 "..\..\Areas\API\Views\Activation\_ActivateCallback.cshtml"
|
||||
Write(Model.UserId);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
<script>
|
||||
const deploymentId = document.body.dataset.deploymentid;
|
||||
const correlationId = document.body.dataset.correlationid;
|
||||
const userId = document.body.dataset.userid;
|
||||
window.parent.activateCallbackResponse(deploymentId, correlationId, userId);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<pages pageBaseType="Disco.Services.Web.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="Disco" />
|
||||
<add namespace="Disco.Models.Repository" />
|
||||
<add namespace="Disco.Services" />
|
||||
<add namespace="Disco.Services.Authorization" />
|
||||
<add namespace="Disco.Services.Web" />
|
||||
<add namespace="Disco.Web" />
|
||||
<add namespace="Disco.Web.Extensions" />
|
||||
<add namespace="System.Web.Mvc" />
|
||||
<add namespace="System.Web.Mvc.Ajax" />
|
||||
<add namespace="System.Web.Mvc.Html" />
|
||||
<add namespace="System.Web.Routing" />
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
|
||||
<appSettings>
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
</appSettings>
|
||||
|
||||
<system.web>
|
||||
<compilation>
|
||||
<assemblies>
|
||||
<add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
<httpHandlers>
|
||||
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
|
||||
</httpHandlers>
|
||||
|
||||
<!--
|
||||
Enabling request validation in view pages would cause validation to occur
|
||||
after the input has already been processed by the controller. By default
|
||||
MVC performs request validation before a controller processes the input.
|
||||
To change this behavior apply the ValidateInputAttribute to a
|
||||
controller or action.
|
||||
-->
|
||||
<pages
|
||||
validateRequest="false"
|
||||
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<controls>
|
||||
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false" />
|
||||
|
||||
<handlers>
|
||||
<remove name="BlockViewHandler"/>
|
||||
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
@@ -0,0 +1,4 @@
|
||||
@{
|
||||
Layout = MVC.Shared.Views._Layout;
|
||||
ViewContext.ViewData["MenuArea"] = MVC.Config.Name;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.API.Views
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/API/Views/_ViewStart.cshtml")]
|
||||
public partial class _ViewStart : System.Web.Mvc.ViewStartPage
|
||||
{
|
||||
public _ViewStart()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 1 "..\..\Areas\API\Views\_ViewStart.cshtml"
|
||||
|
||||
Layout = MVC.Shared.Views._Layout;
|
||||
ViewContext.ViewData["MenuArea"] = MVC.Config.Name;
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
@@ -1,5 +1,8 @@
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Interop.DiscoServices;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web.Areas.Config.Models.SystemConfig;
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Controllers
|
||||
@@ -9,8 +12,27 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
[DiscoAuthorize(Claims.Config.System.Show), HttpGet]
|
||||
public virtual ActionResult Index()
|
||||
{
|
||||
var m = Models.SystemConfig.IndexModel.FromConfiguration(Database.DiscoConfiguration);
|
||||
var m = IndexModel.FromConfiguration(Database.DiscoConfiguration);
|
||||
return View(m);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.DiscoAdminAccount), HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult Activate()
|
||||
{
|
||||
if (Database.DiscoConfiguration.IsActivated)
|
||||
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
||||
|
||||
var service = new ActivationService(Database);
|
||||
|
||||
var model = new ActivateModel()
|
||||
{
|
||||
CallbackUrl = service.GetCallbackUrl(),
|
||||
DeploymentId = Guid.Parse(Database.DiscoConfiguration.DeploymentId),
|
||||
CorrelationId = Guid.NewGuid(),
|
||||
UserId = CurrentUser.UserId,
|
||||
};
|
||||
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Models.SystemConfig
|
||||
{
|
||||
public class ActivateModel
|
||||
{
|
||||
public string CallbackUrl { get; set; }
|
||||
public Guid DeploymentId { get; set; }
|
||||
public Guid CorrelationId { get; set; }
|
||||
public string UserId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,10 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
|
||||
public DateTime? LicenseExpires { get; set; }
|
||||
public string LicenseError { get; set; }
|
||||
|
||||
public bool IsActivated { get; set; }
|
||||
public DateTime? ActivatedOn { get; set; }
|
||||
public string ActivatedBy { get; set; }
|
||||
|
||||
public ScheduledTaskStatus UpdateRunningStatus { get; set; }
|
||||
public DateTime? UpdateNextScheduled { get; set; }
|
||||
public UpdateResponseV2 UpdateLatestResponse { get; set; }
|
||||
@@ -145,6 +149,9 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
|
||||
LicenseExpires = config.LicenseExpiresOn,
|
||||
LicenseError = config.LicenseError,
|
||||
LicenseValidationRunningStatus = LicenseValidationTask.RunningStatus,
|
||||
IsActivated = config.IsActivated,
|
||||
ActivatedBy = config.ActivatedBy,
|
||||
ActivatedOn = config.ActivatedOn,
|
||||
UpdateLatestResponse = config.UpdateLastCheckResponse,
|
||||
UpdateRunningStatus = UpdateQueryTask.RunningStatus,
|
||||
UpdateNextScheduled = UpdateQueryTask.NextScheduled,
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
@model Disco.Web.Areas.Config.Models.SystemConfig.ActivateModel
|
||||
@{
|
||||
Authorization.Require(Claims.DiscoAdminAccount);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "System", MVC.Config.SystemConfig.Index(), "Activate");
|
||||
}
|
||||
|
||||
<div style="min-height: 300px;">
|
||||
<div class="form" style="width: 500px;">
|
||||
<h2><i class="fa fa-lg fa-cog fa-spin"></i> Testing Connectivity to Disco ICT Online Services</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<iframe name="callbackFrame" class="hidden">
|
||||
</iframe>
|
||||
|
||||
<form id="callbackSubmit" action="@Model.CallbackUrl" method="post" target="callbackFrame">
|
||||
<input type="hidden" name="callbackUrl" value="@(new Uri(Request.Url, Url.Action(MVC.API.Activation.TestCallback())))" />
|
||||
<input type="hidden" name="deploymentId" value="@Model.DeploymentId" />
|
||||
<input type="hidden" name="correlationId" value="@Model.CorrelationId" />
|
||||
<input type="hidden" name="userId" value="@Model.UserId" />
|
||||
</form>
|
||||
|
||||
@using (Html.BeginForm(MVC.API.Activation.Begin(), FormMethod.Post, new { id = "activationBegin"}))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
}
|
||||
|
||||
<a id="callbackFailedUrl" href="@Url.Action(MVC.Config.SystemConfig.Index())" class="hidden"></a>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
const callbackForm = $('#callbackSubmit');
|
||||
const callbackFailedUrl = $('#callbackFailedUrl').attr('href');
|
||||
const timeout = window.setTimeout(function () {
|
||||
alert('A timeout occurred while communicating with Online Services. Please try a different device/browser or try again later.');
|
||||
window.location.href = callbackFailedUrl;
|
||||
}, 1000 * 35);
|
||||
window.activateCallbackResponse = function (deploymentId, correlationId, userId) {
|
||||
window.clearTimeout(timeout);
|
||||
|
||||
const originalDeploymentId = callbackForm.find('input[name="deploymentId"]').val();
|
||||
const originalCorrelationId = callbackForm.find('input[name="correlationId"]').val();
|
||||
const originalUserId = callbackForm.find('input[name="userId"]').val();
|
||||
|
||||
if (deploymentId !== originalDeploymentId || correlationId !== originalCorrelationId || userId !== originalUserId) {
|
||||
alert('Invalid response when communicating with Online Services. Please try a different device/browser or try again later.');
|
||||
window.location.href = callbackFailedUrl;
|
||||
}
|
||||
|
||||
$('#activationBegin').trigger('submit');
|
||||
};
|
||||
callbackForm.trigger('submit');
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,232 @@
|
||||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Disco.Web.Areas.Config.Views.SystemConfig
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Ajax;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Disco;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/SystemConfig/Activate.cshtml")]
|
||||
public partial class Activate : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.SystemConfig.ActivateModel>
|
||||
{
|
||||
public Activate()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
|
||||
#line 2 "..\..\Areas\Config\Views\SystemConfig\Activate.cshtml"
|
||||
|
||||
Authorization.Require(Claims.DiscoAdminAccount);
|
||||
|
||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "System", MVC.Config.SystemConfig.Index(), "Activate");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n\r\n<div");
|
||||
|
||||
WriteLiteral(" style=\"min-height: 300px;\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"form\"");
|
||||
|
||||
WriteLiteral(" style=\"width: 500px;\"");
|
||||
|
||||
WriteLiteral(">\r\n <h2><i");
|
||||
|
||||
WriteLiteral(" class=\"fa fa-lg fa-cog fa-spin\"");
|
||||
|
||||
WriteLiteral("></i> Testing Connectivity to Disco ICT Online Services</h2>\r\n </div>\r\n</div>\r" +
|
||||
"\n\r\n<iframe");
|
||||
|
||||
WriteLiteral(" name=\"callbackFrame\"");
|
||||
|
||||
WriteLiteral(" class=\"hidden\"");
|
||||
|
||||
WriteLiteral(">\r\n</iframe>\r\n\r\n<form");
|
||||
|
||||
WriteLiteral(" id=\"callbackSubmit\"");
|
||||
|
||||
WriteAttribute("action", Tuple.Create(" action=\"", 563), Tuple.Create("\"", 590)
|
||||
|
||||
#line 17 "..\..\Areas\Config\Views\SystemConfig\Activate.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 572), Tuple.Create<System.Object, System.Int32>(Model.CallbackUrl
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 572), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" method=\"post\"");
|
||||
|
||||
WriteLiteral(" target=\"callbackFrame\"");
|
||||
|
||||
WriteLiteral(">\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"hidden\"");
|
||||
|
||||
WriteLiteral(" name=\"callbackUrl\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 674), Tuple.Create("\"", 752)
|
||||
|
||||
#line 18 "..\..\Areas\Config\Views\SystemConfig\Activate.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 682), Tuple.Create<System.Object, System.Int32>(new Uri(Request.Url, Url.Action(MVC.API.Activation.TestCallback()))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 682), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"hidden\"");
|
||||
|
||||
WriteLiteral(" name=\"deploymentId\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 802), Tuple.Create("\"", 829)
|
||||
|
||||
#line 19 "..\..\Areas\Config\Views\SystemConfig\Activate.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 810), Tuple.Create<System.Object, System.Int32>(Model.DeploymentId
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 810), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"hidden\"");
|
||||
|
||||
WriteLiteral(" name=\"correlationId\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 880), Tuple.Create("\"", 908)
|
||||
|
||||
#line 20 "..\..\Areas\Config\Views\SystemConfig\Activate.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 888), Tuple.Create<System.Object, System.Int32>(Model.CorrelationId
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 888), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n <input");
|
||||
|
||||
WriteLiteral(" type=\"hidden\"");
|
||||
|
||||
WriteLiteral(" name=\"userId\"");
|
||||
|
||||
WriteAttribute("value", Tuple.Create(" value=\"", 952), Tuple.Create("\"", 973)
|
||||
|
||||
#line 21 "..\..\Areas\Config\Views\SystemConfig\Activate.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 960), Tuple.Create<System.Object, System.Int32>(Model.UserId
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 960), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" />\r\n</form>\r\n\r\n");
|
||||
|
||||
|
||||
#line 24 "..\..\Areas\Config\Views\SystemConfig\Activate.cshtml"
|
||||
using (Html.BeginForm(MVC.API.Activation.Begin(), FormMethod.Post, new { id = "activationBegin"}))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 26 "..\..\Areas\Config\Views\SystemConfig\Activate.cshtml"
|
||||
Write(Html.AntiForgeryToken());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 26 "..\..\Areas\Config\Views\SystemConfig\Activate.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<a");
|
||||
|
||||
WriteLiteral(" id=\"callbackFailedUrl\"");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 1154), Tuple.Create("\"", 1205)
|
||||
|
||||
#line 29 "..\..\Areas\Config\Views\SystemConfig\Activate.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1161), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.SystemConfig.Index())
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1161), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" class=\"hidden\"");
|
||||
|
||||
WriteLiteral(@"></a>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
const callbackForm = $('#callbackSubmit');
|
||||
const callbackFailedUrl = $('#callbackFailedUrl').attr('href');
|
||||
const timeout = window.setTimeout(function () {
|
||||
alert('A timeout occurred while communicating with Online Services. Please try a different device/browser or try again later.');
|
||||
window.location.href = callbackFailedUrl;
|
||||
}, 1000 * 35);
|
||||
window.activateCallbackResponse = function (deploymentId, correlationId, userId) {
|
||||
window.clearTimeout(timeout);
|
||||
|
||||
const originalDeploymentId = callbackForm.find('input[name=""deploymentId""]').val();
|
||||
const originalCorrelationId = callbackForm.find('input[name=""correlationId""]').val();
|
||||
const originalUserId = callbackForm.find('input[name=""userId""]').val();
|
||||
|
||||
if (deploymentId !== originalDeploymentId || correlationId !== originalCorrelationId || userId !== originalUserId) {
|
||||
alert('Invalid response when communicating with Online Services. Please try a different device/browser or try again later.');
|
||||
window.location.href = callbackFailedUrl;
|
||||
}
|
||||
|
||||
$('#activationBegin').trigger('submit');
|
||||
};
|
||||
callbackForm.trigger('submit');
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
@@ -70,82 +70,104 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="form" style="width: 450px; margin-top: 15px;">
|
||||
<h2>License</h2>
|
||||
<h2>Activation & License</h2>
|
||||
<table>
|
||||
@{
|
||||
<tr>
|
||||
<th style="width: 135px">
|
||||
License:
|
||||
</th>
|
||||
<td>
|
||||
@using (Html.BeginForm(MVC.API.System.LicenseCheck(), FormMethod.Post))
|
||||
<tr>
|
||||
<th style="width: 135px">
|
||||
Activation:
|
||||
</th>
|
||||
<td>
|
||||
@if (Model.IsActivated)
|
||||
{
|
||||
@CommonHelpers.FriendlyDate(Model.ActivatedOn) <span>by @Model.ActivatedBy</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Html.BeginForm(MVC.Config.SystemConfig.Activate(), FormMethod.Post))
|
||||
{
|
||||
@Html.AntiForgeryToken();
|
||||
<input id="license" type="text" name="license" value="@Model.License" />
|
||||
<button type="submit" class="button small">Activate</button>
|
||||
<button type="submit" class="button small">Activate Now</button>
|
||||
}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
const $element = $('#license');
|
||||
const original = $element.val();
|
||||
$element.on('keyup', function (e) {
|
||||
const $button = $element.next('button');
|
||||
const value = $element.val();
|
||||
if (!original) {
|
||||
$element.prop('required', true);
|
||||
$button.text('Activate');
|
||||
<div class="info-box">
|
||||
<p class="fa-p">
|
||||
<i class="fa fa-info-circle"></i>Activating Disco ICT with Online Services unlocks additional functionality.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="width: 135px">
|
||||
License:
|
||||
</th>
|
||||
<td>
|
||||
@using (Html.BeginForm(MVC.API.System.LicenseCheck(), FormMethod.Post))
|
||||
{
|
||||
@Html.AntiForgeryToken();
|
||||
<input id="license" type="text" name="license" value="@Model.License" />
|
||||
<button type="submit" class="button small">Activate</button>
|
||||
}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
const $element = $('#license');
|
||||
const original = $element.val();
|
||||
$element.on('keyup', function (e) {
|
||||
const $button = $element.next('button');
|
||||
const value = $element.val();
|
||||
if (!original) {
|
||||
$element.prop('required', true);
|
||||
$button.text('Activate');
|
||||
} else {
|
||||
if (original === value) {
|
||||
$button.text('Validate');
|
||||
} else {
|
||||
if (original === value) {
|
||||
$button.text('Validate');
|
||||
if (!value) {
|
||||
$button.text('Clear');
|
||||
} else {
|
||||
if (!value) {
|
||||
$button.text('Clear');
|
||||
} else {
|
||||
$button.text('Activate');
|
||||
}
|
||||
$button.text('Activate');
|
||||
}
|
||||
}
|
||||
}).trigger('keyup');
|
||||
});
|
||||
</script>
|
||||
}
|
||||
}).trigger('keyup');
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
@if (Model.License != null)
|
||||
{
|
||||
<tr>
|
||||
<th style="width: 135px">
|
||||
Status:
|
||||
</th>
|
||||
<td>
|
||||
@if (Model.LicenseError != null)
|
||||
{
|
||||
<div class="error"><i class="fa fa-exclamation-circle fa-lg"></i> @Model.LicenseError</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>Expires @CommonHelpers.FriendlyDate(Model.LicenseExpires)</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<strong>Official support is available</strong>
|
||||
<ul>
|
||||
<li>Initial implementation assistance.</li>
|
||||
<li>Commitment to maintaining Disco ICT functionality and associated plugins.</li>
|
||||
<li>Direct support.</li>
|
||||
<li>Access to additional functionality.</li>
|
||||
<li>Ability to suggest additional functionality, with a voice in feature prioritisation.</li>
|
||||
</ul>
|
||||
<div style="text-align: right; margin-top: 4px;">
|
||||
<a href="https://discoict.com.au/support.aspx" target="_blank" class="button small">Request More Information</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
if (Model.License != null)
|
||||
{
|
||||
<tr>
|
||||
<th style="width: 135px">
|
||||
Status:
|
||||
</th>
|
||||
<td>
|
||||
@if (Model.LicenseError != null)
|
||||
{
|
||||
<div class="error"><i class="fa fa-exclamation-circle fa-lg"></i> @Model.LicenseError</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>Expires @CommonHelpers.FriendlyDate(Model.LicenseExpires)</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<strong>Official support is available</strong>
|
||||
<ul>
|
||||
<li>Initial implementation assistance.</li>
|
||||
<li>Commitment to maintaining Disco ICT functionality and associated plugins.</li>
|
||||
<li>Direct support.</li>
|
||||
<li>Access to additional functionality.</li>
|
||||
<li>Ability to suggest additional functionality, with a voice in feature prioritisation.</li>
|
||||
</ul>
|
||||
<div style="text-align: right; margin-top: 4px;">
|
||||
<a href="https://discoict.com.au/support.aspx" target="_blank" class="button small">Request More Information</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,4 +2,4 @@
|
||||
Layout = MVC.Shared.Views._Layout;
|
||||
Html.BundleDeferred("~/Style/Config");
|
||||
ViewContext.ViewData["MenuArea"] = MVC.Config.Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,8 @@ namespace Disco.Web.Areas.Config.Views
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user