コード例 #1
0
        public string GenegeToken(SecurityMethod securityMethod)
        {
            var    token    = RandomAlphaNumericGenerator.Generate(16);
            string tokenKey = $"{Platform}:{securityMethod.ToString()}:{SecurityMethod.TempToken.ToString()}:{token}";

            RedisHelper.StringSet(tokenKey, token, TimeSpan.FromMinutes(Constant.TEMPTOKEN_EXPIRED_TIME));
            return(token);
        }
コード例 #2
0
        public FileResult ShowImage(string gid)
        {
            byte[] thumb = null;
            string code  = RandomAlphaNumericGenerator.Generate(4);

            try
            {
                thumb = new VerificationCode().CreateImageCode(code);
                RedisHelper.StringSet(gid, code, new TimeSpan(0, 5, 0));
            }
            catch (Exception)
            {
                thumb = System.IO.File.ReadAllBytes(Server.MapPath("~/Content/Images/NoFileFound.png"));
            }
            return(File(thumb, "image/jpg"));
        }
コード例 #3
0
        public OpenAccount Create(int platform, FiiiType fiiiType, Guid accountId)
        {
            OpenAccount account = new OpenAccount
            {
                CreateTime = DateTime.UtcNow,
                PlatformId = platform,
                FiiiType   = fiiiType,
                OpenId     = Guid.NewGuid(),
                SecretKey  = RandomAlphaNumericGenerator.Generate(32),
                AccountId  = accountId
            };

            long id = new OpenAccountDAC().Create(account);

            account.Id = id;

            return(account);
        }