예제 #1
0
        public bool SendVerificationCode(string email)
        {
            Console.WriteLine("SendVerificationCode");
            if (DateTime.Now.Subtract(lastCodeSent).TotalMinutes < 1)
            {
                return(false);
            }
            var validEmail = access.IsValidEmail(email);

            if (!validEmail.Item1)
            {
                throw new FaultException(validEmail.Item2);
            }
            verifCode = access.GenerateVerificationCode();
            for (int i = 0; i < 5; i++)
            {
                if (access.SendVerificationCode(email, verifCode))
                {
                    lastCodeSent = DateTime.Now;
                    return(true);
                }
            }
            return(false);
        }