Example #1
0
 public MobileSMSValidate(int verifyCodeLen = 6)
 {
     verifyLen = verifyCodeLen;
     _session  = new SessionRepository();
     if (verifyMode == null)
     {
         verifyMode = InitMobileVerifyMode();
     }
 }
Example #2
0
        private MobileVerifyMode InitMobileVerifyMode(string phoneNumber = "")
        {
            var now = DateTime.Now;
            var mobileVerifyMode = new MobileVerifyMode
            {
                PhoneNumber       = phoneNumber,
                SMSVerifyNumber   = Rand.CreatePhoneCode(verifyLen),
                InitSMSVerifyTime = now,
                LastSendTime      = now.AddMinutes(-RANGE),
                FailNumber        = -1,
                RequestIP         = WebHelper.GetClientIP()
            };

            _session.Set(smsVerifySessionKey, mobileVerifyMode, ableMinutes);
            return(mobileVerifyMode);
        }
Example #3
0
 private MobileVerifyMode InitMobileVerifyMode(string phoneNumber = "")
 {
     var now = DateTime.Now;
     var mobileVerifyMode = new MobileVerifyMode
     {
         PhoneNumber = phoneNumber,
         SMSVerifyNumber = Rand.CreatePhoneCode(verifyLen),
         InitSMSVerifyTime = now,
         LastSendTime = now.AddMinutes(-RANGE),
         FailNumber = -1,
         RequestIP = WebHelper.GetClientIP()
     };
     _session.Set(smsVerifySessionKey, mobileVerifyMode, ableMinutes);
     return mobileVerifyMode;
 }