示例#1
0
        public ActionResult lostPassword(recoveryPassword model)
        {
            mycontext check  = new mycontext();
            ModelUser ch     = new ModelUser();
            var       Echeck = check.users.FirstOrDefault(m => m.email == model.email);

            if (model.email != null)
            {
                if (Echeck == null)
                {
                    model.email_error = "کاربری با این ایمیل در سامانه وجود ندارد";
                }
                else
                {
                    model.email_error = null;
                }
            }
            else
            {
                model.email_error = "لطفا ایمیل خود را وارد نمایید";
            }



            if (model.code == null)
            {
                model.code_error = "(پوشه اسپم را نیز چک نمایید)" + "لطفا کد ارسال شده به ایمیل خود را وارد نمایید";
            }
            else if (model.code != "123456")
            {
                model.code_error = "کد وارد شده نامعتبر است";
            }
            else
            {
                model.code_error = null;
            }

            if (model.newpassword != null)
            {
                ch.password             = model.newpassword;
                ch                      = filter.Cheker(ch);
                model.newpassword_error = ch.password_error;
            }
            else
            {
                model.newpassword_error = "لطفا یک گذر واژه انتخاب نمایید";
            }
            if (model.newpassword_error == null & model.code_error == null & model.email_error == null)
            {
                log relog = new log();
                Echeck.Password = model.newpassword;
                check.SaveChanges();
                relog._UserName = Echeck.UserName;
                relog._password = model.newpassword;
                relog.url       = Url.Action("index", "home");
                return(View("login", relog));
            }


            return(View(model));
        }
示例#2
0
        public ActionResult lostPassword()
        {
            recoveryPassword model = new recoveryPassword();

            return(View(model));
        }