Removing NotImplementedException in MembershipService by using the new EncryptionService

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-12-10 17:04:40 -08:00
parent a5bd539b18
commit 83e2b84688

View File

@@ -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);
}
}
}