コード例 #1
0
        public ActionResult ResetPassword(ResetPasswordModel model)
        {
            try
            {
                ModelServices services = new ModelServices();
                string email = services.GetEmailByUserId(model.UserName);
                if (email != string.Empty && email != null)
                {
                    string token = services.GeneratePasswordResetToken(model.UserName, email);
                    if (ConfigurationManager.AppSettings["systemMode"].ToString() == "debug")
                    {
                        services.EmailPasswordReset(@"*****@*****.**", token, services.GetUserIdByUserName(model.UserName));
                    }
                    else
                    {
                        services.EmailPasswordReset(email, token, services.GetUserIdByUserName(model.UserName));
                    }

                    return RedirectToAction("ResetPwStepTwo");
                }
                else
                {
                    ModelState.AddModelError("UserName", "Username not found");
                    return View();
                }
            }
            catch (Exception ex)
            {
                Logging log = new Logging();
                log.LogException(ex);
                return View("GeneralError");
            }
            //return RedirectToAction("InvalidUserName");
        }