Example #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            Models.Chatter user = new Models.Chatter()
            {
                Email    = txtEmailSI.Text.Trim(),
                Password = txtPasswordSI.Text.Trim()
            };
            if (user.IsAuthenticated)
            {
                user = new Models.Data().Chatters.Where(x => x.Email == user.Email).First();
                //FormsAuthentication.SetAuthCookie(user.Email, true);

                FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, user.Email, DateTime.UtcNow, DateTime.UtcNow.AddYears(1), true, user.ChatterId.ToString());

                HttpCookie authCookie = new HttpCookie("ch_us_dt", FormsAuthentication.Encrypt(ticket));
                HttpCookie idCookie   = new HttpCookie("ch_us_id")
                {
                    Value = user.ChatterId.ToString()
                };
                Response.Cookies.Add(authCookie);
                Response.Cookies.Add(idCookie);
                FormsAuthentication.RedirectFromLoginPage(user.Email, true);
            }
            else
            {
                loginErrror.Visible = true;
            }
        }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["ch_us_id"] == null || string.IsNullOrWhiteSpace(Request.Cookies["ch_us_id"].Value))
     {
         Response.Redirect("/App/Account/Signin");
     }
     else
     {
         var chatter = new Models.Chatter().Get(Convert.ToInt64(Request.Cookies["ch_us_id"].Value)).Data;
         if (chatter == null)
         {
             Response.Redirect("/App/Account/Signin");
         }
     }
 }
Example #3
0
 public HttpResponseMessage Register([FromBody] Models.Chatter chatter)
 {
     return(Request.CreateResponse(HttpStatusCode.OK, chatter.Register()));
 }