コード例 #1
0
ファイル: UserController.cs プロジェクト: NadirHasimov/Exam
        public ActionResult SignIn(string username, string password, string ReturnUrl)
        {
            username = username.Contains("@") ? username : username + "@ady.az";
            bool   result       = false;
            string login_status = "invalid";

            if (!ModelState.IsValid)
            {
                return(View());
            }
            ReturnUrl = String.IsNullOrEmpty(ReturnUrl) ? Url.Action("Index", "Candidate") : ReturnUrl;
            int userType = UserDALC.GetUserType(username, password);

            if (userType == 1) //Active Directory
            {
                result = UserDALC.SigInActiveDirectory(username, password);
            }
            else if (userType == 3) // local user (valid)
            {
                result = true;
            }
            if (result)
            {
                FormsAuthentication.SetAuthCookie(username, false);
                login_status = "success";
            }
            UserDALC.AddLog(HttpContext, result, result ? "Success" : "Error");
            return(Json(new { login_status = login_status, redirect_url = ReturnUrl }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
ファイル: UserController.cs プロジェクト: NadirHasimov/Exam
        public ActionResult LogInExam(string finCode)
        {
            string login_status = "invalid";
            bool   result       = UserDALC.CheckFinCode(finCode);

            if (result)
            {
                login_status = "success";
                FormsAuthentication.SetAuthCookie(finCode, false);
            }
            UserDALC.AddLog(HttpContext, result, result ? "Success" : "Error");
            return(Json(new { login_status = login_status, redirect_url = Url.Action("Agreement", "Exam", new { finCode = finCode }), JsonRequestBehavior.AllowGet }));
        }
コード例 #3
0
ファイル: UserController.cs プロジェクト: NadirHasimov/Exam
        // GET: User
        public ActionResult SignIn()
        {
            string urlReferer;

            if (Request.UrlReferrer != null)
            {
                urlReferer = Request.UrlReferrer.LocalPath;
                if (urlReferer.Contains("/Exam/Agreement"))
                {
                    string finCode = HttpUtility.ParseQueryString(Request.UrlReferrer.Query)["finCode"];
                    UserDALC.AddLog(HttpContext, true, "Razı deyiləm", finCode);
                }
            }
            FormsAuthentication.SignOut();
            return(View());
        }
コード例 #4
0
ファイル: Log.cs プロジェクト: NadirHasimov/Exam
 public override void OnActionExecuted(ActionExecutedContext filterContext)
 {
     UserDALC.AddLog(filterContext.HttpContext, true, "");
     base.OnActionExecuted(filterContext);
 }