EFB/Controllers/Form/FormAuthenticator.cs

51 lines
1.3 KiB
C#
Raw Permalink Normal View History

using System.Linq;
2021-10-31 16:36:14 +00:00
namespace EFB.Controllers.Form
{
public static class FormAuthenticator
{
2022-02-28 21:53:28 +00:00
public static bool ValidateEMail(string EMail)
{
2021-11-15 21:22:24 +00:00
if (EMail != null && EMail.Contains("@") && EMail.Contains(".") && !EMail.Contains(" "))
{
if (EMail.Count(x => x == '@') == 1)
{
return true;
}
}
return false;
}
2022-02-28 21:53:28 +00:00
public static bool ValidateEndpoint(string Endpoint)
{
2021-10-03 21:37:17 +00:00
//If it contains http & :// it can be either https or http
if (Endpoint.Contains("http") && Endpoint.Contains("://") && Endpoint.Length > 7)
{
return true;
}
return false;
}
2022-02-28 21:53:28 +00:00
public static bool ValidateICAOCode(string ICAO)
{
2021-10-03 21:37:17 +00:00
if (ICAO.Length == 4)
{
//If the value contains a Number, then the value will return false
return !ICAO.Any(x => char.IsDigit(x));
}
return false;
}
2022-02-28 21:53:28 +00:00
public static bool ValidateCruiseAlt(uint CruiseAlt)
{
2021-10-03 21:37:17 +00:00
if (CruiseAlt > 0 && CruiseAlt < 50000)
{
return true;
}
return false;
}
}
}