-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added .gitattributes to enforce line endings on .NET files.
* (Gitattribute generated changes) * installation area is now completety disabled once OTE is installed
- Loading branch information
gauffininteractive
committed
Feb 27, 2017
1 parent
0192fd1
commit 1c7cc62
Showing
33 changed files
with
6,198 additions
and
6,169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto | ||
|
||
# Explicitly declare text files you want to always be normalized and converted | ||
# to native line endings on checkout. | ||
#*.c text | ||
#*.h text | ||
|
||
# Declare files that will always have CRLF line endings on checkout. | ||
*.sln text eol=crlf | ||
*.csproj text filter=csprojarrange | ||
*.cs text eol=crlf | ||
*.cshtml text eol=crlf | ||
*.ts text eol=crlf | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
*.png binary | ||
*.jpg binary | ||
*.gif binary | ||
*.obj binary | ||
*.exe binary | ||
*.dll binary |
308 changes: 154 additions & 154 deletions
308
src/Server/OneTrueError.Web/Areas/Installation/Controllers/SetupController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,155 +1,155 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using System.Web.Mvc; | ||
using OneTrueError.App.Configuration; | ||
using OneTrueError.Infrastructure; | ||
using OneTrueError.Infrastructure.Configuration; | ||
using OneTrueError.Web.Areas.Installation.Models; | ||
|
||
namespace OneTrueError.Web.Areas.Installation.Controllers | ||
{ | ||
public class SetupController : Controller | ||
{ | ||
[HttpPost, AllowAnonymous] | ||
public ActionResult Activate() | ||
{ | ||
ConfigurationManager.RefreshSection("appSettings"); | ||
if (ConfigurationManager.AppSettings["Configured"] != "true") | ||
{ | ||
return RedirectToAction("Completed", new | ||
{ | ||
displayError = 1 | ||
}); | ||
} | ||
return Redirect("~/?#/welcome"); | ||
} | ||
|
||
public ActionResult Support() | ||
{ | ||
return View(new SupportViewModel()); | ||
} | ||
|
||
[HttpPost] | ||
public async Task<ActionResult> Support(SupportViewModel model) | ||
{ | ||
if (!ModelState.IsValid) | ||
return View(model); | ||
|
||
try | ||
{ | ||
var client = new HttpClient(); | ||
var content = | ||
new FormUrlEncodedContent(new [] | ||
{ | ||
new KeyValuePair<string, string>("EmailAddress", model.Email), | ||
new KeyValuePair<string, string>("CompanyName", model.CompanyName) | ||
}); | ||
await client.PostAsync("https://onetrueerror.com/support/register/", content); | ||
return Redirect(Url.GetNextWizardStep()); | ||
} | ||
catch (Exception ex) | ||
{ | ||
ModelState.AddModelError("", ex.Message); | ||
return View(model); | ||
} | ||
} | ||
|
||
public ActionResult Basics() | ||
{ | ||
var model = new BasicsViewModel(); | ||
var config = ConfigurationStore.Instance.Load<BaseConfiguration>(); | ||
if (config != null) | ||
{ | ||
model.BaseUrl = config.BaseUrl.ToString(); | ||
model.SupportEmail = config.SupportEmail; | ||
} | ||
else | ||
{ | ||
model.BaseUrl = Request.Url.ToString().Replace("installation/setup/basics/", "").Replace("localhost", "yourServerName"); | ||
ViewBag.NextLink = ""; | ||
} | ||
|
||
|
||
return View(model); | ||
} | ||
|
||
[HttpPost] | ||
public ActionResult Basics(BasicsViewModel model) | ||
{ | ||
var settings = new BaseConfiguration(); | ||
if (!model.BaseUrl.EndsWith("/")) | ||
model.BaseUrl += "/"; | ||
|
||
if (model.BaseUrl.IndexOf("localhost", StringComparison.OrdinalIgnoreCase) != -1) | ||
{ | ||
ModelState.AddModelError("BaseUrl", "Use the servers real DNS name instead of 'localhost'. If you don't the Ajax request wont work as CORS would be enforced by IIS."); | ||
return View(model); | ||
} | ||
settings.BaseUrl = new Uri(model.BaseUrl); | ||
settings.SupportEmail = model.SupportEmail; | ||
ConfigurationStore.Instance.Store(settings); | ||
return Redirect(Url.GetNextWizardStep()); | ||
} | ||
|
||
|
||
public ActionResult Completed(string displayError = null) | ||
{ | ||
ViewBag.DisplayError = displayError == "1"; | ||
return View(); | ||
} | ||
|
||
public ActionResult Errors() | ||
{ | ||
var model = new ErrorTrackingViewModel(); | ||
var config = ConfigurationStore.Instance.Load<OneTrueErrorConfigSection>(); | ||
if (config != null) | ||
{ | ||
model.ActivateTracking = config.ActivateTracking; | ||
model.ContactEmail = config.ContactEmail; | ||
model.InstallationId = config.InstallationId; | ||
} | ||
else | ||
ViewBag.NextLink = ""; | ||
|
||
return View("ErrorTracking", model); | ||
} | ||
|
||
[HttpPost] | ||
public ActionResult Errors(ErrorTrackingViewModel model) | ||
{ | ||
if (!ModelState.IsValid) | ||
return View("ErrorTracking", model); | ||
|
||
var settings = new OneTrueErrorConfigSection(); | ||
settings.ActivateTracking = model.ActivateTracking; | ||
settings.ContactEmail = model.ContactEmail; | ||
settings.InstallationId = model.InstallationId; | ||
ConfigurationStore.Instance.Store(settings); | ||
return Redirect(Url.GetNextWizardStep()); | ||
} | ||
|
||
// GET: Installation/Home | ||
public ActionResult Index() | ||
{ | ||
try | ||
{ | ||
ConnectionFactory.Create(); | ||
} | ||
catch | ||
{ | ||
ViewBag.Ready = false; | ||
} | ||
return View(); | ||
} | ||
|
||
protected override void OnActionExecuting(ActionExecutingContext filterContext) | ||
{ | ||
ViewBag.PrevLink = Url.GetPreviousWizardStepLink(); | ||
ViewBag.NextLink = Url.GetNextWizardStepLink(); | ||
base.OnActionExecuting(filterContext); | ||
} | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using System.Web.Mvc; | ||
using OneTrueError.App.Configuration; | ||
using OneTrueError.Infrastructure; | ||
using OneTrueError.Infrastructure.Configuration; | ||
using OneTrueError.Web.Areas.Installation.Models; | ||
|
||
namespace OneTrueError.Web.Areas.Installation.Controllers | ||
{ | ||
public class SetupController : Controller | ||
{ | ||
[HttpPost, AllowAnonymous] | ||
public ActionResult Activate() | ||
{ | ||
ConfigurationManager.RefreshSection("appSettings"); | ||
if (ConfigurationManager.AppSettings["Configured"] != "true") | ||
{ | ||
return RedirectToAction("Completed", new | ||
{ | ||
displayError = 1 | ||
}); | ||
} | ||
return Redirect("~/?#/welcome"); | ||
} | ||
|
||
public ActionResult Support() | ||
{ | ||
return View(new SupportViewModel()); | ||
} | ||
|
||
[HttpPost] | ||
public async Task<ActionResult> Support(SupportViewModel model) | ||
{ | ||
if (!ModelState.IsValid) | ||
return View(model); | ||
|
||
try | ||
{ | ||
var client = new HttpClient(); | ||
var content = | ||
new FormUrlEncodedContent(new [] | ||
{ | ||
new KeyValuePair<string, string>("EmailAddress", model.Email), | ||
new KeyValuePair<string, string>("CompanyName", model.CompanyName) | ||
}); | ||
await client.PostAsync("https://onetrueerror.com/support/register/", content); | ||
return Redirect(Url.GetNextWizardStep()); | ||
} | ||
catch (Exception ex) | ||
{ | ||
ModelState.AddModelError("", ex.Message); | ||
return View(model); | ||
} | ||
} | ||
|
||
public ActionResult Basics() | ||
{ | ||
var model = new BasicsViewModel(); | ||
var config = ConfigurationStore.Instance.Load<BaseConfiguration>(); | ||
if (config != null) | ||
{ | ||
model.BaseUrl = config.BaseUrl.ToString(); | ||
model.SupportEmail = config.SupportEmail; | ||
} | ||
else | ||
{ | ||
model.BaseUrl = Request.Url.ToString().Replace("installation/setup/basics/", "").Replace("localhost", "yourServerName"); | ||
ViewBag.NextLink = ""; | ||
} | ||
|
||
|
||
return View(model); | ||
} | ||
|
||
[HttpPost] | ||
public ActionResult Basics(BasicsViewModel model) | ||
{ | ||
var settings = new BaseConfiguration(); | ||
if (!model.BaseUrl.EndsWith("/")) | ||
model.BaseUrl += "/"; | ||
|
||
if (model.BaseUrl.IndexOf("localhost", StringComparison.OrdinalIgnoreCase) != -1) | ||
{ | ||
ModelState.AddModelError("BaseUrl", "Use the servers real DNS name instead of 'localhost'. If you don't the Ajax request wont work as CORS would be enforced by IIS."); | ||
return View(model); | ||
} | ||
settings.BaseUrl = new Uri(model.BaseUrl); | ||
settings.SupportEmail = model.SupportEmail; | ||
ConfigurationStore.Instance.Store(settings); | ||
return Redirect(Url.GetNextWizardStep()); | ||
} | ||
|
||
|
||
public ActionResult Completed(string displayError = null) | ||
{ | ||
ViewBag.DisplayError = displayError == "1"; | ||
return View(); | ||
} | ||
|
||
public ActionResult Errors() | ||
{ | ||
var model = new ErrorTrackingViewModel(); | ||
var config = ConfigurationStore.Instance.Load<OneTrueErrorConfigSection>(); | ||
if (config != null) | ||
{ | ||
model.ActivateTracking = config.ActivateTracking; | ||
model.ContactEmail = config.ContactEmail; | ||
model.InstallationId = config.InstallationId; | ||
} | ||
else | ||
ViewBag.NextLink = ""; | ||
|
||
return View("ErrorTracking", model); | ||
} | ||
|
||
[HttpPost] | ||
public ActionResult Errors(ErrorTrackingViewModel model) | ||
{ | ||
if (!ModelState.IsValid) | ||
return View("ErrorTracking", model); | ||
|
||
var settings = new OneTrueErrorConfigSection(); | ||
settings.ActivateTracking = model.ActivateTracking; | ||
settings.ContactEmail = model.ContactEmail; | ||
settings.InstallationId = model.InstallationId; | ||
ConfigurationStore.Instance.Store(settings); | ||
return Redirect(Url.GetNextWizardStep()); | ||
} | ||
|
||
// GET: Installation/Home | ||
public ActionResult Index() | ||
{ | ||
try | ||
{ | ||
ConnectionFactory.Create(); | ||
} | ||
catch | ||
{ | ||
ViewBag.Ready = false; | ||
} | ||
return View(); | ||
} | ||
|
||
protected override void OnActionExecuting(ActionExecutingContext filterContext) | ||
{ | ||
ViewBag.PrevLink = Url.GetPreviousWizardStepLink(); | ||
ViewBag.NextLink = Url.GetNextWizardStepLink(); | ||
base.OnActionExecuting(filterContext); | ||
} | ||
} | ||
} |
48 changes: 24 additions & 24 deletions
48
src/Server/OneTrueError.Web/Areas/Installation/Views/Setup/Completed.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
@{ | ||
ViewBag.Title = "Installation - Completed"; | ||
} | ||
<div class="container"> | ||
<div class="col-lg-6"> | ||
|
||
<h2>Congratulations!</h2> | ||
|
||
<p>The setup is now completed. You need to deactive this configuration part of OneTrueError for security reasons..</p> | ||
<p> | ||
Change the <code>Configured</code> appKey to <code>"true"</code> in your web.config. Then click "Complete" to start OneTrueError | ||
</p> | ||
@if (ViewBag.DisplayError) | ||
{ | ||
<h3>Error!</h3> | ||
<div style="color: #990000; font-weight: bolder"> | ||
Change the key in your web.config to this: <code><add key="Configured" value="true" /></code>. OneTrueError won't start otherwise. | ||
</div> | ||
} | ||
<form action="@Url.Action("Activate")" method="post"> | ||
<button>Complete</button> | ||
</form> | ||
@Html.Raw(ViewBag.PrevStep) | ||
</div> | ||
@{ | ||
ViewBag.Title = "Installation - Completed"; | ||
} | ||
<div class="container"> | ||
<div class="col-lg-6"> | ||
|
||
<h2>Congratulations!</h2> | ||
|
||
<p>The setup is now completed. You need to deactive this configuration part of OneTrueError for security reasons..</p> | ||
<p> | ||
Change the <code>Configured</code> appKey to <code>"true"</code> in your web.config. Then click "Complete" to start OneTrueError | ||
</p> | ||
@if (ViewBag.DisplayError) | ||
{ | ||
<h3>Error!</h3> | ||
<div style="color: #990000; font-weight: bolder"> | ||
Change the key in your web.config to this: <code><add key="Configured" value="true" /></code>. OneTrueError won't start otherwise. | ||
</div> | ||
} | ||
<form action="@Url.Action("Activate")" method="post"> | ||
<button>Complete</button> | ||
</form> | ||
@Html.Raw(ViewBag.PrevStep) | ||
</div> | ||
</div> |
Oops, something went wrong.