Merge remote-tracking branch 'origin/netcore/netcore' into netcore/task/6666-auth-policies

# Conflicts:
#	src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs
#	src/Umbraco.Web.Common/Filters/UmbracoMemberAuthorizeFilter.cs
This commit is contained in:
Shannon
2020-11-24 00:46:38 +11:00
50 changed files with 699 additions and 368 deletions

View File

@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models
namespace Umbraco.Core.Models.Security
{
public class LoginModel : PostRedirectModel
{
@@ -11,7 +11,7 @@ namespace Umbraco.Web.Models
[Required]
[DataMember(Name = "password", IsRequired = true)]
[StringLength(maximumLength:256)]
[StringLength(maximumLength: 256)]
public string Password { get; set; }
}

View File

@@ -1,4 +1,4 @@
namespace Umbraco.Web.Models
namespace Umbraco.Core.Models.Security
{
/// <summary>
/// A base model containing a value to indicate to Umbraco where to redirect to after Posting if

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Umbraco.Web.Models;
namespace Umbraco.Core.Models.Security
{
/// <summary>
/// A readonly member profile model
/// </summary>
public class ProfileModel : PostRedirectModel
{
[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>
/// The member's real name
/// </summary>
public string Name { get; set; }
/// <summary>
/// The member's member type alias
/// </summary>
[ReadOnly(true)]
public string MemberTypeAlias { get; set; }
[ReadOnly(true)]
public string UserName { get; set; }
[ReadOnly(true)]
public string Comment { get; set; }
[ReadOnly(true)]
public bool IsApproved { get; set; }
[ReadOnly(true)]
public bool IsLockedOut { get; set; }
[ReadOnly(true)]
public DateTime LastLockoutDate { get; set; }
[ReadOnly(true)]
public DateTime CreationDate { get; set; }
[ReadOnly(true)]
public DateTime LastLoginDate { get; set; }
[ReadOnly(true)]
public DateTime LastActivityDate { get; set; }
[ReadOnly(true)]
public DateTime LastPasswordChangedDate { 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; } = new List<UmbracoProperty>();
}
}

View File

@@ -0,0 +1,74 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Umbraco.Web.Models;
namespace Umbraco.Core.Models.Security
{
public class RegisterModel : PostRedirectModel
{
/// <summary>
/// Creates a new empty RegisterModel.
/// </summary>
/// <returns></returns>
public static RegisterModel CreateModel()
{
return new RegisterModel();
}
private RegisterModel()
{
MemberTypeAlias = Constants.Conventions.MemberTypes.DefaultAlias;
UsernameIsEmail = true;
MemberProperties = new List<UmbracoProperty>();
LoginOnSuccess = true;
CreatePersistentLoginCookie = true;
}
[Required]
[RegularExpression(@"[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-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>
[Editable(false)]
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; }
/// <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 successfully created
/// </summary>
public bool LoginOnSuccess { get; set; }
/// <summary>
/// Default is true to create a persistent cookie if LoginOnSuccess is true
/// </summary>
public bool CreatePersistentLoginCookie { get; set; }
}
}