From 8d2e708d1c1a29378c416b4581895f5511bc1fa8 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 5 Jan 2016 11:36:52 +0100 Subject: [PATCH] Adds exception handling for the BackOfficeUserStore - this will occur if the external OAuth provider doesn't return the Email or Name correctly, then an exception is swallowed at the service level and the user is not actually created, but the BackOfficeUserStore could not detect this, so it's detecting this now. --- src/Umbraco.Core/Security/BackOfficeUserStore.cs | 4 ++++ src/Umbraco.Web/Editors/BackOfficeController.cs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/Umbraco.Core/Security/BackOfficeUserStore.cs b/src/Umbraco.Core/Security/BackOfficeUserStore.cs index e37f9d1a54..c6714e256a 100644 --- a/src/Umbraco.Core/Security/BackOfficeUserStore.cs +++ b/src/Umbraco.Core/Security/BackOfficeUserStore.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.Data; +using System.Data.Common; using System.Linq; using System.Threading.Tasks; using System.Web.Security; @@ -97,6 +99,8 @@ namespace Umbraco.Core.Security } _userService.Save(member); + if (member.Id == 0) throw new DataException("Could not create the user, check logs for details"); + //re-assign id user.Id = member.Id; diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index 4780d1e768..0eac1958dc 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -549,6 +549,9 @@ namespace Umbraco.Web.Editors else { + if (loginInfo.Email.IsNullOrWhiteSpace()) throw new InvalidOperationException("The Email value cannot be null"); + if (loginInfo.ExternalIdentity.Name.IsNullOrWhiteSpace()) throw new InvalidOperationException("The Name value cannot be null"); + var autoLinkUser = new BackOfficeIdentityUser() { Email = loginInfo.Email,