Merge pull request #445 from sbwalker/master

Resolved authentication issue #441 related to alias refactoring #439, fixed breaking change in .NET Core 3.2 related to Blazor WebAssembly identification
This commit is contained in:
Shaun Walker 2020-05-05 16:27:52 -04:00 committed by GitHub
commit 6586883979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 34 additions and 34 deletions

View File

@ -99,7 +99,7 @@
var interop = new Interop(JsRuntime);
string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
var fields = new { __RequestVerificationToken = antiforgerytoken, username = _username, password = _password, remember = _remember, returnurl = _returnUrl };
await interop.SubmitForm("/pages/login/", fields);
await interop.SubmitForm($"/{PageState.Alias.AliasId}/pages/login/", fields);
}
else
{

View File

@ -171,7 +171,7 @@
<table class="table table-borderless">
<tr>
<td>
<Label For="isEnabled" HelpText="Select whether you would like this site to be avaiable as a proggressive web application">Is Enabled? </Label>
<Label For="isEnabled" HelpText="Select whether you would like this site to be available as a Progressive Web Application (PWA)">Is Enabled? </Label>
</td>
<td>
<select id="isEnabled" class="form-control" @bind="@_pwaisenabled">
@ -182,7 +182,7 @@
</tr>
<tr>
<td>
<Label For="appIcon" HelpText="Include an application icon for your PWA">App Icon: </Label>
<Label For="appIcon" HelpText="Include an application icon for your PWA. It should be a PNG which is 192 X 192 pixels in dimension.">App Icon: </Label>
</td>
<td>
<FileManager FileId="@_pwaappiconfileid.ToString()" Filter="png" @ref="_pwaappiconfilemanager" />
@ -190,7 +190,7 @@
</tr>
<tr>
<td>
<Label For="splashIcon" HelpText="Include a splash icon">Splash Icon: </Label>
<Label For="splashIcon" HelpText="Include a splash icon for your PWA. It should be a PNG which is 512 X 512 pixels in dimension.">Splash Icon: </Label>
</td>
<td>
<FileManager FileId="@_pwasplashiconfileid.ToString()" Filter="png" @ref="_pwasplashiconfilemanager" />

View File

@ -35,7 +35,7 @@ namespace Oqtane.Themes.Controls
var interop = new Interop(jsRuntime);
string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
var fields = new { __RequestVerificationToken = antiforgerytoken, returnurl = (PageState.Alias.Path + "/" + PageState.Page.Path) };
await interop.SubmitForm("/pages/logout/", fields);
await interop.SubmitForm($"/{PageState.Alias.AliasId}/pages/logout/", fields);
}
else
{

View File

@ -471,7 +471,7 @@
}
private Runtime GetRuntime()
=> RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY"))
=> RuntimeInformation.IsOSPlatform(OSPlatform.Create("BROWSER"))
? Runtime.WebAssembly
: Runtime.Server;
}

View File

@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Http;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class AliasController : Controller
{
private readonly IAliasRepository _aliases;

View File

@ -21,7 +21,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class FileController : Controller
{
private readonly IWebHostEnvironment _environment;

View File

@ -14,7 +14,7 @@ using System.IO;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class FolderController : Controller
{
private readonly IFolderRepository _folders;

View File

@ -7,7 +7,7 @@ using Oqtane.Infrastructure;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class InstallationController : Controller
{
private readonly IConfigurationRoot _config;

View File

@ -12,7 +12,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class JobController : Controller
{
private readonly IJobRepository _jobs;

View File

@ -9,7 +9,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class JobLogController : Controller
{
private readonly IJobLogRepository _jobLogs;

View File

@ -9,7 +9,7 @@ using Oqtane.Shared;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class LogController : Controller
{
private readonly ILogManager _logger;

View File

@ -11,7 +11,7 @@ using Oqtane.Security;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class ModuleController : Controller
{
private readonly IModuleRepository _modules;

View File

@ -17,7 +17,7 @@ using Microsoft.Extensions.DependencyInjection;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class ModuleDefinitionController : Controller
{
private readonly IModuleDefinitionRepository _moduleDefinitions;

View File

@ -10,7 +10,7 @@ using Oqtane.Security;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class NotificationController : Controller
{
private readonly INotificationRepository _notifications;

View File

@ -15,7 +15,7 @@ using Oqtane.Shared;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class PackageController : Controller
{
private readonly IWebHostEnvironment _environment;

View File

@ -13,7 +13,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class PageController : Controller
{
private readonly IPageRepository _pages;

View File

@ -11,7 +11,7 @@ using Oqtane.Security;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class PageModuleController : Controller
{
private readonly IPageModuleRepository _pageModules;

View File

@ -9,7 +9,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class ProfileController : Controller
{
private readonly IProfileRepository _profiles;

View File

@ -9,7 +9,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class RoleController : Controller
{
private readonly IRoleRepository _roles;

View File

@ -10,7 +10,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class SettingController : Controller
{
private readonly ISettingRepository _settings;

View File

@ -10,7 +10,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class SiteController : Controller
{
private readonly ISiteRepository _sites;

View File

@ -5,7 +5,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class SiteTemplateController : Controller
{
private readonly ISiteTemplateRepository _siteTemplates;

View File

@ -14,7 +14,7 @@ using System;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class SqlController : Controller
{
private readonly ITenantRepository _tenants;

View File

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Hosting;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class SystemController : Controller
{
private readonly IWebHostEnvironment _environment;

View File

@ -9,7 +9,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class TenantController : Controller
{
private readonly ITenantRepository _tenants;

View File

@ -15,7 +15,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class ThemeController : Controller
{
private readonly IThemeRepository _themes;

View File

@ -16,7 +16,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class UserController : Controller
{
private readonly IUserRepository _users;

View File

@ -9,7 +9,7 @@ using Oqtane.Repository;
namespace Oqtane.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class UserRoleController : Controller
{
private readonly IUserRoleRepository _userRoles;

View File

@ -11,7 +11,7 @@ using Oqtane.Infrastructure;
namespace Oqtane.Modules.HtmlText.Controllers
{
[Route("{site}/api/[controller]")]
[Route("{alias}/api/[controller]")]
public class HtmlTextController : Controller
{
private readonly IHtmlTextRepository _htmlText;

View File

@ -1,3 +1,3 @@
@page "/pages/login"
@page "/{alias}/pages/login"
@namespace Oqtane.Pages
@model Oqtane.Pages.LoginModel

View File

@ -1,3 +1,3 @@
@page "/pages/logout"
@page "/{alias}/pages/logout"
@namespace Oqtane.Pages
@model Oqtane.Pages.LogoutModel

View File

@ -27,7 +27,7 @@ namespace Oqtane.Repository
if (accessor.HttpContext != null)
{
string[] segments = accessor.HttpContext.Request.Path.Value.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
if (segments.Length > 1 && segments[1] == "api" && segments[0] != "~")
if (segments.Length > 1 && (segments[1] == "api" || segments[1] == "pages") && segments[0] != "~")
{
aliasId = int.Parse(segments[0]);
}