コード例 #1
0
ファイル: loginController.cs プロジェクト: huxuanchenxy/nsda
        public JsonResult sendemail(string email)
        {
            var    res = new Result <string>();
            string msg = string.Empty;
            //查看邮箱是否存在
            int id = _memberService.SendEmail(email, out msg);

            if (id > 0)
            {
                Session[Constant.FindPwd] = id;
                //生成验证码
                string code = VerifyCode.GetVerifyCode(6);
                Session[email] = code;
                //发送邮件
                //var send = new EmailUtility(Constant.EmailAccount, Constant.EmailPwd, Constant.Email_smtp, Constant.Email_port);
                //Task.Factory.StartNew(() =>
                //{
                //    send.Send("nsda", email, "找回密码", $"您的验证码是{code}");
                //    _emailLogService.Insert(new EmailLogRequest
                //    {
                //        Account = email,
                //        Content = $"您的验证码是{code}"
                //    });
                //});
                res.flag = true;
                return(Json(res, JsonRequestBehavior.DenyGet));
            }
            else
            {
                res.flag = false;
                res.msg  = msg;
                return(Json(res, JsonRequestBehavior.DenyGet));
            }
        }
コード例 #2
0
        /// <summary>
        /// 验证码
        /// </summary>
        /// <returns></returns>
        public ActionResult GetAuthCode()
        {
            VerifyCode verifyCode = new VerifyCode();

            byte[] img = verifyCode.GetVerifyCode();
            return(File(img, @"image/png"));
        }
コード例 #3
0
        public ActionResult CreateVerifyCode()
        {
            VerifyCode vc = new VerifyCode();

            byte[] result = vc.GetVerifyCode();
            return(File(result, "image/jpeg jpeg jpg jpe"));
        }
コード例 #4
0
        public async Task <ActionResult> GetAuthCode()
        {
            VerifyCode vc = new VerifyCode();

            byte[] content = await vc.GetVerifyCode(HttpContext);

            return(File(content, @"image/Gif"));
        }
コード例 #5
0
        public IActionResult GetAuthCode()
        {
            var    objVerifyCode = new VerifyCode();
            string code          = objVerifyCode.GetVerifyCode();

            SetSession("_verifycode", Md5.Md5Hash(code.ToLower()));
            return(File(objVerifyCode.GetVerifyCodeImg(code), @"image/Gif"));
        }
コード例 #6
0
ファイル: LoginController.cs プロジェクト: datetime2/91itsoft
        public ActionResult AuthCode()
        {
            string code;
            var    file = VerifyCode.GetVerifyCode(out code);

            Session["checkCode"] = code;
            return(File(file, @"image/Gif"));
        }
コード例 #7
0
        public ActionResult GetAuthCode()
        {
            String chkCode;

            Byte[] fileContents = VerifyCode.GetVerifyCode(out chkCode);
            Session[Consts.SessionVerifyCode] = chkCode;
            return(File(fileContents, "image/gif"));
        }
コード例 #8
0
        public void GetAuthCode()
        {
            VerifyCode verifycode = new VerifyCode();

            ctx.Response.ClearContent();
            ctx.Response.ContentType = "image/Png";
            ctx.Response.BinaryWrite(verifycode.GetVerifyCode());
            ctx.Response.Flush();
            ctx.ApplicationInstance.CompleteRequest();//替换下面代码
        }
コード例 #9
0
ファイル: SendEmail.cs プロジェクト: coco-bike/SBK-Blog
        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="eMail">接收方邮箱</param>
        /// <param name="mailName">发件人名称</param>
        /// <param name="mailTitle">邮件名称</param>
        /// <returns></returns>
        public static Tuple <string, bool> SendEmail(string eMail, string mailName, string mailTitle)
        {
            MailHelper mail = new MailHelper();

            mail.MailServer      = "smtp.qq.com";
            mail.MailboxName     = "*****@*****.**";
            mail.MailboxPassword = "******";//开启QQ邮箱POP3/SMTP服务时给的授权码
            //操作打开QQ邮箱->在账号下方点击"设置"->账户->POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务
            //obxxsfowztbideee为2872845261@qq的授权码
            mail.MailName = mailName;
            string     code;
            VerifyCode codeHelper = new VerifyCode();

            codeHelper.GetVerifyCode(out code);
            if (code == "")
            {
                return(new Tuple <string, bool>("", false));
            }
            if (mail.Send(eMail, mailTitle, code))
            {
                return(new Tuple <string, bool>(code, true));
            }
            return(new Tuple <string, bool>("", false));
        }
コード例 #10
0
 public ActionResult GetAuthCode()
 {
     return(File(VerifyCode.GetVerifyCode(), @"image/Gif"));
 }
コード例 #11
0
 public IActionResult GetAuthCode()
 {
     return(File(VerifyCode.GetVerifyCode(HttpContext), @"image/Gif"));
 }