diff --git a/src/Umbraco.Core/Models/Member.cs b/src/Umbraco.Core/Models/Member.cs
index 02d6b9aece..033bbb49b7 100644
--- a/src/Umbraco.Core/Models/Member.cs
+++ b/src/Umbraco.Core/Models/Member.cs
@@ -96,7 +96,8 @@ namespace Umbraco.Core.Models
/// The password value passed in to this parameter should be the encoded/encrypted/hashed format of the member's password
///
///
- public Member(string name, string email, string username, string rawPasswordValue, IMemberType contentType)
+ /// Optional IsApproved parameter
+ public Member(string name, string email, string username, string rawPasswordValue, IMemberType contentType, bool isApproved = true)
: base(name, -1, contentType, new PropertyCollection())
{
Mandate.ParameterNotNull(contentType, "contentType");
@@ -106,7 +107,7 @@ namespace Umbraco.Core.Models
_email = email;
_username = username;
_rawPasswordValue = rawPasswordValue;
- IsApproved = true;
+ IsApproved = isApproved;
}
private static readonly Lazy Ps = new Lazy();
diff --git a/src/Umbraco.Core/Services/IMembershipMemberService.cs b/src/Umbraco.Core/Services/IMembershipMemberService.cs
index 801f88d9ac..7419c33254 100644
--- a/src/Umbraco.Core/Services/IMembershipMemberService.cs
+++ b/src/Umbraco.Core/Services/IMembershipMemberService.cs
@@ -69,8 +69,9 @@ namespace Umbraco.Core.Services
/// Email of the to create
/// This value should be the encoded/encrypted/hashed value for the password that will be stored in the database
/// Alias of the Type
+ /// IsApproved of the to create
///
- T CreateWithIdentity(string username, string email, string passwordValue, string memberTypeAlias);
+ T CreateWithIdentity(string username, string email, string passwordValue, string memberTypeAlias, bool isApproved = true);
///
/// Gets an by its provider key
diff --git a/src/Umbraco.Core/Services/MemberService.cs b/src/Umbraco.Core/Services/MemberService.cs
index 094539d66e..36bcbf29d2 100644
--- a/src/Umbraco.Core/Services/MemberService.cs
+++ b/src/Umbraco.Core/Services/MemberService.cs
@@ -830,10 +830,10 @@ namespace Umbraco.Core.Services
/// This value should be the encoded/encrypted/hashed value for the password that will be stored in the database
/// Alias of the Type
///
- IMember IMembershipMemberService.CreateWithIdentity(string username, string email, string passwordValue, string memberTypeAlias)
+ IMember IMembershipMemberService.CreateWithIdentity(string username, string email, string passwordValue, string memberTypeAlias, bool isApproved)
{
var memberType = FindMemberTypeByAlias(memberTypeAlias);
- return CreateMemberWithIdentity(username, email, username, passwordValue, memberType);
+ return CreateMemberWithIdentity(username, email, username, passwordValue, memberType, isApproved);
}
///
@@ -846,12 +846,13 @@ namespace Umbraco.Core.Services
/// Name of the Member to create
/// This value should be the encoded/encrypted/hashed value for the password that will be stored in the database
/// MemberType the Member should be based on
+ /// Optional IsApproved of the Member to create
///
- private IMember CreateMemberWithIdentity(string username, string email, string name, string passwordValue, IMemberType memberType)
+ private IMember CreateMemberWithIdentity(string username, string email, string name, string passwordValue, IMemberType memberType, bool isApproved = true)
{
if (memberType == null) throw new ArgumentNullException("memberType");
- var member = new Member(name, email.ToLower().Trim(), username, passwordValue, memberType);
+ var member = new Member(name, email.ToLower().Trim(), username, passwordValue, memberType, isApproved);
if (Saving.IsRaisedEventCancelled(new SaveEventArgs(member), this))
{
diff --git a/src/Umbraco.Core/Services/UserService.cs b/src/Umbraco.Core/Services/UserService.cs
index 8e984d1e5d..13e502fa4f 100644
--- a/src/Umbraco.Core/Services/UserService.cs
+++ b/src/Umbraco.Core/Services/UserService.cs
@@ -100,7 +100,7 @@ namespace Umbraco.Core.Services
/// This value should be the encoded/encrypted/hashed value for the password that will be stored in the database
/// Alias of the Type
///
- IUser IMembershipMemberService.CreateWithIdentity(string username, string email, string passwordValue, string memberTypeAlias)
+ IUser IMembershipMemberService.CreateWithIdentity(string username, string email, string passwordValue, string memberTypeAlias, bool isApproved = true)
{
var userType = GetUserTypeByAlias(memberTypeAlias);
if (userType == null)
@@ -120,8 +120,9 @@ namespace Umbraco.Core.Services
/// Email of the Member to create
/// This value should be the encoded/encrypted/hashed value for the password that will be stored in the database
/// MemberType the Member should be based on
+ /// Optional IsApproved parameter
///
- private IUser CreateUserWithIdentity(string username, string email, string passwordValue, IUserType userType)
+ private IUser CreateUserWithIdentity(string username, string email, string passwordValue, IUserType userType, bool isApproved = true)
{
if (userType == null) throw new ArgumentNullException("userType");
@@ -145,7 +146,7 @@ namespace Umbraco.Core.Services
StartContentId = -1,
StartMediaId = -1,
IsLockedOut = false,
- IsApproved = true
+ IsApproved = isApproved
};
//adding default sections content and media
user.AddAllowedSection("content");
diff --git a/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs b/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs
index 8482eb72a2..71e2b1d0f3 100644
--- a/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs
+++ b/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs
@@ -166,11 +166,11 @@ namespace Umbraco.Web.Security.Providers
username,
email,
FormatPasswordForStorage(encodedPassword, salt),
- memberTypeAlias);
+ memberTypeAlias,
+ isApproved);
member.PasswordQuestion = passwordQuestion;
member.RawPasswordAnswerValue = EncryptString(passwordAnswer);
- member.IsApproved = isApproved;
member.LastLoginDate = DateTime.Now;
member.LastPasswordChangeDate = DateTime.Now;