Skip to content

Commit

Permalink
Merge pull request #43 from HoodDigital/dev
Browse files Browse the repository at this point in the history
v6.0.11
  • Loading branch information
JorjeRedemption authored Jul 27, 2022
2 parents 2ba74be + c935d2c commit af599d0
Show file tree
Hide file tree
Showing 29 changed files with 97 additions and 664 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build-dev",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/projects/Hood.Development/bin/Debug/net5.0/Hood.Development.dll",
"program": "${workspaceFolder}/projects/Hood.Development/bin/Debug/net6.0/Hood.Development.dll",
"args": [],
"cwd": "${workspaceFolder}/projects/Hood.Development/",
"stopAtEntry": false,
Expand All @@ -37,7 +37,7 @@
"request": "launch",
"preLaunchTask": "build-dev",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/projects/Hood.Development/bin/Debug/net5.0/Hood.Development.dll",
"program": "${workspaceFolder}/projects/Hood.Development/bin/Debug/net6.0/Hood.Development.dll",
"args": [],
"cwd": "${workspaceFolder}/projects/Hood.Development/",
"stopAtEntry": false,
Expand Down
41 changes: 1 addition & 40 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/projects/Hood.Development/Hood.Development.csproj",
"${workspaceFolder}/Hood.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand Down Expand Up @@ -37,45 +37,6 @@
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},

{
"label": "build-web",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/projects/Hood.Web/Hood.Web.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish-web",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/projects/Hood.Web/Hood.Web.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch-web",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/projects/Hood.Web/Hood.Web.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}

]
}
21 changes: 0 additions & 21 deletions Hood.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hood", "projects\Hood\Hood.
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Framework", "Framework", "{A89DE859-75A0-418B-BE31-3228BD827619}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Apps", "Apps", "{4BDDD020-CFDD-4A9E-BEA0-D3D7D54B2AC4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hood.UI.Bootstrap3", "projects\Hood.UI.Bootstrap3\Hood.UI.Bootstrap3.csproj", "{5BFC6D26-6016-42F5-A8CE-5EB8A0AE14EF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UI", "UI", "{5CF84357-EA5D-42CF-8CBC-05940FF0F73C}"
Expand All @@ -42,8 +40,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hood.UI", "projects\Hood.UI
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hood.Admin", "projects\Hood.Admin\Hood.Admin.csproj", "{123F61E6-834C-42FF-B62E-12CE30BC8A90}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hood.Web", "projects\Hood.Web\Hood.Web.csproj", "{3311B56E-29DF-416F-9265-8F9303DE2D1C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -184,22 +180,6 @@ Global
{123F61E6-834C-42FF-B62E-12CE30BC8A90}.Release|x64.Build.0 = Release|Any CPU
{123F61E6-834C-42FF-B62E-12CE30BC8A90}.Release|x86.ActiveCfg = Release|Any CPU
{123F61E6-834C-42FF-B62E-12CE30BC8A90}.Release|x86.Build.0 = Release|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Debug|ARM.ActiveCfg = Debug|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Debug|ARM.Build.0 = Debug|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Debug|x64.ActiveCfg = Debug|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Debug|x64.Build.0 = Debug|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Debug|x86.ActiveCfg = Debug|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Debug|x86.Build.0 = Debug|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Release|Any CPU.Build.0 = Release|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Release|ARM.ActiveCfg = Release|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Release|ARM.Build.0 = Release|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Release|x64.ActiveCfg = Release|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Release|x64.Build.0 = Release|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Release|x86.ActiveCfg = Release|Any CPU
{3311B56E-29DF-416F-9265-8F9303DE2D1C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -213,7 +193,6 @@ Global
{7ADB2A9E-146D-40C4-826A-C79C712CE905} = {306ED7A4-6F3F-4BE1-96CE-CA9DAE98CC53}
{1CBD6EFB-B4D4-4EF3-B327-4AEB1AB4A2A6} = {5CF84357-EA5D-42CF-8CBC-05940FF0F73C}
{123F61E6-834C-42FF-B62E-12CE30BC8A90} = {A89DE859-75A0-418B-BE31-3228BD827619}
{3311B56E-29DF-416F-9265-8F9303DE2D1C} = {4BDDD020-CFDD-4A9E-BEA0-D3D7D54B2AC4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E5B47CFC-A139-40DC-9B6A-7CB4C3ED7C71}
Expand Down
4 changes: 2 additions & 2 deletions projects/Hood.Admin/Hood.Admin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<AssemblyName>Hood.Admin</AssemblyName>
<PackageId>Hood.Admin</PackageId>

<Version>6.0.10</Version>
<TargetFramework>net5.0</TargetFramework>
<Version>6.0.11</Version>
<TargetFramework>net6.0</TargetFramework>
<Authors>Hood Digital;George Whysall;</Authors>
<OutputType>Library</OutputType>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
Expand Down
23 changes: 0 additions & 23 deletions projects/Hood.Core.Admin/Controllers/SettingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ namespace Hood.Areas.Admin.Controllers
{
public abstract class BaseSettingsController : BaseController
{
protected IMediaRefreshService _mediaRefresh;
public BaseSettingsController()
: base()
{
_mediaRefresh = Engine.Services.Resolve<IMediaRefreshService>();
}

[Route("admin/settings/basics/")]
Expand Down Expand Up @@ -327,8 +325,6 @@ public virtual IActionResult Media()
if (model == null)
model = new MediaSettings();

model.UpdateReport = _mediaRefresh.Report();

return View(model);
}
[HttpPost]
Expand All @@ -347,8 +343,6 @@ public virtual IActionResult Media(MediaSettings model)
MessageType = AlertType.Danger;
}

model.UpdateReport = _mediaRefresh.Report();

return View(model);
}

Expand All @@ -359,24 +353,7 @@ public virtual IActionResult ResetMedia()
Engine.Settings.Set(model);
return RedirectWithResetMessage("Media");
}
[Route("admin/settings/media/refresh/")]
public virtual IActionResult RefreshMedia()
{
_mediaRefresh.Kill();
_mediaRefresh.RunUpdate(HttpContext);

SaveMessage = "Media refreshing...";
MessageType = AlertType.Success;

return RedirectToAction("Media");
}
[HttpPost]
[Route("admin/settings/media/refresh/cancel/")]
public virtual IActionResult RefreshMediaKillAsync()
{
_mediaRefresh.Kill();
return Json(new { success = true });
}

[Route("admin/settings/mail/")]
public virtual IActionResult Mail()
Expand Down
4 changes: 2 additions & 2 deletions projects/Hood.Core.Admin/Hood.Core.Admin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<AssemblyName>Hood.Core.Admin</AssemblyName>
<PackageId>Hood.Core.Admin</PackageId>

<Version>6.0.10</Version>
<TargetFramework>net5.0</TargetFramework>
<Version>6.0.11</Version>
<TargetFramework>net6.0</TargetFramework>
<Authors>Hood Digital;George Whysall;</Authors>
<OutputType>Library</OutputType>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
Expand Down
2 changes: 1 addition & 1 deletion projects/Hood.Core/Extensions/Crypto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public PasswordHasher(string base64Salt)
private void GenerateSalt()
{
Salt = new byte[128 / 8];
using (var rngCsp = new RNGCryptoServiceProvider())
using (var rngCsp = RandomNumberGenerator.Create())
{
rngCsp.GetNonZeroBytes(Salt);
}
Expand Down
10 changes: 10 additions & 0 deletions projects/Hood.Core/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,16 @@ private static IEnumerable<char> CharsToTitleCaseArry(string s)
}
}

public static string Truncate(this string value, int length)
{
if (value == null || value.Length <= length)
{
return value;
}

return value.Substring(0, length) + "...";
}

public static string TruncateAtWord(this string value, int length)
{
if (value == null || value.Length < length || value.IndexOf(" ", length) == -1)
Expand Down
35 changes: 18 additions & 17 deletions projects/Hood.Core/Hood.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,40 @@
<AssemblyName>Hood.Core</AssemblyName>
<PackageId>Hood.Core</PackageId>

<Version>6.0.10</Version>
<TargetFramework>net5.0</TargetFramework>
<Version>6.0.11</Version>
<TargetFramework>net6.0</TargetFramework>
<Authors>Hood Digital;George Whysall;</Authors>
<OutputType>Library</OutputType>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>

</PropertyGroup>

<ItemGroup>
<PackageReference Include="Auth0.AspNetCore.Authentication" Version="1.0.0" />
<PackageReference Include="Auth0.AuthenticationApi" Version="7.12.1" />
<PackageReference Include="Auth0.ManagementApi" Version="7.12.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.9.0" />
<PackageReference Include="Auth0.AspNetCore.Authentication" Version="1.0.3" />
<PackageReference Include="Auth0.AuthenticationApi" Version="7.17.0" />
<PackageReference Include="Auth0.ManagementApi" Version="7.17.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.13.0" />
<PackageReference Include="BundlerMinifier.Core" Version="3.2.449" />
<PackageReference Include="Geocoding.Core" Version="4.0.1" />
<PackageReference Include="Geocoding.Google" Version="4.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.7">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="RestSharp" Version="106.15.0" />
<PackageReference Include="Sendgrid" Version="9.23.2" />
<PackageReference Include="Sendgrid" Version="9.28.0" />
<PackageReference Include="SharpZipLib" Version="1.3.3" />
<PackageReference Include="StackExchange.Redis" Version="2.2.4" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
<PackageReference Include="StackExchange.Redis" Version="2.6.48" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
<PackageReference Include="unsplasharp.api" Version="0.7.0" />
</ItemGroup>
Expand Down
12 changes: 8 additions & 4 deletions projects/Hood.Core/Identity/HoodAuth0Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public virtual async Task OnTicketReceived(TicketReceivedContext e)
var repo = Engine.Services.Resolve<IAccountRepository>();
var principal = e.Principal;
var userId = e.Principal.GetUserId();
var returnUrl = e.ReturnUri;
var returnUrl = e.ReturnUri;

var identity = (ClaimsIdentity)principal.Identity;

// Check if user exists and is linked to this Auth0 account
Expand All @@ -101,8 +101,6 @@ public virtual async Task OnTicketReceived(TicketReceivedContext e)
if (user != null)
{
// user exists, but the current Auth0 signin method is not saved, force them into the connect account flow.


if (user.ConnectedAuth0Accounts != null && user.ConnectedAuth0Accounts.Count() > 0)
{
identity.AddClaim(new Claim(Identity.HoodClaimTypes.AccountLinkRequired, "true"));
Expand All @@ -115,6 +113,7 @@ public virtual async Task OnTicketReceived(TicketReceivedContext e)

await SetDefaultClaims(e, user);

identity.AddClaim(new Claim(Identity.HoodClaimTypes.AccountCreationFailed, "true"));
e.Response.Redirect(linkGenerator.GetPathByAction("ConnectAccount", this.AccountControllerName, new { returnUrl = e.ReturnUri }));
e.HandleResponse();
return;
Expand All @@ -124,6 +123,7 @@ public virtual async Task OnTicketReceived(TicketReceivedContext e)
if (!Engine.Settings.Account.AllowRemoteSignups)
{
// user has not been found, or created & signups are disabled on this end
identity.AddClaim(new Claim(Identity.HoodClaimTypes.AccountCreationFailed, "true"));
returnUrl = linkGenerator.GetPathByAction("RemoteSigninFailed", this.AccountControllerName, new { r = "signup-disabled" });
e.Response.Redirect(linkGenerator.GetPathByAction("SignOut", this.AccountControllerName, new { returnUrl }));
e.HandleResponse();
Expand Down Expand Up @@ -158,6 +158,7 @@ public virtual async Task OnTicketReceived(TicketReceivedContext e)
if (!result.Succeeded)
{
// user has not been found, or created (signups disabled on this end) - signout and forward to failure page.
identity.AddClaim(new Claim(Identity.HoodClaimTypes.AccountCreationFailed, "true"));
returnUrl = linkGenerator.GetPathByAction("RemoteSigninFailed", this.AccountControllerName, new { r = "account-creation-failed" });
e.Response.Redirect(linkGenerator.GetPathByAction("SignOut", this.AccountControllerName, new { returnUrl }));
e.HandleResponse();
Expand All @@ -168,6 +169,7 @@ public virtual async Task OnTicketReceived(TicketReceivedContext e)
if (user == null)
{
// user has not been found, or created (signups disabled on this end) - signout and forward to failure page.
identity.AddClaim(new Claim(Identity.HoodClaimTypes.AccountCreationFailed, "true"));
returnUrl = linkGenerator.GetPathByAction("RemoteSigninFailed", this.AccountControllerName, new { r = "account-linking-failed" });
e.Response.Redirect(linkGenerator.GetPathByAction("SignOut", this.AccountControllerName, new { returnUrl }));
e.HandleResponse();
Expand Down Expand Up @@ -202,6 +204,7 @@ public virtual async Task OnTicketReceived(TicketReceivedContext e)
e.HandleResponse();
return;
}

public virtual Task OnRemoteFailure(RemoteFailureContext e)
{
// // user has not been found, or created (signups disabled on this end) - signout and forward to failure page.
Expand Down Expand Up @@ -261,5 +264,6 @@ protected virtual async Task SetDefaultClaims(TicketReceivedContext e, Applicati
e.Principal.SetUserClaims(user);
await e.HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, e.Principal, e.Properties);
}

}
}
1 change: 1 addition & 0 deletions projects/Hood.Core/Models/Identity/HoodClaimTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class HoodClaimTypes
public const string AccountLinkRequired = "https://schemas.hooddigital.com/hoodcms/account-link-required";
public const string Active = "https://schemas.hooddigital.com/hoodcms/account-active";
public const string AccountCreated = "https://schemas.hooddigital.com/hoodcms/account-created";
public const string AccountCreationFailed = "https://schemas.hooddigital.com/hoodcms/account-creation-failed";
public const string Anonymous = "https://schemas.hooddigital.com/hoodcms/anonymous";
public const string LocalUserId = "https://schemas.hooddigital.com/hoodcms/local-user-id";
public const string IsImpersonating = "https://schemas.hooddigital.com/hoodcms/impersonation-active";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ public async Task<string> GetSitemapDocumentAsync(IUrlHelper urlHelper)
{
XElement urlElement = new XElement(
xmlns + "url",
new XElement(xmlns + "loc", Uri.EscapeUriString(sitemapNode.Url)),
new XElement(xmlns + "loc", Uri.EscapeDataString(sitemapNode.Url)),
sitemapNode.LastModified == null ? null : new XElement(
xmlns + "lastmod",
sitemapNode.LastModified.Value.ToLocalTime().ToString("yyyy-MM-ddTHH:mm:sszzz")),
Expand Down
2 changes: 2 additions & 0 deletions projects/Hood.Core/Services/FTPService/FTPService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ private void GetFile(object data)
}

outputStream = new FileStream(destination + filename, FileMode.OpenOrCreate);
#pragma warning disable SYSLIB0014
FtpWebRequest reqFTP = (FtpWebRequest)WebRequest.Create(new Uri(server + filename));
#pragma warning restore SYSLIB0014
reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(username, password);
Expand Down
Loading

0 comments on commit af599d0

Please sign in to comment.