示例#1
0
 public ActionResult ChangePSD(Forgot_Password fp)
 {
     try
     {
         if (true)
         {
             if (fp.Password == fp.ConfirmPassword)
             {
                 if (db.PA_MOB_CUST_SIGHN_UP.AsEnumerable().Where(x => x.CUST_ID == fp.CUST_ID).Count() > 0)
                 {
                     PA_MOB_CUST_SIGHN_UP cfs = db.PA_MOB_CUST_SIGHN_UP.AsEnumerable().Where(x => x.CUST_ID == fp.CUST_ID).SingleOrDefault();
                     cfs.PASSWORD        = EncryptDecrypt.Encrypt(fp.Password);
                     db.Entry(cfs).State = EntityState.Modified;
                     db.SaveChanges();
                 }
                 ViewBag.msg = "Password Succefully Changed .";
             }
             return(View("Change_Password"));
         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
示例#2
0
        public ActionResult Change_Password(string M_NO, string CUST_ID, string Date, string Tm)
        {
            int customer_id = Convert.ToInt32(CUST_ID);

            TimeSpan time      = TimeSpan.Parse(Tm);
            DateTime f_time    = DateTime.ParseExact(Date, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DateTime f_time112 = f_time + time;

            DateTime d1  = new DateTime(f_time112.Year, f_time112.Month, f_time112.Day, f_time112.Hour, f_time112.Minute, f_time112.Second);
            DateTime d2  = d1.AddHours(2);
            DateTime d3  = DateTime.Now;
            int      res = DateTime.Compare(d2, d3);

            if (res > 0)
            {
                Forgot_Password fp = new Forgot_Password();
                fp.M_NO    = M_NO;
                fp.CUST_ID = customer_id;
                return(View(fp));
            }
            else
            {
                return(RedirectToAction("Expired", "Home", new { err = "Sorry Link Validity Has Been Expired" }));
            }
        }
        public void ResetPasswordEmptyEmail()
        {
            Forgot_Password ForgotView = new Forgot_Password();

            ForgotView.ForgotPassword("");
            Assert.IsFalse(Browser.Instance.IsElementPresent(By.CssSelector("div.contained div.subtitle")));
        }
        public void ResetPasswordSuccesfully()
        {
            Forgot_Password ForgotView = new Forgot_Password();

            ForgotView.ForgotPassword(ConfigUtil.GetString("Marquee.user.general"));
            Assert.IsTrue(Browser.Instance.IsTextPresent(By.CssSelector("div.contained div.subtitle"), "Reset link sent!"));
        }
        public void ResetPasswordNotRegisteredEmail()
        {
            Forgot_Password ForgotView = new Forgot_Password();

            ForgotView.ForgotPassword("*****@*****.**");
            Browser.Instance.Wait(By.CssSelector("p.error"));
            Assert.IsTrue(Browser.Instance.IsTextPresent(By.CssSelector("p.error"), "We don't seem to have that email on file!"));
        }
        public void ResetPasswordEmailInvalid()
        {
            Forgot_Password ForgotView = new Forgot_Password();

            ForgotView.ForgotPassword("emaiinvalid.com");
            //Can not make the assert until this bug were resovled
            //Assert.IsTrue(Browser.Instance.IsTextPresent(By.CssSelector("div.contained div.subtitle"), "Reset link sent!"));
        }