コード例 #1
0
        //[ValidateAntiForgeryToken]
        public ActionResult Password(EmailViewModel model)
        {
            String msg = "";

            if (ModelState.IsValid)
            {
                String Code  = Guid.NewGuid().ToString();
                String email = model.Email.Trim();
                msg = userregistrationData.ChangePasswordCode(email, Code);
                if (msg == "")
                {
                    msg = emailalert.SendPasscodeChangeEmail(email, Code);
                    if (msg == "")
                    {
                        TempData["IsValid"] = "Email has been sent. Please reset your account password, Thank you!";
                    }
                    else
                    {
                        TempData["IsValid"] = "There was an issue in sending an email, error: " + msg;
                    }
                }
                else
                {
                    TempData["IsValid"] = msg;
                }
                return(RedirectToAction("Password", "UserAccount"));
            }
            return(View(model));
        }