Add remaining project files

This commit is contained in:
Marco Baldwin
2026-07-23 18:21:43 -07:00
parent c12d8ac35d
commit 6e15e89a9d
453 changed files with 64265 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Identity;
using System.Numerics;
using DeluxeBackend.Models;
namespace DeluxeBackend.Services
{
public interface IPasswordService
{
void setPassword(Account player, string password);
PasswordVerificationResult VerifyPassword(Account player, string passowrd);
}
public class PasswordService : IPasswordService
{
private readonly ILiteDbService db;
private readonly PasswordHasher<Account> _hasher = new PasswordHasher<Account>();
public PasswordService(ILiteDbService _db)
{
db = _db;
}
public void setPassword(Account player, string password)
{
player.PasswordHash = _hasher.HashPassword(player, password);
db.Accounts.Update(player);
}
public PasswordVerificationResult VerifyPassword(Account player, string passowrd)
{
if (player.PasswordHash == null)
{
return PasswordVerificationResult.Failed;
}
return _hasher.VerifyHashedPassword(player, player.PasswordHash, passowrd);
}
}
}