Exemplo n.º 1
0
        public async Task <IActionResult> ValidateEmailAddress(string emailAddress)
        {
            string validDomain       = $"{ _emailSender.GetDoamin() }";
            string userEnteredDomain = emailAddress.Split('@')[1].ToLower();

            if (userEnteredDomain != validDomain)
            {
                return(Json($"Only { validDomain } email addresses are allowed"));
            }

            Employee employee = await _userManager.FindByEmailAsync(emailAddress);

            if (employee != null)
            {
                return(Json("Email address already in use"));
            }

            return(Json(true));
        }