Beispiel #1
0
 public static void InvalidateCode(ComputedValueVerifier verifier, SystemPlatform plateForm, string uniqueKey, string code)
 {
     RedisHelper.StringSet(RedisDBIndex, verifier.GetBeUsedKey(plateForm, uniqueKey, code), "1", TimeSpan.FromMinutes(verifier.GetExpireTime()));
 }
Beispiel #2
0
        ///// <summary>
        ///// 使验证码无效
        ///// </summary>
        ///// <typeparam name="T">验证类</typeparam>
        ///// <param name="plateForm">系统</param>
        ///// <param name="business">业务</param>
        ///// <param name="uniqueKey">唯一标志</param>
        ///// <param name="code">验证码,计算类型的验证类必传</param>
        //public static void InvalidateCode<T>(SystemPlatform plateForm, FiiipayBusiness business, string uniqueKey, string code) where T : AbstractVerifier, new()
        //{
        //    var verifier = new T();
        //    InvalidateCode(verifier, plateForm, business, uniqueKey, code);
        //}

        /// <summary>
        /// 检查验证码是否有效(已经成功验证则无效)
        /// </summary>
        /// <param name="plateForm">系统</param>
        /// <param name="uniqueKey">唯一标志</param>
        /// <param name="code">验证码,计算类型的验证类必传</param>
        /// <returns></returns>
        public static bool CheckCodeValid(ComputedValueVerifier verifier, SystemPlatform plateForm, string uniqueKey, string code)
        {
            string invalidCodeKey = verifier.GetBeUsedKey(plateForm, uniqueKey, code);

            return(!RedisHelper.KeyExists(RedisDBIndex, invalidCodeKey));
        }