diff --git a/src/Umbraco.Core/Models/Membership/IUser.cs b/src/Umbraco.Core/Models/Membership/IUser.cs index 70cb135f50..555537d851 100644 --- a/src/Umbraco.Core/Models/Membership/IUser.cs +++ b/src/Umbraco.Core/Models/Membership/IUser.cs @@ -10,7 +10,7 @@ namespace Umbraco.Core.Models.Membership /// Will be left internal until a proper Membership implementation is part of the roadmap public interface IUser : IMembershipUser, IRememberBeingDirty, ICanBeDirty { - UserState UserState { get; } + UserState UserState { get; } string Name { get; set; } int SessionTimeout { get; set; } @@ -18,8 +18,8 @@ namespace Umbraco.Core.Models.Membership int[] StartMediaIds { get; set; } string Language { get; set; } - DateTime? EmailConfirmedDate { get; set; } - DateTime? InvitedDate { get; set; } + DateTime? EmailConfirmedDate { get; set; } + DateTime? InvitedDate { get; set; } /// /// Gets the groups that user is part of @@ -45,8 +45,8 @@ namespace Umbraco.Core.Models.Membership /// /// Will hold the media file system relative path of the users custom avatar if they uploaded one /// - string Avatar { get; set; } - + string Avatar { get; set; } + /// /// Returns all start node Ids assigned to the user based on both the explicit start node ids assigned to the user and any start node Ids assigned to it's user groups /// diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs index cf6a9fa3fe..499f958449 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs @@ -661,7 +661,7 @@ namespace Umbraco.Core.Persistence.Repositories if (contentVerDto != null) { contentVersionDto.Id = contentVerDto.Id; - Database.Update(contentVersionDto); + Database.Update(contentVersionDto); } Database.Update(dto); @@ -884,7 +884,7 @@ order by umbracoNode.{2}, umbracoNode.parentID, umbracoNode.sortOrder", var repo = new PermissionRepository(UnitOfWork, _cacheHelper, SqlSyntax); repo.AssignEntityPermission(entity, permission, groupIds); } - + /// /// Returns permissions directly assigned to the content item for all user groups /// diff --git a/src/Umbraco.Core/Services/UserService.cs b/src/Umbraco.Core/Services/UserService.cs index d8a3d4fb06..f7cf263e91 100644 --- a/src/Umbraco.Core/Services/UserService.cs +++ b/src/Umbraco.Core/Services/UserService.cs @@ -362,10 +362,8 @@ namespace Umbraco.Core.Services if (raiseEvents) uow.Events.Dispatch(SavedUser, this, new SaveEventArgs(asArray, false)); } - - } - + /// /// This is just the default user group that the membership provider will use /// diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index 7821f69897..54b2f4cf1b 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -3,9 +3,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; -using System.Net; -using System.Net.Configuration; -using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -23,7 +20,6 @@ using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Manifest; -using Umbraco.Core.Models; using Umbraco.Core.Models.Identity; using Umbraco.Core.Models.Membership; using Umbraco.Core.Security; @@ -32,9 +28,7 @@ using Umbraco.Web.Mvc; using Umbraco.Web.Security.Identity; using Umbraco.Web.Trees; using Umbraco.Web.UI.JavaScript; -using Umbraco.Web.WebApi.Filters; using Umbraco.Core.Services; -using Umbraco.Web.Security; using Action = umbraco.BusinessLogic.Actions.Action; using Constants = Umbraco.Core.Constants; @@ -78,7 +72,7 @@ namespace Umbraco.Web.Editors () => View(GlobalSettings.Path.EnsureEndsWith('/') + "Views/Default.cshtml"), () => View(GlobalSettings.Path.EnsureEndsWith('/') + "Views/Default.cshtml")); } - + [HttpGet] public async Task VerifyInvite(string invite) { @@ -86,17 +80,17 @@ namespace Umbraco.Web.Editors { Logger.Warn("VerifyUser endpoint reached with invalid token: NULL"); return RedirectToAction("Default"); - } + } var parts = Server.UrlDecode(invite).Split('|'); if (parts.Length != 2) - { + { Logger.Warn("VerifyUser endpoint reached with invalid token: " + invite); return RedirectToAction("Default"); } - var token = parts[1]; + var token = parts[1]; var decoded = token.FromUrlBase64(); if (decoded.IsNullOrWhiteSpace()) @@ -111,7 +105,7 @@ namespace Umbraco.Web.Editors { Logger.Warn("VerifyUser endpoint reached with invalid token: " + invite); return RedirectToAction("Default"); - } + } var identityUser = await UserManager.FindByIdAsync(intId); if (identityUser == null) @@ -127,8 +121,8 @@ namespace Umbraco.Web.Editors Logger.Warn("Could not verify email, Error: " + string.Join(",", result.Errors) + ", Token: " + invite); return RedirectToAction("Default"); } - - //sign the user in + + //sign the user in AuthenticationManager.SignOut( Core.Constants.Security.BackOfficeAuthenticationType, @@ -137,7 +131,7 @@ namespace Umbraco.Web.Editors await SignInManager.SignInAsync(identityUser, false, false); return new RedirectResult(Url.Action("Default") + "#/login/false?invite=1"); - } + } /// /// This Action is used by the installer when an upgrade is detected but the admin user is not logged in. We need to @@ -255,7 +249,7 @@ namespace Umbraco.Web.Editors [MinifyJavaScriptResult(Order = 1)] public JavaScriptResult ServerVariables() { - var serverVars = new BackOfficeServerVariables(Url, ApplicationContext, UmbracoConfig.For.UmbracoSettings()); + var serverVars = new BackOfficeServerVariables(Url, ApplicationContext, UmbracoConfig.For.UmbracoSettings()); //cache the result if debugging is disabled var result = HttpContext.IsDebuggingEnabled @@ -267,8 +261,8 @@ namespace Umbraco.Web.Editors return JavaScript(result); } - - + + [HttpPost] public ActionResult ExternalLogin(string provider, string redirectUrl = null) @@ -447,7 +441,7 @@ namespace Umbraco.Web.Editors 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 groups = Services.UserService.GetUserGroupsByAlias(autoLinkOptions.GetDefaultUserGroups(UmbracoContext, loginInfo)); + var groups = Services.UserService.GetUserGroupsByAlias(autoLinkOptions.GetDefaultUserGroups(UmbracoContext, loginInfo)); var autoLinkUser = new BackOfficeIdentityUser { @@ -455,9 +449,9 @@ namespace Umbraco.Web.Editors Name = loginInfo.ExternalIdentity.Name, AllowedSections = autoLinkOptions.GetDefaultAllowedSections(UmbracoContext, loginInfo), Culture = autoLinkOptions.GetDefaultCulture(UmbracoContext, loginInfo), - UserName = loginInfo.Email, + UserName = loginInfo.Email, Groups = groups.Select(x => x.ToReadOnlyGroup()).ToArray() - }; + }; //call the callback if one is assigned if (autoLinkOptions.OnAutoLinking != null) @@ -501,8 +495,6 @@ namespace Umbraco.Web.Editors return false; } - - /// /// Returns the JavaScript blocks for any legacy trees declared diff --git a/src/Umbraco.Web/Models/ContentEditing/UserBasic.cs b/src/Umbraco.Web/Models/ContentEditing/UserBasic.cs index 7467955e71..0b4a7e02d7 100644 --- a/src/Umbraco.Web/Models/ContentEditing/UserBasic.cs +++ b/src/Umbraco.Web/Models/ContentEditing/UserBasic.cs @@ -5,9 +5,7 @@ using System.Runtime.Serialization; using Umbraco.Core.Models.Membership; namespace Umbraco.Web.Models.ContentEditing -{ - - +{ /// /// The user model used for paging and listing users in the UI /// @@ -59,8 +57,8 @@ namespace Umbraco.Web.Models.ContentEditing /// [DataMember(Name = "isCurrentUser")] [ReadOnly(true)] - public bool IsCurrentUser { get; set; } - + public bool IsCurrentUser { get; set; } + /// /// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes. ///