public JsonResult Login(string userCode) { string encryptedCode = Cryptography.Encrypt(userCode, DateTime.Now.ToString("yyyyMMdd"), "oms"); var user = McdAMContext.Authenticate(encryptedCode); return(Json(user)); }
public void OnActionExecuting(ActionExecutingContext filterContext) { var lang = filterContext.RequestContext.HttpContext.Request["lang"]; if (!string.IsNullOrEmpty(lang)) { McdAMContext.SetLanguage(lang); } }
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); } }
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))); } }
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); } }
public JsonResult ValidateUser(string userId) { var user = McdAMContext.Authenticate(userId); return(Json(user)); }
public ActionResult Login() { McdAMContext.ClearUser(); McdAMContext.ClearCookie(); return(View()); }
void lnkBtn_Logout_Click(object sender, EventArgs e) { McdAMContext.ClearUser(); Response.Redirect("LoginTest.aspx"); }