Merge remote-tracking branch 'origin/6.2.0' into 7.1.0
Conflicts: src/Umbraco.Core/Configuration/ClientDependencyConfiguration.cs src/Umbraco.Core/Constants-Conventions.cs src/Umbraco.Core/Models/Member.cs src/Umbraco.Core/Models/Membership/IUser.cs src/Umbraco.Core/Models/Template.cs src/Umbraco.Core/Persistence/Factories/MemberReadOnlyFactory.cs src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs src/Umbraco.Core/Persistence/Repositories/Interfaces/IMemberRepository.cs src/Umbraco.Core/Persistence/Repositories/Interfaces/IUserRepository.cs src/Umbraco.Core/Persistence/Repositories/MemberGroupRepository.cs src/Umbraco.Core/Persistence/Repositories/MemberRepository.cs src/Umbraco.Core/Persistence/Repositories/PermissionRepository.cs src/Umbraco.Core/Persistence/RepositoryFactory.cs src/Umbraco.Core/Services/ContentService.cs src/Umbraco.Core/Services/IMemberTypeService.cs src/Umbraco.Core/Services/IMembershipUserService.cs src/Umbraco.Core/Services/IUserService.cs src/Umbraco.Core/Services/MemberService.cs src/Umbraco.Core/Services/MemberTypeService.cs src/Umbraco.Core/Services/ServiceContext.cs src/Umbraco.Core/Services/UserService.cs src/Umbraco.Core/Umbraco.Core.csproj src/Umbraco.Tests/MockTests.cs src/Umbraco.Tests/Persistence/Repositories/ContentRepositoryTest.cs src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs src/Umbraco.Web.UI/Umbraco.Web.UI.csproj src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Login.cshtml src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/LoginStatus.cshtml src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/RegisterMember.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Breadcrumb.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/EditProfile.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListAncestorsFromCurrentPage.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesFromCurrentPage.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesOrderedByDate.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesOrderedByName.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListChildPagesWithDoctype.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/ListDescendantsFromCurrentPage.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Login.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/LoginStatus.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/MultinodeTree-picker.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/Navigation.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/RegisterMember.cshtml src/Umbraco.Web.UI/Umbraco/PartialViews/Templates/SiteMap.cshtml src/Umbraco.Web.UI/Umbraco/create/PartialView.ascx.cs src/Umbraco.Web.UI/config/umbracoSettings.config src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs src/Umbraco.Web/Controllers/UmbLoginController.cs src/Umbraco.Web/Controllers/UmbLoginStatusController.cs src/Umbraco.Web/Controllers/UmbProfileController.cs src/Umbraco.Web/Controllers/UmbRegisterController.cs src/Umbraco.Web/Models/LoginModel.cs src/Umbraco.Web/Models/LoginStatusModel.cs src/Umbraco.Web/Models/ProfileModel.cs src/Umbraco.Web/Models/RegisterModel.cs src/Umbraco.Web/Models/UmbracoProperty.cs src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs src/Umbraco.Web/Security/WebSecurity.cs src/Umbraco.Web/Umbraco.Web.csproj src/Umbraco.Web/UmbracoModule.cs src/Umbraco.Web/WebApi/UmbracoApiController.cs src/Umbraco.Web/umbraco.presentation/library.cs src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs src/Umbraco.Web/umbraco.presentation/umbraco/editContent.aspx.cs src/Umbraco.Web/umbraco.presentation/umbraco/login.aspx.cs src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMember.aspx.cs src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs src/Umbraco.Web/umbraco.presentation/umbracobase/baseLibrary.cs src/Umbraco.Web/umbraco.presentation/umbracobase/restExtension.cs src/umbraco.businesslogic/User.cs src/umbraco.providers/UsersMembershipProvider.cs src/umbraco.providers/members/UmbracoMembershipProvider.cs
This commit is contained in:
@@ -356,8 +356,8 @@ namespace Umbraco.Web.Models
|
||||
{
|
||||
//if we cannot get with the current alias, try changing it's case
|
||||
attempt = alias[0].IsUpperCase()
|
||||
? getMember(alias.ToCleanString(CleanStringType.Ascii | CleanStringType.Alias | CleanStringType.CamelCase))
|
||||
: getMember(alias.ToCleanString(CleanStringType.Ascii | CleanStringType.Alias | CleanStringType.PascalCase));
|
||||
? getMember(alias.ToCleanString(CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.CamelCase))
|
||||
: getMember(alias.ToCleanString(CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.PascalCase));
|
||||
}
|
||||
|
||||
return !attempt.Success
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models
|
||||
{
|
||||
public class LoginModel
|
||||
public class LoginModel : PostRedirectModel
|
||||
{
|
||||
[Required]
|
||||
[DataMember(Name = "username", IsRequired = true)]
|
||||
@@ -12,5 +12,6 @@ namespace Umbraco.Web.Models
|
||||
[Required]
|
||||
[DataMember(Name = "password", IsRequired = true)]
|
||||
public string Password { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,72 @@
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Web;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Security;
|
||||
|
||||
namespace Umbraco.Web.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// The model representing the status of a logged in member
|
||||
/// </summary>
|
||||
public class LoginStatusModel
|
||||
{
|
||||
public LoginStatusModel()
|
||||
/// <summary>
|
||||
/// Creates a new empty LoginStatusModel
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static LoginStatusModel CreateModel()
|
||||
{
|
||||
//TODO Use new Member API
|
||||
if (Member.IsLoggedOn())
|
||||
var model = new LoginStatusModel(false);
|
||||
return model;
|
||||
}
|
||||
|
||||
private LoginStatusModel(bool doLookup)
|
||||
{
|
||||
if (doLookup && HttpContext.Current != null && ApplicationContext.Current != null)
|
||||
{
|
||||
var member = Member.GetCurrentMember();
|
||||
if (member != null)
|
||||
var helper = new MembershipHelper(ApplicationContext.Current, new HttpContextWrapper(HttpContext.Current));
|
||||
var model = helper.GetCurrentLoginStatus();
|
||||
if (model != null)
|
||||
{
|
||||
this.Name = member.Text;
|
||||
this.Username = member.LoginName;
|
||||
this.Email = member.Email;
|
||||
this.IsLoggedIn = true;
|
||||
Name = model.Name;
|
||||
Username = model.Username;
|
||||
Email = model.Email;
|
||||
IsLoggedIn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This will construct a new LoginStatusModel and perform a lookup for hte curently logged in member
|
||||
/// </summary>
|
||||
[Obsolete("Do not use this ctor as it will perform business logic lookups. Use the MembershipHelper.GetCurrentLoginStatus or the static LoginStatusModel.CreateModel() to create an empty model.")]
|
||||
public LoginStatusModel()
|
||||
: this(true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name of the member
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The username of the member
|
||||
/// </summary>
|
||||
public string Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The email of the member
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True, if the member is currently logged in
|
||||
/// </summary>
|
||||
public bool IsLoggedIn { get; set; }
|
||||
}
|
||||
}
|
||||
15
src/Umbraco.Web/Models/PostRedirectModel.cs
Normal file
15
src/Umbraco.Web/Models/PostRedirectModel.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Umbraco.Web.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A base model containing a value to indicate to Umbraco where to redirect to after Posting if
|
||||
/// a developer doesn't want the controller to redirect to the current Umbraco page - which is the default.
|
||||
/// </summary>
|
||||
public class PostRedirectModel
|
||||
{
|
||||
/// <summary>
|
||||
/// The path to redirect to when update is successful, if not specified then the user will be
|
||||
/// redirected to the current Umbraco page
|
||||
/// </summary>
|
||||
public string RedirectUrl { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Security;
|
||||
|
||||
namespace Umbraco.Web.Models
|
||||
{
|
||||
public class ProfileModel
|
||||
public class ProfileModel : PostRedirectModel
|
||||
{
|
||||
public ProfileModel()
|
||||
public static ProfileModel CreateModel()
|
||||
{
|
||||
if (Member.IsLoggedOn())
|
||||
var model = new ProfileModel(false);
|
||||
return model;
|
||||
}
|
||||
|
||||
private ProfileModel(bool doLookup)
|
||||
{
|
||||
MemberProperties = new List<UmbracoProperty>();
|
||||
if (doLookup)
|
||||
{
|
||||
//TODO Use new Member API
|
||||
var member = Member.GetCurrentMember();
|
||||
var helper = new MembershipHelper(ApplicationContext.Current, new HttpContextWrapper(HttpContext.Current));
|
||||
var model = helper.CreateProfileModel();
|
||||
MemberProperties = model.MemberProperties;
|
||||
}
|
||||
}
|
||||
|
||||
if (member != null)
|
||||
{
|
||||
this.Name = member.Text;
|
||||
|
||||
this.Email = member.Email;
|
||||
|
||||
this.MemberProperties = new List<UmbracoProperty>();
|
||||
|
||||
var memberType = MemberType.GetByAlias(member.ContentType.Alias);
|
||||
|
||||
foreach (var prop in memberType.PropertyTypes.Where(memberType.MemberCanEdit))
|
||||
{
|
||||
var value = string.Empty;
|
||||
var propValue = member.getProperty(prop.Alias);
|
||||
if (propValue != null)
|
||||
{
|
||||
value = propValue.Value.ToString();
|
||||
}
|
||||
|
||||
this.MemberProperties.Add(new UmbracoProperty
|
||||
{
|
||||
Alias = prop.Alias,
|
||||
Name = prop.Name,
|
||||
Value = value
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
[Obsolete("Do not use this ctor as it will perform business logic lookups. Use the MembershipHelper.CreateProfileModel or the static ProfileModel.CreateModel() to create an empty model.")]
|
||||
public ProfileModel()
|
||||
:this(true)
|
||||
{
|
||||
}
|
||||
|
||||
[Required]
|
||||
@@ -49,10 +40,25 @@ namespace Umbraco.Web.Models
|
||||
ErrorMessage = "Please enter a valid e-mail address")]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The member's real name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The member's member type alias
|
||||
/// </summary>
|
||||
[ReadOnly(true)]
|
||||
[Obsolete("This is not used and will be removed from the codebase in future versions")]
|
||||
public string MemberTypeAlias { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The list of member properties
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Adding items to this list on the front-end will not add properties to the member in the database.
|
||||
/// </remarks>
|
||||
public List<UmbracoProperty> MemberProperties { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +1,94 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using umbraco.cms.businesslogic.member;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Security;
|
||||
|
||||
namespace Umbraco.Web.Models
|
||||
{
|
||||
public class RegisterModel
|
||||
public class RegisterModel : PostRedirectModel
|
||||
{
|
||||
public RegisterModel()
|
||||
/// <summary>
|
||||
/// Creates a new empty RegisterModel
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static RegisterModel CreateModel()
|
||||
{
|
||||
this.MemberTypeAlias = Constants.Conventions.MemberTypes.Member;
|
||||
var model = new RegisterModel(false);
|
||||
return model;
|
||||
}
|
||||
|
||||
this.RedirectOnSucces = false;
|
||||
private RegisterModel(bool doLookup)
|
||||
{
|
||||
MemberTypeAlias = Constants.Conventions.MemberTypes.Member;
|
||||
RedirectOnSucces = false;
|
||||
RedirectUrl = "/";
|
||||
UsernameIsEmail = true;
|
||||
MemberProperties = new List<UmbracoProperty>();
|
||||
LoginOnSuccess = true;
|
||||
|
||||
this.RedirectUrl = "/";
|
||||
|
||||
this.UsernameIsEmail = true;
|
||||
|
||||
var memberType = MemberType.GetByAlias(this.MemberTypeAlias);
|
||||
|
||||
if (memberType != null)
|
||||
if (doLookup && HttpContext.Current != null && ApplicationContext.Current != null)
|
||||
{
|
||||
this.MemberProperties = new List<UmbracoProperty>();
|
||||
|
||||
foreach (var prop in memberType.PropertyTypes.Where(memberType.MemberCanEdit))
|
||||
{
|
||||
this.MemberProperties.Add(new UmbracoProperty
|
||||
{
|
||||
Alias = prop.Alias,
|
||||
Name = prop.Name,
|
||||
Value = string.Empty
|
||||
});
|
||||
}
|
||||
var helper = new MembershipHelper(ApplicationContext.Current, new HttpContextWrapper(HttpContext.Current));
|
||||
var model = helper.CreateRegistrationModel(MemberTypeAlias);
|
||||
MemberProperties = model.MemberProperties;
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Do not use this ctor as it will perform business logic lookups. Use the MembershipHelper.CreateRegistrationModel or the static RegisterModel.CreateModel() to create an empty model.")]
|
||||
public RegisterModel()
|
||||
: this(true)
|
||||
{
|
||||
}
|
||||
|
||||
[Required]
|
||||
[RegularExpression(@"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?",
|
||||
ErrorMessage = "Please enter a valid e-mail address")]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the member properties
|
||||
/// </summary>
|
||||
public List<UmbracoProperty> MemberProperties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The member type alias to use to register the member
|
||||
/// </summary>
|
||||
public string MemberTypeAlias { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The members real name
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The members password
|
||||
/// </summary>
|
||||
[Required]
|
||||
public string Password { get; set; }
|
||||
|
||||
[ReadOnly(true)]
|
||||
[Obsolete("This is no longer used and will be removed from the codebase in future versions")]
|
||||
public bool RedirectOnSucces { get; set; }
|
||||
|
||||
public string RedirectUrl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The username of the model, if UsernameIsEmail is true then this is ignored.
|
||||
/// </summary>
|
||||
public string Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Flag to determine if the username should be the email address, if true then the Username property is ignored
|
||||
/// </summary>
|
||||
public bool UsernameIsEmail { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies if the member should be logged in if they are succesfully created
|
||||
/// </summary>
|
||||
public bool LoginOnSuccess { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
namespace Umbraco.Web.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple representation of an Umbraco property
|
||||
/// </summary>
|
||||
public class UmbracoProperty
|
||||
{
|
||||
public string Alias { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user