一、Nop.Core.Domain.Customers.PasswordFormat ( enum  ),增加一个 “S256_B64”。

二、Libraries\Nop.Services\Security\EncryptionService.cs 及其接口增加对应方法

#region
/// <returns>返回加密后的字符串</returns>
string str)
   5: {
new System.Security.Cryptography.SHA256Managed();
   7:  
byte[] byte1;
   9:     byte1 = s256.ComputeHash(Encoding.Default.GetBytes(str));
  10:     s256.Clear();
  11:  
return Convert.ToBase64String(byte1);
  13: }
#endregion

三、增加对 “S256_B64”的支持,code中有若干处。

switch (customer.PasswordFormat)
   2:                 {
case PasswordFormat.Encrypted:
   4:                         oldPwd = _encryptionService.EncryptText(request.OldPassword);
break;
case PasswordFormat.Hashed:
   7:                         oldPwd = _encryptionService.CreatePasswordHash(request.OldPassword, customer.PasswordSalt, _customerSettings.HashedPasswordFormat);
break;
#region     这里增加对  “S256_B64”的支持,code中有若干处。
case PasswordFormat.S256_B64:
  11:                         oldPwd = _encryptionService.S256_B64Encrypt(request.OldPassword);
break;
#endregion
default:
  15:                         oldPwd = request.OldPassword;
break;
  17:                 }

四、广谱搜索关键字“PasswordFormat.Hashed”,将其改成想用的加密方法即可。

相关文章:

  • 2022-12-23
  • 2021-08-08
  • 2021-05-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-30
相关资源
相似解决方案