示例#1
0
        public JsonResult Login(string userCode)
        {
            string encryptedCode = Cryptography.Encrypt(userCode, DateTime.Now.ToString("yyyyMMdd"), "oms");
            var    user          = McdAMContext.Authenticate(encryptedCode);

            return(Json(user));
        }
示例#2
0
        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var lang = filterContext.RequestContext.HttpContext.Request["lang"];

            if (!string.IsNullOrEmpty(lang))
            {
                McdAMContext.SetLanguage(lang);
            }
        }
示例#3
0
        protected void btn_Click(object sender, EventArgs e)
        {
            string   uid      = tb1.Text.Trim();
            string   s        = Cryptography.Encrypt(uid, DateTime.Now.ToString("yyyyMMdd"), "oms");
            UserInfo userInfo = McdAMContext.Authenticate(s);//Stephen Modified

            if (userInfo != null)
            {
                Response.Redirect("PortalTest.aspx?user-id=" + s);
            }
        }
示例#4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType  = "text/javascript";
            context.Response.CacheControl = "no-cache";
            var userId = context.Request["userid"] ?? "";

            userId = userId.Trim();
            if (!string.IsNullOrEmpty(userId))
            {
                McdAMContext.Authenticate(userId);
            }
            if (McdAMContext.CurrentUser != null)
            {
                context.Response.Write(string.Format("window.currentUser = {0};", JsonConvert.SerializeObject(McdAMContext.CurrentUser)));
            }
        }
示例#5
0
        private void SetAppLangulage()
        {
            var langCookie = HttpContext.Current.Request.Cookies["Mcd_AM.LangTag"];

            if (langCookie != null)
            {
                var langtag = langCookie.Value;

                i18n.LanguageTag lt = i18n.LanguageTag.GetCachedInstance(langtag);
                if (lt.IsValid())
                {
                    // Set persistent cookie in the client to remember the language choice.
                    Response.Cookies.Add(new HttpCookie("Mcd_AM.LangTag")
                    {
                        Value    = lt.ToString(),
                        HttpOnly = true,
                        Expires  = DateTime.UtcNow.AddYears(1)
                    });

                    switch (langtag)
                    {
                    case "zh":
                        McdAMContext.SetLanguage("ZHCN");
                        break;

                    case "en":
                        McdAMContext.SetLanguage("ENUS");
                        break;
                    }
                }
                // Owise...delete any 'language' cookie in the client.
                else
                {
                    var cookie = Response.Cookies["Mcd_AM.LangTag"];
                    if (cookie != null)
                    {
                        cookie.Value   = null;
                        cookie.Expires = DateTime.UtcNow.AddMonths(-1);
                    }
                }
                // Update PAL setting so that new language is reflected in any URL patched in the
                // response (Late URL Localization).
                HttpContext.Current.SetPrincipalAppLanguageForRequest(lt);
            }
        }
示例#6
0
        public JsonResult ValidateUser(string userId)
        {
            var user = McdAMContext.Authenticate(userId);

            return(Json(user));
        }
示例#7
0
 public ActionResult Login()
 {
     McdAMContext.ClearUser();
     McdAMContext.ClearCookie();
     return(View());
 }
示例#8
0
 void lnkBtn_Logout_Click(object sender, EventArgs e)
 {
     McdAMContext.ClearUser();
     Response.Redirect("LoginTest.aspx");
 }