public async Task <ActionResult> Login(VmUserLogin userLogin) { if (!ModelState.IsValid) { return(View(userLogin)); } var ret = await m_UserManagerService.CheckAsync(userLogin.UserName, userLogin.Pwd); if (ret == CheckUserPwdResult.Success) { var userData = m_UserManagerService.GetUser(userLogin.UserName); var token = new JGCKUserToken { UserID = userData.ID.ToString(), UserName = userLogin.UserName, RoleID = Convert.ToString(userData.RoleId ?? 0), RoleName = userData.Role?.Name, RealName = userData.RealName }; token.BuildToken(); if (string.IsNullOrEmpty(Request["reloadurl"])) { return(RedirectToAction("Index", "Settings")); } else { return(Redirect(Request["reloadurl"])); } } ModelState.AddModelError("UserPwdMatch", "用户名和密码不匹配"); return(View(userLogin)); }
public JGCK_MvcController() { var propsInController = this.GetType().GetProperties(BindingFlags.NonPublic | BindingFlags.Instance); var appServiceProps = propsInController .Where(p => p.PropertyType.GetInterface(typeof(ITransistService).FullName) != null).ToList(); if (appServiceProps?.Count == 0) { return; } appServiceProps.ForEach(p => { var refObject = p.PropertyType.Assembly.CreateInstance(p.PropertyType.FullName); p.SetValue(this, refObject); }); var usedAppServices = appServiceProps .Select(p => string.Format(HostVer.IDBProxy_Slot_Format, p.PropertyType.Name)).ToList(); CallContext.LogicalSetData(HostVer.ReferenceService_VerName, usedAppServices); //CallContext.SetData(HostVer.ReferenceService_VerName, usedAppServices); //ViewData存储用户Token信息 ViewBag.UserData = JGCKUserToken.ResolveNewToken(); }