Esempio n. 1
0
 IResult Login_GET()
 {
     IResult result;
     if (HttpContext.Current.Request.QueryString["e"] != null)
     {
         dynamic view = new LoginView();
         view.InvalidPwd = "Invalid Login";
         view.Email = string.Empty;
         result = presenter.GetViewHTML("login.htm", view);
     }
     else
     {
         result = presenter.GetViewHTML("login.htm");
     }
     return result;
 }
Esempio n. 2
0
        IResult Login_POST()
        {
            IResult result = new Result();
            HttpRequest httpRequest = HttpContext.Current.Request;
            string redirectURL = string.Empty;
            if (httpRequest.QueryString["r"] != null)
                redirectURL = httpRequest.QueryString["r"];

            dynamic view = new LoginView();
            presenter.SetViewModel(view);
            long userId;
            if (WebNote.DB.Business.WebNoteBiz.IsValidPassword(view.Email, view.Password,out userId))
            {
                User.Id = userId;
                User.Email = view.Email;
                if (redirectURL != string.Empty)
                {
                    HttpContext.Current.Session["activeMI"] = "public_notes";
                    result.Success = true;
                    HttpContext.Current.Response.Redirect(AppData.GetBaseUrl() + redirectURL);
                }
                else
                {
                    HttpContext.Current.Session["activeMI"] = "public_notes";
                    result.Success = true;
                    HttpContext.Current.Response.Redirect(AppData.GetBaseUrl() + redirectURL);
                }
            }
            else //invalid login
            {
                result.Success = false;
                HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.AbsolutePath + "/security/login/?r=" + redirectURL + "&e=il", false);
            }

            return result;
        }