예제 #1
0
 public ActionResult AddCrop()
 {
     BOM.User user = this.Session["user"] as BOM.User;
     if (!user.role.Equals("admin"))
     {
         this.Response.Redirect("/Account/Login");  //session management code
     }
     return View();
 }
예제 #2
0
        public static bool UpdatePassword(BOM.User user, String newpass)
        {
            watershedEntities db = new watershedEntities();

            try
            {
                User us = (from u in db.Users1 where u.email == user.email select u).SingleOrDefault();
                us.password        = newpass;
                us.ConfirmPassword = newpass;
                db.SaveChanges();
                return(true);
            }catch (DbEntityValidationException ex)
            {
                return(false);
            }
        }
예제 #3
0
        public ActionResult UpdatePassword(BOM.User users)
        {
            String smsg = "fail";

            BOM.User u     = DAL.AuthenticationDal.checkEmail(users);
            String   epass = BOL.Encrypted.GetEncrypted(users.password);

            if (u.password.Equals(epass))
            {
                String newpass = this.Request.Form["npassword"].ToString();
                if (BOL.Authentication.ChangePassword(u, newpass))
                {
                    smsg = "success";
                }
            }
            this.ViewData.Add("updatepass", smsg);
            return(View());
        }