Exemplo n.º 1
0
        public void Add(
            string id,
            string userName,
            string loginName,
            string password,
            string connString,
            string ket,
            string description)
        {
            UserEntity entity = new UserEntity()
            {
                Id           = id,
                UserName     = userName,
                LoginName    = loginName,
                PasswordSalt = ToolsCommon.CreateVerifyCode(5)
            };

            entity.PasswordHash = ToolsCommon.MD5Encrypt(password + entity.PasswordSalt);
            entity.ConnString   = ToolsCommon.ToBase64(connString);
            entity.Ket          = ket;
            entity.Description  = description;
            entity.CreateDate   = DateTime.Now;
            using (O2OContext db = new O2OContext())
                new BaseService <UserEntity>(db).Add(entity);
        }
Exemplo n.º 2
0
        public ActionResult GetVerCode()
        {
            //利用CaptchaGen验证码组件,用法参照文档,先通过Nuget安装组件 Install-PackAge CaptchaGen
            //1:获取验证码文字
            var VerNum = ToolsCommon.CreateVerifyCode(4);

            TempData["code"] = VerNum;                                            //保存到Sesion里面,使用过一次后就自动清除,这就是TempData的用法
            MemoryStream ms = ImageFactory.GenerateImage(VerNum, 60, 100, 20, 6); //此处不能用using语法

            return(File(ms, "image/jpeg"));
        }