mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Refactoring a csproj file compiler/build provider
* Removed unused "ServiceLocator" class * Added "OrchardHostContainerRegistry" class to enable Shim/HostContainer registration for DI * Refactored the BuildProvider for .csproj file to use the new OrchardHostContainerRegistry class and enable proper DI for implementations. --HG-- branch : dev
This commit is contained in:
@@ -270,46 +270,4 @@ namespace Orchard.Users.Controllers {
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public interface IMembershipServiceShim {
|
||||
int MinPasswordLength { get; }
|
||||
|
||||
bool ValidateUser(string userName, string password);
|
||||
MembershipCreateStatus CreateUser(string userName, string password, string email);
|
||||
bool ChangePassword(string userName, string oldPassword, string newPassword);
|
||||
}
|
||||
|
||||
public class AccountMembershipService : IMembershipServiceShim {
|
||||
private readonly MembershipProvider _provider;
|
||||
|
||||
public AccountMembershipService()
|
||||
: this(null) { }
|
||||
|
||||
public AccountMembershipService(MembershipProvider provider) {
|
||||
_provider = provider ?? Membership.Provider;
|
||||
}
|
||||
|
||||
#region IMembershipService Members
|
||||
|
||||
public int MinPasswordLength {
|
||||
get { return _provider.MinRequiredPasswordLength; }
|
||||
}
|
||||
|
||||
public bool ValidateUser(string userName, string password) {
|
||||
return _provider.ValidateUser(userName, password);
|
||||
}
|
||||
|
||||
public MembershipCreateStatus CreateUser(string userName, string password, string email) {
|
||||
MembershipCreateStatus status;
|
||||
_provider.CreateUser(userName, password, email, null, null, true, null, out status);
|
||||
return status;
|
||||
}
|
||||
|
||||
public bool ChangePassword(string userName, string oldPassword, string newPassword) {
|
||||
var currentUser = _provider.GetUser(userName, true /* userIsOnline */);
|
||||
return currentUser.ChangePassword(oldPassword, newPassword);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user