Esempio n. 1
0
        public static void AddVerificationCode(string email, string code)
        {
            foreach (var item in VerificationDict.Where(kvp => kvp.Value.TimeStamp < DateTime.Now.AddMinutes(-verificationCodeTimeLimit)).ToList())
            {
                VerificationDict.Remove(item.Key);
            }

            VerificationDict[email] = new TimedCode(code);
        }
Esempio n. 2
0
        public static void AddTimedCode(string userg)
        {
            var tc = GetMostRecentCode(userg);

            if (tc == null)
            {
                tc = new TimedCode(userg);
                PresentationCode.Add(tc);
            }
            else
            {
                tc.TimeStamp = DateTime.Now;
            }
        }
Esempio n. 3
0
        public static bool TryGetVerificationCode(string email, out string code)
        {
            code = null;
            TimedCode vcode = null;

            if (VerificationDict.TryGetValue(email, out vcode))
            {
                if (vcode.TimeStamp > DateTime.Now.AddMinutes(-verificationCodeTimeLimit))
                {
                    code = vcode.Code;
                    return(true);
                }
            }
            return(false);
        }