mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 01:57:55 +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 IOrchardServices _orchardServices;
|
||||||
private readonly IMessageManager _messageManager;
|
private readonly IMessageManager _messageManager;
|
||||||
private readonly IEnumerable<IUserEventHandler> _userEventHandlers;
|
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;
|
_orchardServices = orchardServices;
|
||||||
_messageManager = messageManager;
|
_messageManager = messageManager;
|
||||||
_userEventHandlers = userEventHandlers;
|
_userEventHandlers = userEventHandlers;
|
||||||
|
_encryptionService = encryptionService;
|
||||||
Logger = NullLogger.Instance;
|
Logger = NullLogger.Instance;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
@@ -208,13 +210,13 @@ namespace Orchard.Users.Services {
|
|||||||
return partRecord.Password == Convert.ToBase64String(hashBytes);
|
return partRecord.Password == Convert.ToBase64String(hashBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetPasswordEncrypted(UserPartRecord partRecord, string password) {
|
private void SetPasswordEncrypted(UserPartRecord partRecord, string password) {
|
||||||
throw new NotImplementedException();
|
partRecord.Password = Convert.ToBase64String(_encryptionService.Encode(Encoding.UTF8.GetBytes(password)));
|
||||||
|
partRecord.PasswordSalt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ValidatePasswordEncrypted(UserPartRecord partRecord, string password) {
|
private bool ValidatePasswordEncrypted(UserPartRecord partRecord, string password) {
|
||||||
throw new NotImplementedException();
|
return String.Equals(password, Encoding.UTF8.GetString(_encryptionService.Decode(Convert.FromBase64String(partRecord.Password))), StringComparison.Ordinal);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user