mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-18 17:47:54 +08:00
Removing NotImplementedException in MembershipService by using the new EncryptionService
--HG-- branch : dev
This commit is contained in:
@@ -20,11 +20,13 @@ namespace Orchard.Users.Services {
|
||||
private readonly IOrchardServices _orchardServices;
|
||||
private readonly IMessageManager _messageManager;
|
||||
private readonly IEnumerable<IUserEventHandler> _userEventHandlers;
|
||||
private readonly IEncryptionService _encryptionService;
|
||||
|
||||
public MembershipService(IOrchardServices orchardServices, IMessageManager messageManager, IEnumerable<IUserEventHandler> userEventHandlers, IClock clock) {
|
||||
public MembershipService(IOrchardServices orchardServices, IMessageManager messageManager, IEnumerable<IUserEventHandler> userEventHandlers, IClock clock, IEncryptionService encryptionService) {
|
||||
_orchardServices = orchardServices;
|
||||
_messageManager = messageManager;
|
||||
_userEventHandlers = userEventHandlers;
|
||||
_encryptionService = encryptionService;
|
||||
Logger = NullLogger.Instance;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
@@ -208,13 +210,13 @@ namespace Orchard.Users.Services {
|
||||
return partRecord.Password == Convert.ToBase64String(hashBytes);
|
||||
}
|
||||
|
||||
private static void SetPasswordEncrypted(UserPartRecord partRecord, string password) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private static bool ValidatePasswordEncrypted(UserPartRecord partRecord, string password) {
|
||||
throw new NotImplementedException();
|
||||
private void SetPasswordEncrypted(UserPartRecord partRecord, string password) {
|
||||
partRecord.Password = Convert.ToBase64String(_encryptionService.Encode(Encoding.UTF8.GetBytes(password)));
|
||||
partRecord.PasswordSalt = null;
|
||||
}
|
||||
|
||||
private bool ValidatePasswordEncrypted(UserPartRecord partRecord, string password) {
|
||||
return String.Equals(password, Encoding.UTF8.GetString(_encryptionService.Decode(Convert.FromBase64String(partRecord.Password))), StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user