Browse Source

Root url.

pull/350/head
Sebastian Stehle 7 years ago
parent
commit
05b2e1ed08
  1. 7
      src/Squidex/Areas/IdentityServer/Controllers/Account/AccountController.cs
  2. 1
      src/Squidex/Areas/IdentityServer/Startup.cs
  3. 2
      src/Squidex/Areas/IdentityServer/Views/Account/AccessDenied.cshtml
  4. 4
      src/Squidex/Areas/IdentityServer/Views/Account/LockedOut.cshtml
  5. 2
      src/Squidex/Areas/IdentityServer/Views/Account/LogoutCompleted.cshtml
  6. 2
      src/Squidex/Areas/IdentityServer/Views/Error/Error.cshtml
  7. 44
      src/Squidex/Areas/IdentityServer/Views/Extensions.cs
  8. 2
      src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml
  9. 4
      src/Squidex/Areas/IdentityServer/Views/_Layout.cshtml
  10. 1
      src/Squidex/Areas/IdentityServer/Views/_ViewImports.cshtml

7
src/Squidex/Areas/IdentityServer/Controllers/Account/AccountController.cs

@ -57,6 +57,13 @@ namespace Squidex.Areas.IdentityServer.Controllers.Account
this.signInManager = signInManager;
}
[HttpGet]
[Route("account/error/")]
public IActionResult LoginError()
{
throw new InvalidOperationException();
}
[HttpGet]
[Route("account/forbidden/")]
public IActionResult Forbidden()

1
src/Squidex/Areas/IdentityServer/Startup.cs

@ -34,7 +34,6 @@ namespace Squidex.Areas.IdentityServer
identityApp.UseMyIdentityServer();
identityApp.UseStaticFiles();
identityApp.UseMvc();
});
}

2
src/Squidex/Areas/IdentityServer/Views/Account/AccessDenied.cshtml

@ -3,7 +3,7 @@
ViewBag.Title = "Account locked";
}
<img class="splash-image" src="~/../squid.svg?title=STOP%20HERE&text=You%20shall%20not%20pass!" />
<img class="splash-image" src="@Url.RootContentUrl("~/squid.svg?title=STOP%20HERE&text=You%20shall%20not%20pass!")" />
<h1 class="splash-h1">Access denied</h1>

4
src/Squidex/Areas/IdentityServer/Views/Account/LockedOut.cshtml

@ -2,7 +2,7 @@
ViewBag.Title = "Account locked";
}
<img class="splash-image" src="~/../squid.svg?title=STOP HERE&text=You%20shall%20not%20pass!" />
<img class="splash-image" src="@Url.RootContentUrl("~/squid.svg?title=STOP HERE&text=You%20shall%20not%20pass!")" />
<h1 class="splash-h1">Account locked</h1>
@ -11,5 +11,5 @@
</p>
<p class="splash-text">
<a href="~/account/logout-redirect">Logout</a>
<a asp-controller="Account" asp-action="LogoutRedirect">Logout</a>
</p>

2
src/Squidex/Areas/IdentityServer/Views/Account/LogoutCompleted.cshtml

@ -2,7 +2,7 @@
ViewBag.Title = "Logout";
}
<img class="splash-image" src="~/../squid.svg?title=BYE%20BYE&text=Hope%20to%20see%20you%20again%20soon!&face=happy" />
<img class="splash-image" src="@Url.Content("~/squid.svg?title=BYE%20BYE&text=Hope%20to%20see%20you%20again%20soon!&face=happy")" />
<h1 class="splash-h1">Logged out!</h1>

2
src/Squidex/Areas/IdentityServer/Views/Error/Error.cshtml

@ -4,7 +4,7 @@
ViewBag.Title = "Error";
}
<img class="splash-image" src="~/../squid.svg?title=OH%20DAMN&text=I%20am%20sorry%2C%20that%20something%20went%20wrong" />
<img class="splash-image" src="@Url.RootContentUrl("~/squid.svg?title=OH%20DAMN&text=I%20am%20sorry%2C%20that%20something%20went%20wrong")" />
<h1 class="splash-h1">Operation failed</h1>

44
src/Squidex/Areas/IdentityServer/Views/Extensions.cs

@ -0,0 +1,44 @@
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Squidex.Areas.IdentityServer.Views
{
public static class Extensions
{
public static string RootContentUrl(this IUrlHelper urlHelper, string contentPath)
{
if (string.IsNullOrEmpty(contentPath))
{
return null;
}
if (contentPath[0] == '~')
{
var segment = new PathString(contentPath.Substring(1));
var applicationPath = urlHelper.ActionContext.HttpContext.Request.PathBase;
if (applicationPath.HasValue)
{
var indexOfLastPart = applicationPath.Value.LastIndexOf('/');
if (indexOfLastPart >= 0)
{
applicationPath = applicationPath.Value.Substring(0, indexOfLastPart);
}
}
return applicationPath.Add(segment).Value;
}
return contentPath;
}
}
}

2
src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml

@ -26,7 +26,7 @@
<div class="row profile-section">
<div class="col profile-picture-col">
<img class="profile-picture" src="@Url.Content($"~/../api/users/{Model.Id}/picture/")" />
<img class="profile-picture" src="@Url.RootContentUrl($"~/api/users/{Model.Id}/picture/")" />
</div>
<div class="col">
<form id="pictureForm" class="profile-picture-form" asp-controller="Profile" asp-action="UploadPicture" method="post" enctype="multipart/form-data">

4
src/Squidex/Areas/IdentityServer/Views/_Layout.cshtml

@ -9,7 +9,7 @@
<title>@ViewBag.Title - Squidex Headless CMS</title>
<environment names="Production">
<link rel="stylesheet" asp-append-version="true" href="~/build/app.css" />
<link rel="stylesheet" asp-append-version="true" href="@Url.RootContentUrl("~/build/app.css")" />
</environment>
@if (IsSectionDefined("header"))
@ -19,7 +19,7 @@
</head>
<body class="white">
<div class="profile @ViewBag.Class">
<img class="profile-logo" src="~/images/logo-small.png" />
<img class="profile-logo" src="@Url.RootContentUrl("~/images/logo-small.png")" />
@RenderBody()
</div>

1
src/Squidex/Areas/IdentityServer/Views/_ViewImports.cshtml

@ -1,3 +1,4 @@
@using Microsoft.AspNetCore.Identity
@using Squidex.Areas.IdentityServer.Views;
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

Loading…
Cancel
Save