Commit 607d0cb99214df2c5722017bda8bf183ee67fc13

Authored by Birendra
1 parent 4d676130

fixed issue in user session

400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
@@ -119,10 +119,10 @@ namespace AIAHTML5.ADMIN.API.Controllers @@ -119,10 +119,10 @@ namespace AIAHTML5.ADMIN.API.Controllers
119 bool Status = false; 119 bool Status = false;
120 int userId = jsonData["userId"].Value<Int32>(); 120 int userId = jsonData["userId"].Value<Int32>();
121 string tagName = jsonData["tagName"].Value<string>(); 121 string tagName = jsonData["tagName"].Value<string>();
122 - bool isAlreadyLoggedIn = jsonData["isAlreadyLoggedIn"].Value<bool>(); 122 + long SessionId = jsonData["SessionId"].Value<long>();
123 try 123 try
124 { 124 {
125 - Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName, isAlreadyLoggedIn); 125 + Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName, SessionId);
126 126
127 return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); 127 return Request.CreateResponse(HttpStatusCode.OK, Status.ToString());
128 } 128 }
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs
@@ -4995,7 +4995,7 @@ namespace AIAHTML5.ADMIN.API.Entity @@ -4995,7 +4995,7 @@ namespace AIAHTML5.ADMIN.API.Entity
4995 return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, iUserTypeIdParameter, sEmailIdParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iLicenseIdParameter, iEditionIdParameter, status); 4995 return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, iUserTypeIdParameter, sEmailIdParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iLicenseIdParameter, iEditionIdParameter, status);
4996 } 4996 }
4997 4997
4998 - public virtual ObjectResult<Nullable<bool>> usp_ManageUserLoginStatus(Nullable<int> userId, string tag, Nullable<bool> isAlreadyLogin) 4998 + public virtual ObjectResult<Nullable<bool>> usp_ManageUserLoginStatus(Nullable<int> userId, string tag, Nullable<long> sessionId)
4999 { 4999 {
5000 var userIdParameter = userId.HasValue ? 5000 var userIdParameter = userId.HasValue ?
5001 new ObjectParameter("userId", userId) : 5001 new ObjectParameter("userId", userId) :
@@ -5005,11 +5005,11 @@ namespace AIAHTML5.ADMIN.API.Entity @@ -5005,11 +5005,11 @@ namespace AIAHTML5.ADMIN.API.Entity
5005 new ObjectParameter("tag", tag) : 5005 new ObjectParameter("tag", tag) :
5006 new ObjectParameter("tag", typeof(string)); 5006 new ObjectParameter("tag", typeof(string));
5007 5007
5008 - var isAlreadyLoginParameter = isAlreadyLogin.HasValue ?  
5009 - new ObjectParameter("isAlreadyLogin", isAlreadyLogin) :  
5010 - new ObjectParameter("isAlreadyLogin", typeof(bool)); 5008 + var sessionIdParameter = sessionId.HasValue ?
  5009 + new ObjectParameter("sessionId", sessionId) :
  5010 + new ObjectParameter("sessionId", typeof(long));
5011 5011
5012 - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<bool>>("usp_ManageUserLoginStatus", userIdParameter, tagParameter, isAlreadyLoginParameter); 5012 + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<bool>>("usp_ManageUserLoginStatus", userIdParameter, tagParameter, sessionIdParameter);
5013 } 5013 }
5014 } 5014 }
5015 } 5015 }
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx
@@ -1410,7 +1410,7 @@ @@ -1410,7 +1410,7 @@
1410 <Function Name="usp_ManageUserLoginStatus" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> 1410 <Function Name="usp_ManageUserLoginStatus" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
1411 <Parameter Name="userId" Type="int" Mode="In" /> 1411 <Parameter Name="userId" Type="int" Mode="In" />
1412 <Parameter Name="tag" Type="varchar" Mode="In" /> 1412 <Parameter Name="tag" Type="varchar" Mode="In" />
1413 - <Parameter Name="isAlreadyLogin" Type="bit" Mode="In" /> 1413 + <Parameter Name="sessionId" Type="bigint" Mode="In" />
1414 </Function> 1414 </Function>
1415 <Function Name="usp_SaveLabExerciseAttempts" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo"> 1415 <Function Name="usp_SaveLabExerciseAttempts" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
1416 <Parameter Name="UserId" Type="int" Mode="In" /> 1416 <Parameter Name="UserId" Type="int" Mode="In" />
@@ -3006,7 +3006,7 @@ @@ -3006,7 +3006,7 @@
3006 <FunctionImport Name="usp_ManageUserLoginStatus" ReturnType="Collection(Boolean)"> 3006 <FunctionImport Name="usp_ManageUserLoginStatus" ReturnType="Collection(Boolean)">
3007 <Parameter Name="userId" Mode="In" Type="Int32" /> 3007 <Parameter Name="userId" Mode="In" Type="Int32" />
3008 <Parameter Name="tag" Mode="In" Type="String" /> 3008 <Parameter Name="tag" Mode="In" Type="String" />
3009 - <Parameter Name="isAlreadyLogin" Mode="In" Type="Boolean" /> 3009 + <Parameter Name="sessionId" Mode="In" Type="Int64" />
3010 </FunctionImport> 3010 </FunctionImport>
3011 </EntityContainer> 3011 </EntityContainer>
3012 <ComplexType Name="DA_GetBaseLayer_Result"> 3012 <ComplexType Name="DA_GetBaseLayer_Result">
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs
@@ -65,12 +65,12 @@ namespace AIAHTML5.ADMIN.API.Models @@ -65,12 +65,12 @@ namespace AIAHTML5.ADMIN.API.Models
65 return false; 65 return false;
66 } 66 }
67 } 67 }
68 - public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName, bool isAlreadyLoggedIn) 68 + public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName, long SessionId)
69 { 69 {
70 bool loginStatus = false; 70 bool loginStatus = false;
71 try 71 try
72 { 72 {
73 - loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName, isAlreadyLoggedIn).FirstOrDefault()); 73 + loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName, SessionId).FirstOrDefault());
74 74
75 return loginStatus; 75 return loginStatus;
76 } 76 }
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
@@ -512,9 +512,9 @@ namespace AIAHTML5.API.Controllers @@ -512,9 +512,9 @@ namespace AIAHTML5.API.Controllers
512 { 512 {
513 int userId = jsonData["userId"].Value<int>(); 513 int userId = jsonData["userId"].Value<int>();
514 string tagName = jsonData["tagName"].Value<string>(); 514 string tagName = jsonData["tagName"].Value<string>();
515 - bool isAlreadyLoggedIn = jsonData["isAlreadyLoggedIn"].Value<bool>(); 515 + long SessionId = jsonData["SessionId"].Value<long>();
516 516
517 - loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName, isAlreadyLoggedIn); 517 + loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName, SessionId);
518 518
519 return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(loginStatus) }; 519 return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(loginStatus) };
520 } 520 }
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
@@ -348,7 +348,7 @@ namespace AIAHTML5.API.Models @@ -348,7 +348,7 @@ namespace AIAHTML5.API.Models
348 return objUser; 348 return objUser;
349 } 349 }
350 350
351 - internal static string GetUserLoginStatus(int userId,string tagName,bool isAlreadyLoggedIn) 351 + internal static string GetUserLoginStatus(int userId,string tagName, long SessionId)
352 { 352 {
353 string status=string.Empty; 353 string status=string.Empty;
354 DBModel objModel = new DBModel(); 354 DBModel objModel = new DBModel();
@@ -363,7 +363,7 @@ namespace AIAHTML5.API.Models @@ -363,7 +363,7 @@ namespace AIAHTML5.API.Models
363 cmd.CommandType = CommandType.StoredProcedure; 363 cmd.CommandType = CommandType.StoredProcedure;
364 cmd.Parameters.AddWithValue("@userId", userId); 364 cmd.Parameters.AddWithValue("@userId", userId);
365 cmd.Parameters.AddWithValue("@tag", tagName); 365 cmd.Parameters.AddWithValue("@tag", tagName);
366 - cmd.Parameters.AddWithValue("@isAlreadyLogin", isAlreadyLoggedIn); 366 + cmd.Parameters.AddWithValue("@sessionId", SessionId);
367 adapter = new SqlDataAdapter(cmd); 367 adapter = new SqlDataAdapter(cmd);
368 adapter.Fill(ds); 368 adapter.Fill(ds);
369 369
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
@@ -315,10 +315,10 @@ namespace AIAHTML5.API.Models @@ -315,10 +315,10 @@ namespace AIAHTML5.API.Models
315 return objUser; 315 return objUser;
316 } 316 }
317 317
318 - internal static string GetUserLoginStatus(int userId, string tagName,bool isAlreadyLoggedIn) 318 + internal static string GetUserLoginStatus(int userId, string tagName, long SessionId)
319 { 319 {
320 string status = null; 320 string status = null;
321 - status = DBModel.GetUserLoginStatus(userId, tagName, isAlreadyLoggedIn); 321 + status = DBModel.GetUserLoginStatus(userId, tagName, SessionId);
322 322
323 return status; 323 return status;
324 } 324 }
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -73,16 +73,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -73,16 +73,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
73 //$rootScope.errorMessage = ''; // Commented initialization to retain message when coming to login after password reset success screen 73 //$rootScope.errorMessage = ''; // Commented initialization to retain message when coming to login after password reset success screen
74 $("#fileMenuAnchor").addClass("disableFileMenu"); 74 $("#fileMenuAnchor").addClass("disableFileMenu");
75 75
76 - $rootScope.userInfo = {  
77 - username: null,  
78 - password: null,  
79 - emailId: null,  
80 - newPassword: null,  
81 - confirmPassword: null,  
82 - userMessage: null,  
83 - unblockUser: false,  
84 - isMailForForgotPassword: false  
85 - };  
86 $rootScope.userLicenseInfo = { 76 $rootScope.userLicenseInfo = {
87 userLicenseId: 0, 77 userLicenseId: 0,
88 licenseeAccountNumber: null 78 licenseeAccountNumber: null
@@ -647,6 +637,19 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -647,6 +637,19 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
647 $('#login').css('visibility', 'visible'); 637 $('#login').css('visibility', 'visible');
648 638
649 $rootScope.checkRefreshButtonClick = 1; 639 $rootScope.checkRefreshButtonClick = 1;
  640 + var date = new Date();
  641 +
  642 + $rootScope.userInfo = {
  643 + username: null,
  644 + password: null,
  645 + emailId: null,
  646 + newPassword: null,
  647 + confirmPassword: null,
  648 + userMessage: null,
  649 + unblockUser: false,
  650 + isMailForForgotPassword: false,
  651 + SessionId:date.getTime()
  652 + };
650 653
651 $rootScope.siteUrlInfo = { 654 $rootScope.siteUrlInfo = {
652 siteIP: null, 655 siteIP: null,
@@ -659,7 +662,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -659,7 +662,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
659 userId: null, 662 userId: null,
660 password: null, 663 password: null,
661 mtype:null, 664 mtype:null,
662 - id:null 665 + id:null,
  666 + SessionId:date.getTime()
663 } 667 }
664 668
665 if (params != null && params != undefined && params != "") { 669 if (params != null && params != undefined && params != "") {
@@ -710,7 +714,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -710,7 +714,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
710 $scope.checkuserstatus = { 714 $scope.checkuserstatus = {
711 userId: userId, 715 userId: userId,
712 tagName: loggedInUser.Id==0?'logout':'update', 716 tagName: loggedInUser.Id==0?'logout':'update',
713 - isAlreadyLoggedIn:true 717 + SessionId:loggedInUser.SessionId
714 } 718 }
715 719
716 // this case found when browser closed by user after login. after long time (after 20 min) open site again 720 // this case found when browser closed by user after login. after long time (after 20 min) open site again
@@ -813,7 +817,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -813,7 +817,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
813 $('#HomeContainerDiv').css('opacity', '0.7'); 817 $('#HomeContainerDiv').css('opacity', '0.7');
814 818
815 } 819 }
816 - $rootScope.AuthenticateUser = function (userInfo,isAlreadyLoggedIn) { 820 + $rootScope.AuthenticateUser = function (userInfo) {
817 if (navigator.cookieEnabled) { 821 if (navigator.cookieEnabled) {
818 $rootScope.errorMessage = ""; 822 $rootScope.errorMessage = "";
819 if (userInfo.username == "" || userInfo.username == null || userInfo.username == undefined || userInfo.password == "" || userInfo.password == null || userInfo.password == undefined) { 823 if (userInfo.username == "" || userInfo.username == null || userInfo.username == undefined || userInfo.password == "" || userInfo.password == null || userInfo.password == undefined) {
@@ -842,10 +846,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -842,10 +846,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
842 // birendra// initialize exp img detail object 846 // birendra// initialize exp img detail object
843 $rootScope.initializeUserForExportImage(result.Id); 847 $rootScope.initializeUserForExportImage(result.Id);
844 // update result with session detail 848 // update result with session detail
  849 +
845 result.aiaIdleTime=$rootScope.aiaIdleTime; 850 result.aiaIdleTime=$rootScope.aiaIdleTime;
846 result.aiaIdleTimeOut=$rootScope.aiaIdleTimeOut; 851 result.aiaIdleTimeOut=$rootScope.aiaIdleTimeOut;
847 result.aiaPingInterval=$rootScope.aiaPingInterval; 852 result.aiaPingInterval=$rootScope.aiaPingInterval;
848 - $rootScope.isAlreadyLoggedIn=isAlreadyLoggedIn==undefined?false:isAlreadyLoggedIn; 853 + result.SessionId=userInfo.SessionId;
  854 +
849 //display user name 855 //display user name
850 $rootScope.userName=result.FirstName+" "+result.LastName; 856 $rootScope.userName=result.FirstName+" "+result.LastName;
851 857
@@ -1265,6 +1271,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -1265,6 +1271,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1265 if($rootScope.siteUrlInfo.mtype!=null && $rootScope.siteUrlInfo.mtype.toLowerCase()=='ca' && $rootScope.siteUrlInfo.userId!=null && $rootScope.siteUrlInfo.accountNumber!=null) 1271 if($rootScope.siteUrlInfo.mtype!=null && $rootScope.siteUrlInfo.mtype.toLowerCase()=='ca' && $rootScope.siteUrlInfo.userId!=null && $rootScope.siteUrlInfo.accountNumber!=null)
1266 { 1272 {
1267 $rootScope.LoginDisableUI(); 1273 $rootScope.LoginDisableUI();
  1274 + var userInfo=$rootScope.userInfo;//also get session id
1268 AuthenticationService.ByPassLoginToOpenModule($rootScope.siteUrlInfo) 1275 AuthenticationService.ByPassLoginToOpenModule($rootScope.siteUrlInfo)
1269 .then( 1276 .then(
1270 function (result) { 1277 function (result) {
@@ -1281,16 +1288,19 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -1281,16 +1288,19 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1281 $rootScope.aiaAnimationPath = configresult.serverPath; 1288 $rootScope.aiaAnimationPath = configresult.serverPath;
1282 $rootScope.MaxOneFileSize = configresult.fileSize; 1289 $rootScope.MaxOneFileSize = configresult.fileSize;
1283 1290
1284 - $rootScope.userInfo.username = result.LoginId;  
1285 - $rootScope.userInfo.password = result.Password; 1291 + userInfo.username = result.LoginId;
  1292 + userInfo.password = result.Password;
1286 var loggedInUser = JSON.parse($scope.currentUserDetails); 1293 var loggedInUser = JSON.parse($scope.currentUserDetails);
1287 if(loggedInUser!==null && loggedInUser.LoginId==result.LoginId) 1294 if(loggedInUser!==null && loggedInUser.LoginId==result.LoginId)
1288 { 1295 {
1289 - $rootScope.AuthenticateUser($rootScope.userInfo,true); 1296 + //using old session id
  1297 + userInfo.SessionId = loggedInUser.SessionId;
  1298 + $rootScope.AuthenticateUser(userInfo);
1290 } 1299 }
1291 else 1300 else
1292 { 1301 {
1293 - $rootScope.AuthenticateUser($rootScope.userInfo,false); 1302 + //using new sessionid
  1303 + $rootScope.AuthenticateUser(userInfo);
1294 } 1304 }
1295 }); 1305 });
1296 1306
@@ -1337,17 +1347,21 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -1337,17 +1347,21 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1337 //maintain user session by licenseid of site login 1347 //maintain user session by licenseid of site login
1338 if(loggedInUser!==null && loggedInUser.AccountNumber==sitedetail.accountNumber) 1348 if(loggedInUser!==null && loggedInUser.AccountNumber==sitedetail.accountNumber)
1339 { 1349 {
1340 - $rootScope.AuthenticateClientSiteUser(sitedetail,true); 1350 + //using old session id
  1351 + sitedetail.SessionId = loggedInUser.SessionId;
  1352 + $rootScope.AuthenticateClientSiteUser(sitedetail);
1341 } 1353 }
1342 else 1354 else
1343 { 1355 {
1344 - $rootScope.AuthenticateClientSiteUser(sitedetail,false); 1356 + //using new sessionid
  1357 + $rootScope.AuthenticateClientSiteUser(sitedetail);
1345 } 1358 }
1346 }); 1359 });
1347 } 1360 }
1348 } 1361 }
1349 1362
1350 - $rootScope.AuthenticateClientSiteUser = function (siteInfo,isAlreadyLoggedIn) { 1363 + $rootScope.AuthenticateClientSiteUser = function (siteInfo) {
  1364 + $rootScope.LoginDisableUI();
1351 AuthenticationService.validateClientSite(siteInfo) 1365 AuthenticationService.validateClientSite(siteInfo)
1352 .then( 1366 .then(
1353 function (result) { 1367 function (result) {
@@ -1398,7 +1412,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -1398,7 +1412,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1398 result.aiaIdleTime=$rootScope.aiaIdleTime; 1412 result.aiaIdleTime=$rootScope.aiaIdleTime;
1399 result.aiaIdleTimeOut=$rootScope.aiaIdleTimeOut; 1413 result.aiaIdleTimeOut=$rootScope.aiaIdleTimeOut;
1400 result.aiaPingInterval=$rootScope.aiaPingInterval; 1414 result.aiaPingInterval=$rootScope.aiaPingInterval;
1401 - $rootScope.isAlreadyLoggedIn=isAlreadyLoggedIn==undefined?false:isAlreadyLoggedIn; 1415 + result.SessionId=siteInfo.SessionId;
1402 //display user name 1416 //display user name
1403 $rootScope.userName=result.FirstName+" "+result.LastName; 1417 $rootScope.userName=result.FirstName+" "+result.LastName;
1404 if (typeof result.FirstName != undefined || result.FirstName != "" || result.FirstName != null) { 1418 if (typeof result.FirstName != undefined || result.FirstName != "" || result.FirstName != null) {
@@ -1689,11 +1703,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -1689,11 +1703,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1689 $rootScope.userStatus = { 1703 $rootScope.userStatus = {
1690 userId: null, 1704 userId: null,
1691 tagName: null, 1705 tagName: null,
1692 - loginStatus: null,  
1693 - isAlreadyLoggedIn:null 1706 + SessionId:null
1694 } 1707 }
1695 console.log('user session start'); 1708 console.log('user session start');
1696 - $rootScope.CheckUserSession('insert',$rootScope.isAlreadyLoggedIn); 1709 + $rootScope.CheckUserSession('insert');
1697 1710
1698 $rootScope.$on('IdleStart', function() { 1711 $rootScope.$on('IdleStart', function() {
1699 // this event fire when idle time finish and time out start 1712 // this event fire when idle time finish and time out start
@@ -1711,14 +1724,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -1711,14 +1724,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1711 // config set in AIA.js -:IdleProvider.timeout(15); 1724 // config set in AIA.js -:IdleProvider.timeout(15);
1712 $rootScope.isSessionTimeout=true; 1725 $rootScope.isSessionTimeout=true;
1713 console.log('session is timeout'); 1726 console.log('session is timeout');
1714 - $rootScope.CheckUserSession('logout',true); 1727 + $rootScope.CheckUserSession('logout');
1715 }); 1728 });
1716 $rootScope.$on('Keepalive', function() { 1729 $rootScope.$on('Keepalive', function() {
1717 // it watch the session on perticular time interval during idle time period 1730 // it watch the session on perticular time interval during idle time period
1718 // config set in AIA.js -: KeepaliveProvider.interval(10); 1731 // config set in AIA.js -: KeepaliveProvider.interval(10);
1719 //we will use it to recieve request from databse if user logout from admin activity 1732 //we will use it to recieve request from databse if user logout from admin activity
1720 console.log('ping user session'); 1733 console.log('ping user session');
1721 - $rootScope.CheckUserSession('update',true); 1734 + $rootScope.CheckUserSession('update');
1722 }); 1735 });
1723 1736
1724 1737
@@ -1745,7 +1758,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -1745,7 +1758,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1745 $rootScope.isSessionTimeout=true; 1758 $rootScope.isSessionTimeout=true;
1746 localStorage.removeItem('loggedInUserDetails'); 1759 localStorage.removeItem('loggedInUserDetails');
1747 localStorage.clear(); 1760 localStorage.clear();
1748 - $rootScope.CheckUserSession('logout',true); 1761 + $rootScope.CheckUserSession('logout');
1749 $timeout(function(){ 1762 $timeout(function(){
1750 document.location = '/'; 1763 document.location = '/';
1751 $rootScope.isVisibleLogin = true; 1764 $rootScope.isVisibleLogin = true;
@@ -1760,15 +1773,15 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -1760,15 +1773,15 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1760 $rootScope.isVisibleLogin = true; 1773 $rootScope.isVisibleLogin = true;
1761 } 1774 }
1762 1775
1763 - $rootScope.CheckUserSession = function (tagName,isAlreadyLoggedIn) { 1776 + $rootScope.CheckUserSession = function (tagName) {
1764 //console.log('user login id: '+$rootScope.userData.Id); 1777 //console.log('user login id: '+$rootScope.userData.Id);
1765 //console.log('user login activity tag: '+tagName); 1778 //console.log('user login activity tag: '+tagName);
1766 if($rootScope.userData==undefined) return; 1779 if($rootScope.userData==undefined) return;
1767 //incase site user login userid is 0 so then using license id 1780 //incase site user login userid is 0 so then using license id
1768 $rootScope.userStatus.userId=$rootScope.userData.Id==0?$rootScope.userData.LicenseId:$rootScope.userData.Id; 1781 $rootScope.userStatus.userId=$rootScope.userData.Id==0?$rootScope.userData.LicenseId:$rootScope.userData.Id;
1769 $rootScope.userStatus.tagName=tagName; 1782 $rootScope.userStatus.tagName=tagName;
1770 - $rootScope.userStatus.isAlreadyLoggedIn=isAlreadyLoggedIn;  
1771 - $rootScope.isAlreadyLoggedIn=true; 1783 + $rootScope.userStatus.SessionId=$rootScope.userData.SessionId;
  1784 +
1772 AuthenticationService.ManageUserLoginStatus($rootScope.userStatus) 1785 AuthenticationService.ManageUserLoginStatus($rootScope.userStatus)
1773 .then( 1786 .then(
1774 function (loginStatus) { 1787 function (loginStatus) {
@@ -1799,8 +1812,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data @@ -1799,8 +1812,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1799 if (userInfo.LoginId != undefined || userInfo.LoginId != "" || userInfo.LoginId != null) { 1812 if (userInfo.LoginId != undefined || userInfo.LoginId != "" || userInfo.LoginId != null) {
1800 1813
1801 userInfo["username"] = userInfo.LoginId; 1814 userInfo["username"] = userInfo.LoginId;
1802 - userInfo["password"] = userInfo.Password;  
1803 - $rootScope.AuthenticateUser(userInfo,true); 1815 + userInfo["password"] = userInfo.Password;
  1816 + $rootScope.AuthenticateUser(userInfo);
1804 } 1817 }
1805 1818
1806 1819
400-SOURCECODE/Admin/src/app/app.component.ts
@@ -81,6 +81,11 @@ export class AppComponent implements OnInit { @@ -81,6 +81,11 @@ export class AppComponent implements OnInit {
81 // console.log("You\'ve gone idle!"); 81 // console.log("You\'ve gone idle!");
82 // }); 82 // });
83 83
  84 + if(window.location.hostname=="localhost")
  85 + {
  86 + //insert new session
  87 + this.loginManageStatus('insert');
  88 + }
84 this.idle.watch(); 89 this.idle.watch();
85 90
86 } 91 }
@@ -134,7 +139,7 @@ export class AppComponent implements OnInit { @@ -134,7 +139,7 @@ export class AppComponent implements OnInit {
134 this.userservice.ManageUserLoginStatus({ 139 this.userservice.ManageUserLoginStatus({
135 userId: this.global.UserId, 140 userId: this.global.UserId,
136 tagName: tagname, 141 tagName: tagname,
137 - isAlreadyLoggedIn:true 142 + SessionId:this.global.SessionId
138 }).subscribe(status => { 143 }).subscribe(status => {
139 console.log(status); 144 console.log(status);
140 if(status=='False') 145 if(status=='False')
400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts
@@ -56,7 +56,7 @@ export class UserService { @@ -56,7 +56,7 @@ export class UserService {
56 56
57 //////////Manage UserLogin Status/////////// 57 //////////Manage UserLogin Status///////////
58 ManageUserLoginStatus(obj: any) { 58 ManageUserLoginStatus(obj: any) {
59 - var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName,'isAlreadyLoggedIn': obj.isAlreadyLoggedIn }; 59 + var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName,'SessionId': obj.SessionId };
60 console.log(obj); 60 console.log(obj);
61 var headers = new Headers({ 61 var headers = new Headers({
62 'Content-Type': 'application/json' 62 'Content-Type': 'application/json'
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
@@ -392,8 +392,8 @@ export class UsersList implements OnInit, AfterViewChecked { @@ -392,8 +392,8 @@ export class UsersList implements OnInit, AfterViewChecked {
392 this._loadingService.ShowLoading("global-loading"); 392 this._loadingService.ShowLoading("global-loading");
393 this.userservice.ManageUserLoginStatus({ 393 this.userservice.ManageUserLoginStatus({
394 userId: this.selectedId, 394 userId: this.selectedId,
395 - tagName: 'logout',  
396 - isAlreadyLoggedIn:true 395 + tagName: 'adminlogout',
  396 + SessionId:this.global.SessionId
397 }).subscribe(x => { 397 }).subscribe(x => {
398 console.log(x); 398 console.log(x);
399 this.EditbuttonStatus=undefined; 399 this.EditbuttonStatus=undefined;
400-SOURCECODE/Admin/src/app/shared/global.ts
@@ -27,6 +27,7 @@ export class GlobalService { @@ -27,6 +27,7 @@ export class GlobalService {
27 aiaIdleTime:number=0; 27 aiaIdleTime:number=0;
28 aiaIdleTimeOut:number=0; 28 aiaIdleTimeOut:number=0;
29 aiaPingInterval:number=0; 29 aiaPingInterval:number=0;
  30 + SessionId:number=0;
30 RemoveColumns: Array<string> = ["Serial_No", "LicenseId","RowNum"] 31 RemoveColumns: Array<string> = ["Serial_No", "LicenseId","RowNum"]
31 error; 32 error;
32 public href: string = ""; 33 public href: string = "";
@@ -41,6 +42,7 @@ export class GlobalService { @@ -41,6 +42,7 @@ export class GlobalService {
41 this.aiaIdleTime=this.loggedInUser.aiaIdleTime; 42 this.aiaIdleTime=this.loggedInUser.aiaIdleTime;
42 this.aiaIdleTimeOut=this.loggedInUser.aiaIdleTimeOut; 43 this.aiaIdleTimeOut=this.loggedInUser.aiaIdleTimeOut;
43 this.aiaPingInterval=this.loggedInUser.aiaPingInterval; 44 this.aiaPingInterval=this.loggedInUser.aiaPingInterval;
  45 + this.SessionId=this.loggedInUser.SessionId;
44 46
45 } 47 }
46 48
@@ -72,9 +74,11 @@ export class GlobalService { @@ -72,9 +74,11 @@ export class GlobalService {
72 { 74 {
73 // for 'ng serve --open' command 75 // for 'ng serve --open' command
74 //**** for localhost:4200 *****// 76 //**** for localhost:4200 *****//
  77 + var date = new Date();
  78 + var newsessionid = date.getTime();//timestamp is the number of milliseconds that have passed since January 1, 1970
75 localStorage.setItem('loggedInUserDetails', JSON.stringify( 79 localStorage.setItem('loggedInUserDetails', JSON.stringify(
76 { 80 {
77 - "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016","aiaIdleTime": 300,"aiaIdleTimeOut": 30,"aiaPingInterval": 10, "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": { "Id": 0, "AccountNumber": "AIAS000319" }, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null 81 + "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016","aiaIdleTime": 300,"aiaIdleTimeOut": 30,"aiaPingInterval": 10,"SessionId":newsessionid, "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": { "Id": 0, "AccountNumber": "AIAS000319" }, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null
78 })); 82 }));
79 } 83 }
80 84