/*public static void RememberMe() {
         *  if (HttpContext.Current.Request.Cookies["remember_me"] == null) {
         *      HttpCookie cookie = new HttpCookie("remember_me", "true") {
         *          Expires = DateTime.MaxValue
         *      };
         *      HttpContext.Current.Response.Cookies.Add(cookie);
         *  }
         * }*/


        public static Customer GetUser()
        {
            HttpCookie token = GetToken();

            if (token == null)
            {
                return(null);
            }
            dynamic data    = SJWT.GetTokenData(token.Value);
            dynamic payload = data.Payload;
            object  id      = payload.id;

            return(CustomerDAO.GetById(Convert.ToUInt32(id)));
        }
        public static bool VerifyTokenMobile()
        {
            var headerToken = HttpContext.Current.Request.Headers["Authorization"];

            if (headerToken == null || headerToken == "null")
            {
                return(false);
            }
            string   token    = headerToken.Split(' ')[1];
            dynamic  data     = SJWT.GetTokenData(token);
            Customer c        = CustomerDAO.GetById(Convert.ToUInt32(data.Payload.id));
            string   newToken = SJWT.GenerateToken(c.Account.Id, c.Account.Email, c.Account.Password);

            return(token == newToken);
        }