Esempio n. 1
0
        public bool ValidateOtp(string email, string otp, string refNumber)
        {
            OtpEntity otpValidate = _otpRepository.GetOtpByEmail(email);

            if (otpValidate == null || (otpValidate.Otp != otp || otpValidate.Reference != refNumber))
            {
                return(false);
            }
            _otpRepository.Delete(otpValidate);
            if (otpValidate.CreateDateTime > DateTime.UtcNow.AddMinutes(-15))
            {
                return(true);
            }
            return(false);
        }
 public bool SaveOtp(string email, string refOtp, string otpNumber)
 {
     try
     {
         OtpEntity entity = new OtpEntity()
         {
             Email     = email,
             Reference = refOtp,
             Otp       = otpNumber
         };
         _context.Add(entity);
         _context.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
 public void Delete(OtpEntity entity)
 {
     _context.Otps.Remove(entity);
     _context.SaveChanges();
 }