/// <summary> /// 登陆 /// </summary> /// <param name="user">用户信息</param> /// <returns>登陆后的视图</returns> public ActionResult Login(User user) { if (user.UserCode == UserCode && user.Password == Password) { Session[SessionUtility.GetUserSession()] = user; return(new RedirectResult("/Home/Index")); } else { return(View()); } }
public ActionResult Index() { if (Session[SessionUtility.GetUserSession()] == null) { return(new RedirectResult("/Login/index")); } else { User user = (User)Session[SessionUtility.GetUserSession()]; return(View(user)); } }
/// <summary> /// 单点登陆回调的方法 /// </summary> /// <param name="token">验证服务器生成的Token</param> /// <returns>登陆成功后的地址</returns> public ActionResult SSOLogin(string token) { H3SSOService.SSOServiceSoapClient client = new H3SSOService.SSOServiceSoapClient(); string userCode = client.GetAuthenticationUser(SystemCode, Secret, token); if (userCode == UserCode) { //这里会在系统里处理自己的登陆逻辑 Session[SessionUtility.GetUserSession()] = new User() { UserCode = UserCode }; return(new RedirectResult("/Home/Index")); } return(null); }