diff --git a/.gitignore b/.gitignore index ed14722dc1..8abf9da7dd 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,7 @@ preserve.belle /src/Umbraco.Cms.StaticAssets/wwwroot/umbraco/js /src/Umbraco.Cms.StaticAssets/wwwroot/umbraco/lib /src/Umbraco.Cms.StaticAssets/wwwroot/umbraco/views +/src/Umbraco.Cms.StaticAssets/wwwroot/umbraco/login # Environment specific data /src/Umbraco.Web.UI.Client/[Bb]uild/ diff --git a/src/Umbraco.Cms.Api.Management/Controllers/BackOfficeLoginController.cs b/src/Umbraco.Cms.Api.Management/Controllers/BackOfficeLoginController.cs index 7738ce32c0..2cbe67e0c8 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/BackOfficeLoginController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/BackOfficeLoginController.cs @@ -1,5 +1,7 @@ using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Options; +using Umbraco.Cms.Core.Configuration.Models; +using Umbraco.Cms.Core.Hosting; namespace Umbraco.Cms.Api.Management; @@ -7,27 +9,45 @@ namespace Umbraco.Cms.Api.Management; public class BackOfficeLoginModel { + /// + /// Gets or sets the value of the "ReturnUrl" query parameter or defaults to the configured Umbraco directory. + /// [FromQuery(Name = "ReturnUrl")] public string? ReturnUrl { get; set; } - public string AuthUrl { get; set; } = string.Empty; + /// + /// The configured Umbraco directory. + /// + public string? UmbracoUrl { get; set; } } [ApiExplorerSettings(IgnoreApi=true)] [Route("/umbraco/login")] public class BackOfficeLoginController : Controller { - private readonly LinkGenerator _linkGenerator; + private readonly IHostingEnvironment _hostingEnvironment; + private readonly GlobalSettings _globalSettings; - public BackOfficeLoginController(LinkGenerator linkGenerator) + public BackOfficeLoginController( + IOptionsSnapshot globalSettings, + IHostingEnvironment hostingEnvironment) { - _linkGenerator = linkGenerator; + _hostingEnvironment = hostingEnvironment; + _globalSettings = globalSettings.Value ?? throw new ArgumentNullException(nameof(globalSettings)); } // GET public IActionResult Index(BackOfficeLoginModel model) { - model.AuthUrl = "/umbraco/management/api/v1.0/security/back-office"; + if (string.IsNullOrEmpty(model.UmbracoUrl)) + { + model.UmbracoUrl = _hostingEnvironment.ToAbsolute(_globalSettings.UmbracoPath); + } + + if (string.IsNullOrEmpty(model.ReturnUrl)) + { + model.ReturnUrl = model.UmbracoUrl; + } return View("/umbraco/UmbracoLogin/Index.cshtml", model); } diff --git a/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj b/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj index b65b578560..9fc982cb53 100644 --- a/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj +++ b/src/Umbraco.Cms.StaticAssets/Umbraco.Cms.StaticAssets.csproj @@ -20,6 +20,7 @@ $(ProjectDir)wwwroot\umbraco $(BasePath)\lib $(BasePath)\backoffice + $(BasePath)\login @@ -32,6 +33,11 @@ + + + + + @@ -44,6 +50,10 @@ + + + + @@ -55,6 +65,11 @@ + + + + + @@ -71,4 +86,11 @@ + + + + + + + diff --git a/src/Umbraco.Cms.StaticAssets/umbraco/UmbracoLogin/Index.cshtml b/src/Umbraco.Cms.StaticAssets/umbraco/UmbracoLogin/Index.cshtml index 535b8de1e6..649b771251 100644 --- a/src/Umbraco.Cms.StaticAssets/umbraco/UmbracoLogin/Index.cshtml +++ b/src/Umbraco.Cms.StaticAssets/umbraco/UmbracoLogin/Index.cshtml @@ -1,85 +1,19 @@ @model Umbraco.Cms.Api.Management.BackOfficeLoginModel +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers + - - Umbraco + + + + + Umbraco + + + + - - - - - - - Umbraco login universe - We have not yet implemented the new login page, so for your pleasure,we present you a blocky experience that just works™ - - - Username: - - - Password: - - LOGIN - - - - - + + +
We have not yet implemented the new login page, so for your pleasure,we present you a blocky experience that just works™