public ActionResult Authenticate(string email, string password)
        {
            Account UserAcc = AccountCRUD.UserLogin(email, password);

            if (UserAcc != null)
            {
                Session["UserID"]      = UserAcc.UserID;
                Session["UserName"]    = UserAcc.Username;
                Session["Priviledges"] = UserAcc.AccStatus;
                Session["OrderItems"]  = new List <Tuple <int, int, int> >();

                return(RedirectToAction(UserAcc.AccStatus == "Admin" ? "Console" : "DashBoard", UserAcc.AccStatus));
            }
            else
            {
                return(Content("<script>alert('Incorrect Email or Password.');window.location = 'Login';</script>"));
            }
        }
예제 #2
0
        public ActionResult Authenticate(string uname, string password)
        {
            Account UserAcc = AccountCRUD.UserLogin(uname, password);

            if (UserAcc != null)
            {
                Session["UserID"]   = UserAcc.UserID;
                Session["FullName"] = UserAcc.FullName;
                Session["UserType"] = UserAcc.AccType;
                Session["PrisonID"] = UserAcc.Prison.PrisonID;

                return(RedirectToAction("DashBoard", UserAcc.AccType == "J" ? "Jailer" : "JailO"));
            }
            else
            {
                return(Content("<script>alert('Incorrect Email or Password.');window.location = 'Login';</script>"));
            }
        }