From d03227b77d8e0f6bf5f3b29551b87f3b4f4c84ee Mon Sep 17 00:00:00 2001 From: Mark Roffey Date: Wed, 29 Jan 2020 09:11:20 +0000 Subject: [PATCH 1/4] Upgraded to 8.5.3. --- .../UmbracoIdentityAccountController.cs | 23 ++++---- .../App_Start/UmbracoIdentityOwinStartup.cs | 4 +- .../UmbracoIdentity.Web.csproj | 57 +++++++++++-------- src/UmbracoIdentity.Web/Views/Web.config | 20 ++++--- src/UmbracoIdentity.Web/Web.config | 32 +++++++---- src/UmbracoIdentity.Web/packages.config | 18 +++--- src/UmbracoIdentity/UmbracoIdentity.csproj | 28 ++++++--- src/UmbracoIdentity/packages.config | 12 ++-- 8 files changed, 115 insertions(+), 79 deletions(-) diff --git a/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs b/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs index 587764d..d8c6db9 100644 --- a/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs +++ b/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs @@ -1,26 +1,25 @@ -using System; +using Microsoft.AspNet.Identity; +using Microsoft.Owin; +using Microsoft.Owin.Security; +using System; using System.Linq; using System.Threading.Tasks; using System.Web; using System.Web.Mvc; -using Microsoft.AspNet.Identity; -using Microsoft.AspNet.Identity.Owin; -using Microsoft.Owin; -using Microsoft.Owin.Security; -using UmbracoIdentity.Web.Models.UmbracoIdentity; -using Umbraco.Web; using Umbraco.Core; -using Umbraco.Web.Models; -using Umbraco.Web.Mvc; -using UmbracoIdentity.Models; -using UmbracoIdentity; using Umbraco.Core.Cache; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; using Umbraco.Core.Services; +using Umbraco.Web; +using Umbraco.Web.Models; +using Umbraco.Web.Mvc; +using UmbracoIdentity.Models; -namespace UmbracoIdentity.Web.Controllers +namespace UmbracoIdentity.Web.Controllers { + using Models.UmbracoIdentity; + [Authorize] public class UmbracoIdentityAccountController : SurfaceController { diff --git a/src/UmbracoIdentity.Web/App_Start/UmbracoIdentityOwinStartup.cs b/src/UmbracoIdentity.Web/App_Start/UmbracoIdentityOwinStartup.cs index a466707..cd475bc 100644 --- a/src/UmbracoIdentity.Web/App_Start/UmbracoIdentityOwinStartup.cs +++ b/src/UmbracoIdentity.Web/App_Start/UmbracoIdentityOwinStartup.cs @@ -6,13 +6,13 @@ using System; using System.Configuration; using System.Linq; -using UmbracoIdentity; using UmbracoIdentity.Web; -using UmbracoIdentity.Web.Models.UmbracoIdentity; + [assembly: OwinStartup("UmbracoIdentityStartup", typeof(UmbracoIdentityOwinStartup))] namespace UmbracoIdentity.Web { + using Models.UmbracoIdentity; /// /// OWIN Startup class for UmbracoIdentity diff --git a/src/UmbracoIdentity.Web/UmbracoIdentity.Web.csproj b/src/UmbracoIdentity.Web/UmbracoIdentity.Web.csproj index 735c1c8..bd77251 100644 --- a/src/UmbracoIdentity.Web/UmbracoIdentity.Web.csproj +++ b/src/UmbracoIdentity.Web/UmbracoIdentity.Web.csproj @@ -1,5 +1,5 @@  - + @@ -48,17 +48,17 @@ ..\packages\AutoMapper.8.0.0\lib\net461\AutoMapper.dll - - ..\packages\ClientDependency.1.9.7\lib\net45\ClientDependency.Core.dll + + ..\packages\ClientDependency.1.9.8\lib\net45\ClientDependency.Core.dll - - ..\packages\ClientDependency-Mvc5.1.8.0.0\lib\net45\ClientDependency.Core.Mvc.dll + + ..\packages\ClientDependency-Mvc5.1.9.3\lib\net45\ClientDependency.Core.Mvc.dll ..\packages\CSharpTest.Net.Collections.14.906.1403.1082\lib\net40\CSharpTest.Net.Collections.dll - - ..\packages\Examine.1.0.0\lib\net452\Examine.dll + + ..\packages\Examine.1.0.1\lib\net452\Examine.dll ..\packages\HtmlAgilityPack.1.8.14\lib\Net45\HtmlAgilityPack.dll @@ -181,9 +181,15 @@ ..\packages\Serilog.Settings.AppSettings.2.2.2\lib\net45\Serilog.Settings.AppSettings.dll + + ..\packages\Serilog.Sinks.Async.1.3.0\lib\net45\Serilog.Sinks.Async.dll + ..\packages\Serilog.Sinks.File.4.0.0\lib\net45\Serilog.Sinks.File.dll + + ..\packages\Serilog.Sinks.Map.1.0.0\lib\netstandard2.0\Serilog.Sinks.Map.dll + ..\packages\Superpower.2.0.0\lib\net45\Superpower.dll @@ -383,19 +389,22 @@ True - ..\packages\UmbracoCms.Core.8.0.2\lib\net472\Umbraco.Core.dll + ..\packages\UmbracoCms.Core.8.5.3\lib\net472\Umbraco.Core.dll - ..\packages\UmbracoCms.Web.8.0.2\lib\net472\Umbraco.Examine.dll + ..\packages\UmbracoCms.Web.8.5.3\lib\net472\Umbraco.Examine.dll - ..\packages\Umbraco.ModelsBuilder.8.0.4\lib\net472\Umbraco.ModelsBuilder.dll + ..\packages\Umbraco.ModelsBuilder.8.1.0\lib\net472\Umbraco.ModelsBuilder.dll + + + ..\packages\UmbracoCms.Web.8.5.3\lib\net472\Umbraco.ModelsBuilder.Embedded.dll - ..\packages\UmbracoCms.Web.8.0.2\lib\net472\Umbraco.Web.dll + ..\packages\UmbracoCms.Web.8.5.3\lib\net472\Umbraco.Web.dll - ..\packages\UmbracoCms.Web.8.0.2\lib\net472\Umbraco.Web.UI.dll + ..\packages\UmbracoCms.Web.8.5.3\lib\net472\Umbraco.Web.UI.dll @@ -450,8 +459,8 @@ - + @@ -460,14 +469,6 @@ - - - - - - - - @@ -486,6 +487,14 @@ + + + + + + + + Web.config @@ -535,11 +544,11 @@ - - + + - + - - + + + @@ -166,6 +174,8 @@ + + @@ -212,6 +222,10 @@ + + + + @@ -252,10 +266,6 @@ - - - - diff --git a/src/UmbracoIdentity.Web/packages.config b/src/UmbracoIdentity.Web/packages.config index 5b15c4b..c022dd0 100644 --- a/src/UmbracoIdentity.Web/packages.config +++ b/src/UmbracoIdentity.Web/packages.config @@ -1,10 +1,10 @@  - - + + - + @@ -54,7 +54,9 @@ + + @@ -101,10 +103,10 @@ - - + + - - - + + + \ No newline at end of file diff --git a/src/UmbracoIdentity/UmbracoIdentity.csproj b/src/UmbracoIdentity/UmbracoIdentity.csproj index c840b1e..f7f696b 100644 --- a/src/UmbracoIdentity/UmbracoIdentity.csproj +++ b/src/UmbracoIdentity/UmbracoIdentity.csproj @@ -39,14 +39,17 @@ ..\packages\AutoMapper.8.0.0\lib\net461\AutoMapper.dll - - ..\packages\ClientDependency.1.9.7\lib\net45\ClientDependency.Core.dll + + ..\packages\ClientDependency.1.9.8\lib\net45\ClientDependency.Core.dll + + + ..\packages\ClientDependency-Mvc5.1.9.3\lib\net45\ClientDependency.Core.Mvc.dll ..\packages\CSharpTest.Net.Collections.14.906.1403.1082\lib\net40\CSharpTest.Net.Collections.dll - - ..\packages\Examine.1.0.0\lib\net452\Examine.dll + + ..\packages\Examine.1.0.1\lib\net452\Examine.dll ..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll @@ -160,9 +163,15 @@ ..\packages\Serilog.Settings.AppSettings.2.2.2\lib\net45\Serilog.Settings.AppSettings.dll + + ..\packages\Serilog.Sinks.Async.1.3.0\lib\net45\Serilog.Sinks.Async.dll + ..\packages\Serilog.Sinks.File.4.0.0\lib\net45\Serilog.Sinks.File.dll + + ..\packages\Serilog.Sinks.Map.1.0.0\lib\netstandard2.0\Serilog.Sinks.Map.dll + ..\packages\Superpower.2.2.0\lib\net45\Superpower.dll @@ -236,16 +245,19 @@ - ..\packages\UmbracoCms.Core.8.0.0\lib\net472\Umbraco.Core.dll + ..\packages\UmbracoCms.Core.8.5.3\lib\net472\Umbraco.Core.dll - ..\packages\UmbracoCms.Web.8.0.0\lib\net472\Umbraco.Examine.dll + ..\packages\UmbracoCms.Web.8.5.3\lib\net472\Umbraco.Examine.dll + + + ..\packages\UmbracoCms.Web.8.5.3\lib\net472\Umbraco.ModelsBuilder.Embedded.dll - ..\packages\UmbracoCms.Web.8.0.0\lib\net472\Umbraco.Web.dll + ..\packages\UmbracoCms.Web.8.5.3\lib\net472\Umbraco.Web.dll - ..\packages\UmbracoCms.Web.8.0.0\lib\net472\Umbraco.Web.UI.dll + ..\packages\UmbracoCms.Web.8.5.3\lib\net472\Umbraco.Web.UI.dll diff --git a/src/UmbracoIdentity/packages.config b/src/UmbracoIdentity/packages.config index ed3ef65..d1c2518 100644 --- a/src/UmbracoIdentity/packages.config +++ b/src/UmbracoIdentity/packages.config @@ -1,10 +1,10 @@  - - + + - + @@ -49,13 +49,15 @@ + + - - + + \ No newline at end of file From 7c0eda465f41f57038c77e53db0666e00556daf0 Mon Sep 17 00:00:00 2001 From: Mark Roffey Date: Wed, 29 Jan 2020 09:24:01 +0000 Subject: [PATCH 2/4] Added missing system.web closing tag --- src/UmbracoIdentity.Web/Web.config | 293 +++++++++++++++-------------- 1 file changed, 147 insertions(+), 146 deletions(-) diff --git a/src/UmbracoIdentity.Web/Web.config b/src/UmbracoIdentity.Web/Web.config index 6dbed8b..aff386d 100644 --- a/src/UmbracoIdentity.Web/Web.config +++ b/src/UmbracoIdentity.Web/Web.config @@ -135,162 +135,163 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From c633fb72bbec20cc94121a4c5beddfcf009cbcc5 Mon Sep 17 00:00:00 2001 From: Mark Roffey Date: Wed, 29 Jan 2020 15:48:35 +0000 Subject: [PATCH 3/4] #112 Fixed error --- .../UmbracoIdentityAccountController.cs | 21 +++++++++++++------ ...dentityEnabledMembersMembershipProvider.cs | 4 ++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs b/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs index d8c6db9..ec177c7 100644 --- a/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs +++ b/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs @@ -312,17 +312,26 @@ public async Task ManagePassword([Bind(Prefix = "managePasswordMod [AllowAnonymous] public async Task HandleLogin([Bind(Prefix = "loginModel")] LoginModel model) { - if (ModelState.IsValid) + if (!ModelState.IsValid) + return CurrentUmbracoPage(); + + var user = await _userManager.FindAsync(model.Username, model.Password); + + if (user != null) { - var user = await _userManager.FindAsync(model.Username, model.Password); - if (user != null) + //member exits but registered with social login. + if (user.PasswordHash == null) { - await SignInAsync(user, true); - return RedirectToCurrentUmbracoPage(); + ModelState.AddModelError("loginModel", "Social Account registered"); + return CurrentUmbracoPage(); } - ModelState.AddModelError("loginModel", "Invalid username or password"); + + await SignInAsync(user, true); + return RedirectToCurrentUmbracoPage(); } + ModelState.AddModelError("loginModel", "Invalid username or password"); + return CurrentUmbracoPage(); } diff --git a/src/UmbracoIdentity/IdentityEnabledMembersMembershipProvider.cs b/src/UmbracoIdentity/IdentityEnabledMembersMembershipProvider.cs index 8e75b0d..d22f5e5 100644 --- a/src/UmbracoIdentity/IdentityEnabledMembersMembershipProvider.cs +++ b/src/UmbracoIdentity/IdentityEnabledMembersMembershipProvider.cs @@ -49,6 +49,10 @@ public class IdentityEnabledMembersMembershipProvider : MembersMembershipProvide public new bool VerifyPassword(string password, string hashedPassword) { + //member exits but registered with social login. + if (hashedPassword == null) + return true; + return CheckPassword(password, hashedPassword); } From 2073a39007aa70f8c705a3efc8655e10a234a72b Mon Sep 17 00:00:00 2001 From: Mark Roffey Date: Thu, 30 Jan 2020 11:41:24 +0000 Subject: [PATCH 4/4] Changed to built in Umbraco IsNullOrWhiteSpace() --- .../App_Start/Controllers/UmbracoIdentityAccountController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs b/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs index ec177c7..c2941e9 100644 --- a/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs +++ b/src/UmbracoIdentity.Web/App_Start/Controllers/UmbracoIdentityAccountController.cs @@ -319,8 +319,8 @@ public async Task HandleLogin([Bind(Prefix = "loginModel")] LoginM if (user != null) { - //member exits but registered with social login. - if (user.PasswordHash == null) + //member exists but registered with social login. + if (user.PasswordHash.IsNullOrWhiteSpace()) { ModelState.AddModelError("loginModel", "Social Account registered"); return CurrentUmbracoPage();