示例#1
0
        public string Login(string login, string password, string company)
        {
            Session.Clear();
            GlobalFunctions glb = new GlobalFunctions();

            if (DomainUtil.IsSubdomain(Request.Url.AbsoluteUri.ToLower()))
            {
                if (login != null && login.Length > 0)
                {
                    var user = userModel.Login(login, password);
                    if (user == null)
                    {
                        return("");
                    }
                    SignIn(user);
                    Session["userName"] = "";
                    Session["userId"]   = user.id;
                    if (user.role_id == 8)
                    {
                        //   return RedirectToAction("Index", "ReporterDashboard");
                        return(Url.Action("Index", "ReporterDashboard"));
                    }
                    return(Url.Action("Index", "Cases"));
                    //    return "Payment/History";

                    //  return RedirectToAction("Index", "Cases");
                }
                //  return RedirectToAction("Company", "Login");
                // AuthHelper.SetCookies(user, HttpContext);
                ///   Session[Constants.CurrentUserMarcker] = user;
            }
            return("");
        }
示例#2
0
        public ActionResult Login(LoginViewModel model, string returnUrl)
        {
            Session.Clear();
            GlobalFunctions glb = new GlobalFunctions();

            if (DomainUtil.IsSubdomain(Request.Url.AbsoluteUri.ToLower()))
            {
                if (!String.IsNullOrEmpty(model.Login))
                {
                    var user = userModel.Login(model.Login, model.Password);
                    if (user == null)
                    {
                        ModelState.AddModelError("PasswordError", "Password");
                        return(View(is_cc ? "Login" : "Login-CC", model));
                    }

                    AuthHelper.SetCookies(user, HttpContext);
                    Session[ECGlobalConstants.CurrentUserMarcker] = user;

                    Session["userName"] = "";
                    Session["userId"]   = user.id;

                    if (user.role_id == ECLevelConstants.level_informant)
                    {
                        return(RedirectToAction("Index", "ReporterDashboard"));
                    }

                    if (returnUrl != null)
                    {
                        return(Redirect(returnUrl));
                    }

                    if (user.last_login_dt == null && user.role_id != ECLevelConstants.level_informant)
                    {
                        return(RedirectToAction("Index", "Settings"));
                    }

                    if (user.role_id == ECLevelConstants.level_escalation_mediator)
                    {
                        return(RedirectToAction("Index", "Cases", new { mode = "completed" }));
                    }

                    return(RedirectToAction("Index", "Cases"));
                }
            }

            ModelState.AddModelError("PasswordError", "Password");
            model.Password = "";

            return(View(is_cc ? "Login" : "Login-CC", model));
        }
示例#3
0
        public ActionResult Index(string loginField, string loginPass)
        {
            #region EC-CC Viewbag
            ViewBag.is_cc = is_cc;
            string cc_ext = "";
            if (is_cc)
            {
                cc_ext = "_cc";
            }
            ViewBag.cc_extension = cc_ext;
            #endregion

            Session.Clear();
            GlobalFunctions glb = new GlobalFunctions();

            if (DomainUtil.IsSubdomain(Request.Url.AbsoluteUri.ToLower()))
            {
                if (loginField != null && loginField.Length > 0)
                {
                    var user = userModel.Login(loginField, loginPass);
                    SignIn(user);
                    Session["userName"] = "";
                    Session["userId"]   = user.id;
                    if (user.role_id == 8)
                    {
                        //   return RedirectToAction("Index", "ReporterDashboard");
                        return(Redirect("~/ReporterDashboard"));
                    }
                    //  return Redirect("~/EmployeeAwareness/Index");
                    //   return Redirect("~/Payment");
                    //   return RedirectToAction("NewPayment", "Payment");

                    return(RedirectToAction("Index", "Cases"));
                }
                return(RedirectToAction("Company", "Login"));
            }
            else
            {
                ViewBag.login = loginField;
                ViewBag.pass  = loginPass;
                return(View());
            }
        }