Merge branch 'v9/dev' into v9/contrib

# Conflicts:
#	src/Umbraco.Web.UI.Client/src/less/pages/login.less
This commit is contained in:
Sebastiaan Janssen
2022-02-21 09:54:36 +01:00
136 changed files with 3763 additions and 1144 deletions

View File

@@ -0,0 +1,61 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
namespace Umbraco.Cms.Web.UI.Composers
{
/// <summary>
/// Adds controllers to the service collection.
/// </summary>
/// <remarks>
/// <para>
/// Umbraco 9 out of the box, makes use of <see cref="DefaultControllerActivator"/> which doesn't resolve controller
/// instances from the IOC container, instead it resolves the required dependencies of the controller and constructs an instance
/// of the controller.
/// </para>
/// <para>
/// Some users may wish to switch to <see cref="ServiceBasedControllerActivator"/> (perhaps to make use of interception/decoration).
/// </para>
/// <para>
/// This composer exists to help us detect ambiguous constructors in the CMS such that we do not cause unnecessary effort downstream.
/// </para>
/// <para>
/// This Composer is not shipped by the Umbraco.Templates package.
/// </para>
/// </remarks>
public class ControllersAsServicesComposer : IComposer
{
/// <inheritdoc />
public void Compose(IUmbracoBuilder builder) => builder.Services
.AddMvc()
.AddControllersAsServicesWithoutChangingActivator();
}
internal static class MvcBuilderExtensions
{
/// <summary>
/// <see cref="MvcCoreMvcBuilderExtensions.AddControllersAsServices"/> but without the replacement of
/// <see cref="DefaultControllerActivator"/>.
/// </summary>
/// <remarks>
/// We don't need to opt in to <see cref="ServiceBasedControllerActivator"/> to ensure container validation
/// passes.
/// </remarks>
public static IMvcBuilder AddControllersAsServicesWithoutChangingActivator(this IMvcBuilder builder)
{
var feature = new ControllerFeature();
builder.PartManager.PopulateFeature(feature);
foreach (Type controller in feature.Controllers.Select(c => c.AsType()))
{
builder.Services.TryAddTransient(controller, controller);
}
return builder;
}
}
}

View File

@@ -18,6 +18,13 @@
<ProjectReference Include="../Umbraco.Persistence.SqlCe/Umbraco.Persistence.SqlCe.csproj" Condition="'$(OS)' == 'Windows_NT'" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
<RuntimeHostConfigurationOption Condition="$(RuntimeIdentifier.StartsWith('linux')) Or $(RuntimeIdentifier.StartsWith('win')) Or ('$(RuntimeIdentifier)' == '' And !$([MSBuild]::IsOSPlatform('osx')))" Include="System.Globalization.AppLocalIcu" Value="68.2.0.9" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Plugins" />
<Folder Include="Views" />
@@ -29,6 +36,7 @@
<Compile Remove="umbraco/mediacache/**" />
<Compile Remove="wwwroot/umbraco/**" />
<Compile Remove="App_Data/**" />
<Compile Remove="Controllers\**" />
</ItemGroup>
<ItemGroup>
@@ -36,6 +44,7 @@
<EmbeddedResource Remove="umbraco/Data/**" />
<EmbeddedResource Remove="umbraco/logs/**" />
<EmbeddedResource Remove="umbraco/mediacache/**" />
<EmbeddedResource Remove="Controllers\**" />
</ItemGroup>
<ItemGroup>
@@ -45,6 +54,7 @@
<Content Remove="umbraco/mediacache/**" />
<Content Remove="umbraco\UmbracoWebsite\NotFound.cshtml" />
<Content Remove="wwwroot/Web.config" />
<Content Remove="Controllers\**" />
</ItemGroup>
@@ -62,6 +72,7 @@
<None Remove="umbraco/logs/**" />
<None Remove="umbraco/mediacache/**" />
<None Include="umbraco/UmbracoWebsite/NoNodes.cshtml" />
<None Remove="Controllers\**" />
</ItemGroup>
<!-- We don't want to include the generated files, they will throw a lot of errors -->
@@ -92,7 +103,7 @@
<Message Text="JsonSchemaPath: $(JsonSchemaPath)" Importance="high" />
<Message Text="BellePath: $(BellePath)" Importance="high" />
<!-- Build Belle, if building is Visual Studio and the build folder does not exist yet -->
<!-- Build Belle, if building is Visual Studio and the build folder does not exist yet -->
<Message Text="Skip Belle because UmbracoBuild is '$(UmbracoBuild)' (this is not Visual Studio)." Importance="High" Condition="'$(UmbracoBuild)' != ''" />
<Message Text="Skip Belle because $(BellePath) exists." Importance="High" Condition="Exists('$(BellePath)')" />
<Message Text="Build Belle because UmbracoBuild is empty (this is Visual Studio), and $(BellePath) does not exist." Importance="High" Condition="!Exists('$(BellePath)') and '$(UmbracoBuild)' == ''" />

View File

@@ -1,7 +1,4 @@
@inherits Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage
@using Umbraco.Cms.Core
@using Umbraco.Cms.Core.Security
@using Umbraco.Cms.Core.Services
@using Umbraco.Cms.Web.Common.Security
@using Umbraco.Cms.Web.Website.Controllers
@@ -11,6 +8,7 @@
@inject IMemberExternalLoginProviders memberExternalLoginProviders
@inject IExternalLoginWithKeyService externalLoginWithKeyService
@{
// Build a profile model to edit
var profileModel = await memberModelBuilderFactory
.CreateProfileModel()

View File

@@ -1,9 +1,12 @@
@inherits Umbraco.Cms.Web.Common.Macros.PartialViewMacroPage
@using Umbraco.Cms.Web.Common.Models
@using Umbraco.Cms.Web.Common.Security
@using Umbraco.Cms.Web.Website.Controllers
@using Umbraco.Cms.Core.Services
@using Umbraco.Extensions
@inject IMemberExternalLoginProviders memberExternalLoginProviders
@inject ITwoFactorLoginService twoFactorLoginService
@{
var loginModel = new LoginModel();
// You can modify this to redirect to a different URL instead of the current one
@@ -14,6 +17,33 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validation-unobtrusive/3.2.11/jquery.validate.unobtrusive.min.js"></script>
@if (ViewData.TryGetTwoFactorProviderNames(out var providerNames))
{
foreach (var providerName in providerNames)
{
<div class="2fa-form">
<h4>Two factor with @providerName.</h4>
<div asp-validation-summary="All" class="text-danger"></div>
@using (Html.BeginUmbracoForm<UmbTwoFactorLoginController>(nameof(UmbTwoFactorLoginController.Verify2FACode)))
{
<text>
<input type="hidden" name="provider" value="@providerName"/>
Input security code: <input name="code" value=""/><br/>
<button type="submit" class="btn btn-primary">Validate</button>
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
</text>
}
</div>
}
}
else
{
<div class="login-form">
@using (Html.BeginUmbracoForm<UmbLoginController>(
@@ -74,3 +104,4 @@
}
}
</div>
}

View File

@@ -1292,6 +1292,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
<key alias="packageNoResultsDescription">Please try searching for another package or browse through the categories
</key>
<key alias="packagesPopular">Popular</key>
<key alias="packagesPromoted">Promoted</key>
<key alias="packagesNew">New releases</key>
<key alias="packageHas">has</key>
<key alias="packageKarmaPoints">karma points</key>

View File

@@ -1310,6 +1310,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont
<key alias="packageNoResultsDescription">Please try searching for another package or browse through the categories
</key>
<key alias="packagesPopular">Popular</key>
<key alias="packagesPromoted">Promoted</key>
<key alias="packagesNew">New releases</key>
<key alias="packageHas">has</key>
<key alias="packageKarmaPoints">karma points</key>