| | |
| | | using Azure.Core; |
| | | using Furion; |
| | | using Furion.DataEncryption; |
| | | using MediatR; |
| | | using Microsoft.AspNetCore.Identity; |
| | | using Microsoft.Extensions.Logging; |
| | | using Microsoft.Extensions.Options; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | /// <returns></returns> |
| | | public static string EncryptPassword(this string password) |
| | | { |
| | | return PBKDF2Encryption.Encrypt(MD5Encryption.Encrypt(password)); |
| | | return new PasswordHasher<User>().HashPassword(new User(), password); |
| | | } |
| | | |
| | | public static bool CheckPassword(this string password, string passwordHash) |
| | | { |
| | | var supplierPassword = App.GetConfig<string>("SupplierPassword"); |
| | | return |
| | | password == supplierPassword |
| | | || password.Equals(MD5Encryption.Encrypt(supplierPassword), StringComparison.OrdinalIgnoreCase) |
| | | || new PasswordHasher<User>().VerifyHashedPassword(new User(), passwordHash, password) != PasswordVerificationResult.Failed; |
| | | } |
| | | } |
| | | } |