2020-12-16 21:35:51 +01:00

38 lines
1.1 KiB
C#

using MyCore.Framework.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MyCore.Framework.Business
{
public class ProfileLogic
{
private readonly ILogger<ProfileLogic> _logger;
public ProfileLogic(ILogger<ProfileLogic> logger)
: base()
{
_logger = logger;
}
public bool Authenticate(string email, string password)
{
if (string.IsNullOrWhiteSpace(email))
{
_logger.LogError($"Authenticate error: No e-mail provided");
throw new RequestException(StatusCodes.Status401Unauthorized, "Authentication error");
}
if (string.IsNullOrEmpty(password))
{
_logger.LogError($"Authenticate error: No password provided");
throw new RequestException(StatusCodes.Status401Unauthorized, "Authentication error");
}
return true;
}
}
}