is_proj/src/AuthApp/AuthService.cs
2026-01-21 00:23:28 +03:00

25 lines
639 B
C#

using AuthApp.Data;
using AuthApp.Utils;
/// <summary>
/// Сервис аутентификации
/// </summary>
namespace AuthApp.Services
{
public class AuthService
{
private readonly UserRepository _repository = new();
/// <summary>
/// Проверка логина и пароля
/// </summary>
public bool Authenticate(string login, string password)
{
var user = _repository.GetUser(login);
if (user == null) return false;
string hash = PasswordHasher.Hash(password);
return (user.PasswordHash == hash);
}
}
}