You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
995 B

using APP.Models;
using BWPMModels;
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace APP.Identity
{
public class PasswordHasherOverride<TUser> : PasswordHasher<TUser> where TUser : AppUser
{
public override PasswordVerificationResult VerifyHashedPassword(TUser user, string hashedPassword, string providedPassword)
{
if (hashedPassword == null) { throw new ArgumentNullException(nameof(hashedPassword)); }
if (providedPassword == null) { throw new ArgumentNullException(nameof(providedPassword)); }
var hashedProvidedPassword = Utils.Utils.GetMd5x2(providedPassword);
if (hashedPassword != hashedProvidedPassword)
{
return PasswordVerificationResult.Failed;
}
else
{
return PasswordVerificationResult.Success;
}
}
}
}