延长登陆时间

This commit is contained in:
yubaolee
2016-08-30 20:02:08 +08:00
parent 04d69e065e
commit ba897b1d88
3 changed files with 14 additions and 9 deletions

View File

@@ -52,7 +52,7 @@ namespace OpenAuth.App.SSO
{
UserName = model.UserName,
Token = Guid.NewGuid().ToString().GetHashCode().ToString("x"),
InvalidTime = DateTime.Now.AddMinutes(10),
InvalidTime = DateTime.Now.AddDays(1),
AppKey = model.AppKey,
CreateTime = DateTime.Now,
IpAddress = HttpContext.Current.Request.UserHostAddress

View File

@@ -16,6 +16,7 @@
// </summary>
// ***********************************************************************
using System;
using System.Web;
using System.Web.Mvc;
@@ -36,7 +37,11 @@ namespace OpenAuth.App.SSO
if (request.QueryString[Token] != null)
{
token = request.QueryString[Token];
filterContext.HttpContext.Response.Cookies.Add(new HttpCookie(Token, token));
var cookie = new HttpCookie(Token, token)
{
Expires = DateTime.Now.AddDays(1)
};
filterContext.HttpContext.Response.Cookies.Add(cookie);
}
else if (request.Cookies[Token] != null) //从Cookie读取Token
{