Browse Source

Login API 時效加長至30天

Dev
Janie 2 years ago
parent
commit
9c99793754
  1. 6
      EuroTran/EasyBL.WEBAPP/ShowEasy/SystemService.cs

6
EuroTran/EasyBL.WEBAPP/ShowEasy/SystemService.cs

@ -164,14 +164,14 @@ namespace EasyBL.WEBAPP.SYS
LoginTime = DateTime.Now LoginTime = DateTime.Now
}; };
var iExpireTime = 240; var iExpireTime = 240;
var sExpireTime = Common.GetSystemSetting(db, oUser.OrgID, @"ExpireTime");
var sExpireTime = Common.GetSystemSetting(db, oUser.OrgID, @"SEexpireTime");
if (!string.IsNullOrEmpty(sExpireTime)) if (!string.IsNullOrEmpty(sExpireTime))
{ {
iExpireTime = int.Parse(sExpireTime); iExpireTime = int.Parse(sExpireTime);
} }
else else
{ {
iExpireTime = int.Parse(Common.GetAppSettings(@"ExpireTime"));
iExpireTime = int.Parse(Common.GetAppSettings(@"SEexpireTime"));
} }
ticket.ExpireTime = DateTime.Now.AddMinutes(iExpireTime); //30天過期 ticket.ExpireTime = DateTime.Now.AddMinutes(iExpireTime); //30天過期
ticket.IsVerify = @"Y"; ticket.IsVerify = @"Y";
@ -199,7 +199,7 @@ namespace EasyBL.WEBAPP.SYS
HttpContext.Current.Session.Add(@"userid", ticket.UserID); HttpContext.Current.Session.Add(@"userid", ticket.UserID);
HttpCookie cookie = new HttpCookie("EURO_COOKIE");//初始化並設置Cookie的名稱 HttpCookie cookie = new HttpCookie("EURO_COOKIE");//初始化並設置Cookie的名稱
DateTime dt = DateTime.Now; DateTime dt = DateTime.Now;
TimeSpan ts = new TimeSpan(0, 0, 1, 0, 0);//過期時間為1分鐘
TimeSpan ts = new TimeSpan(30, 0, 0, 0, 0);//過期時間為1分鐘
cookie.Expires = dt.Add(ts);//設置過期時間 cookie.Expires = dt.Add(ts);//設置過期時間
cookie.Values.Add("orgid", ticket.OrgID); cookie.Values.Add("orgid", ticket.OrgID);
cookie.Values.Add("userid", ticket.UserID); cookie.Values.Add("userid", ticket.UserID);

Loading…
Cancel
Save