public ActionResult LoginCustomer(OTPDto otpDto) { var reponseCode = _iCustomerHelper.ValidateCustomerCredentials(otpDto); switch (reponseCode) { case 0: ViewBag.Incorrectlogin = "******"; break; case 1: ViewBag.Incorrectlogin = "******"; break; case 2: ViewBag.Incorrectlogin = "******"; break; case 3: ViewBag.Incorrectlogin = "******"; break; case 4: _iClaimHelper.UpdateOtpToExpire(otpDto.CustomerId); return(RedirectToAction("GetUploadDocumentForCustomer", new { cuId = Encryption.Encrypt(Convert.ToString(otpDto.CustomerId), true) })); } return(View("Index", otpDto)); }
public bool SaveOtp(int userId, out string uniqueString) { #region Prepare OTP Data uniqueString = AppUtil.GetUniqueGuidString(); string otpString = AppUtil.GetUniqueRandomNumber(100000, 999999); // Generate a Six Digit OTP _ = new OTPDto { Guid = uniqueString, Otp = otpString, CreatedDate = DateTime.Now, UserId = userId, Attempts = 0 }; //return SecurityBusinessInstance.SaveOTP(objOTP); #endregion return(true); }
public int ValidateCustomerCredentials(OTPDto otpDto) { var claim = _unitOfWork.ClaimRepository.GetFirst(cr => cr.CustId == otpDto.CustomerId); if (claim != null) { var lastFourDigit = claim.CardNo.Length > 4 ? claim.CardNo.Substring(claim.CardNo.Length - 4, 4):""; if (lastFourDigit != otpDto.LastFourDigit.Trim()) { // invalid card number return(1); } else { var otp = _unitOfWork.OTPRepository.GetFirst( otr => otr.CustId == otpDto.CustomerId && otr.ExpireTime >= DateTime.Now && otr.IsUsed == false); if (otp != null) { if (otp.OTP1 != otpDto.OTP) { // invalid otp return(2); } } else { // Otp is expire return(3); } // valid otp return(4); } } return(0); }
public async Task <bool> SaveOtpAsync(OTPDto otp) { var otpmaster = _mapper.Map <OTPDto, OtpMaster>(otp); return(await _securityRepository.SaveOtpAsync(otpmaster)); }