Exemple #1
0
        public ActionResult Index(LogOnPageView logonPageView, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                string Authenticate = _employeeService.Authenticate(logonPageView.LoginName, logonPageView.Password, logonPageView.RememberMe);
                switch (Authenticate)
                {
                case "OK":
                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                        !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                    {
                        return(Redirect(returnUrl));
                    }
                    if (returnUrl == null)
                    {
                        return(Redirect(@"/Saman/Home"));
                    }
                    break;

                case "PasswordInvalid":
                    ModelState.AddModelError("", "کلمه عبور اشتباه است.");
                    return(View(logonPageView));

                case "Discontinued":
                    ModelState.AddModelError("", "کاربر گرامی، حساب شما توسط مدیر غیر فعال شده است.");
                    return(View(logonPageView));

                case "UserNameInvalid":
                    ModelState.AddModelError("", "نام کاربری مورد نظر یافت نشد.");
                    return(View(logonPageView));
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(logonPageView));
        }
Exemple #2
0
        public ActionResult Index()
        {
            LogOnPageView logonPageView = new LogOnPageView();

            return(View(logonPageView));
        }