Commit 8d2df1a82bd914d2937e9e13c5877303a4345dcf

Authored by Birendra
1 parent eb94ad75

added user session in admin section

Showing 26 changed files with 559 additions and 98 deletions
400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs
... ... @@ -111,6 +111,27 @@ namespace AIAHTML5.ADMIN.API.Controllers
111 111 return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
112 112 }
113 113 }
  114 +
  115 + [Route("ManageUserLoginStatus")]
  116 + [HttpPost]
  117 + public HttpResponseMessage ManageUserLoginStatus(JObject jsonData)
  118 + {
  119 + bool Status = false;
  120 + int userId = jsonData["userId"].Value<Int32>();
  121 + string tagName = jsonData["tagName"].Value<string>();
  122 + try
  123 + {
  124 + Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName);
  125 +
  126 + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString());
  127 + }
  128 + catch (Exception ex)
  129 + {
  130 + // Log exception code goes here
  131 + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
  132 + }
  133 + }
  134 +
114 135 [Route("UpdateUserId")]
115 136 [HttpPost]
116 137 public HttpResponseMessage UpdateUserId(UserModel userInfo)
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs
... ... @@ -4990,5 +4990,18 @@ namespace AIAHTML5.ADMIN.API.Entity
4990 4990  
4991 4991 return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, iUserTypeIdParameter, sEmailIdParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iLicenseIdParameter, iEditionIdParameter, status);
4992 4992 }
  4993 +
  4994 + public virtual ObjectResult<Nullable<bool>> usp_ManageUserLoginStatus(Nullable<int> userId, string tag)
  4995 + {
  4996 + var userIdParameter = userId.HasValue ?
  4997 + new ObjectParameter("userId", userId) :
  4998 + new ObjectParameter("userId", typeof(int));
  4999 +
  5000 + var tagParameter = tag != null ?
  5001 + new ObjectParameter("tag", tag) :
  5002 + new ObjectParameter("tag", typeof(string));
  5003 +
  5004 + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<Nullable<bool>>("usp_ManageUserLoginStatus", userIdParameter, tagParameter);
  5005 + }
4993 5006 }
4994 5007 }
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs
1   -// T4 code generation is enabled for model 'E:\AIAProject00-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'.
  1 +// T4 code generation is enabled for model 'F:\AIAProject00-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'.
2 2 // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
3 3 // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
4 4 // is open in the designer.
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx
... ... @@ -1406,6 +1406,10 @@
1406 1406 <Parameter Name="SiteEditionIds" Type="varchar" Mode="In" />
1407 1407 <Parameter Name="Status" Type="int" Mode="InOut" />
1408 1408 </Function>
  1409 + <Function Name="usp_ManageUserLoginStatus" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
  1410 + <Parameter Name="userId" Type="int" Mode="In" />
  1411 + <Parameter Name="tag" Type="varchar" Mode="In" />
  1412 + </Function>
1409 1413 <Function Name="usp_SaveLabExerciseAttempts" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="dbo">
1410 1414 <Parameter Name="UserId" Type="int" Mode="In" />
1411 1415 <Parameter Name="LabExerciseIdentifier" Type="nchar" Mode="In" />
... ... @@ -2996,6 +3000,10 @@
2996 3000 <Parameter Name="iEditionId" Mode="In" Type="Byte" />
2997 3001 <Parameter Name="Status" Mode="InOut" Type="Int32" />
2998 3002 </FunctionImport>
  3003 + <FunctionImport Name="usp_ManageUserLoginStatus" ReturnType="Collection(Boolean)">
  3004 + <Parameter Name="userId" Mode="In" Type="Int32" />
  3005 + <Parameter Name="tag" Mode="In" Type="String" />
  3006 + </FunctionImport>
2999 3007 </EntityContainer>
3000 3008 <ComplexType Name="DA_GetBaseLayer_Result">
3001 3009 <Property Type="Int32" Name="Id" Nullable="false" />
... ... @@ -4318,6 +4326,7 @@
4318 4326 <Property Type="String" Name="UserStatus" Nullable="true" MaxLength="8" />
4319 4327 <Property Type="Int32" Name="UserTypeId" Nullable="true" />
4320 4328 <Property Type="Int32" Name="EditionTypeId" Nullable="true" />
  4329 + <Property Type="Boolean" Name="LoginStatus" Nullable="true" />
4321 4330 </ComplexType>
4322 4331 <ComplexType Name="usp_GetUserTyeByAccountNumber_Result">
4323 4332 <Property Type="Byte" Name="Id" Nullable="true" />
... ... @@ -6284,6 +6293,7 @@
6284 6293 <ScalarProperty Name="UserStatus" ColumnName="UserStatus" />
6285 6294 <ScalarProperty Name="UserTypeId" ColumnName="UserTypeId" />
6286 6295 <ScalarProperty Name="EditionTypeId" ColumnName="EditionTypeId" />
  6296 + <ScalarProperty Name="LoginStatus" ColumnName="LoginStatus" />
6287 6297 </ComplexTypeMapping>
6288 6298 </ResultMapping>
6289 6299 </FunctionImportMapping>
... ... @@ -6305,6 +6315,7 @@
6305 6315 <FunctionImportMapping FunctionImportName="usp_UpdateLicenseAccount" FunctionName="AIADatabaseV5Model.Store.usp_UpdateLicenseAccount" />
6306 6316 <FunctionImportMapping FunctionImportName="usp_UpdateUserProfile" FunctionName="AIADatabaseV5Model.Store.usp_UpdateUserProfile" />
6307 6317 <FunctionImportMapping FunctionImportName="usp_InsertAIAUser" FunctionName="AIADatabaseV5Model.Store.usp_InsertAIAUser" />
  6318 + <FunctionImportMapping FunctionImportName="usp_ManageUserLoginStatus" FunctionName="AIADatabaseV5Model.Store.usp_ManageUserLoginStatus" />
6308 6319 </EntityContainerMapping>
6309 6320 </Mapping>
6310 6321 </edmx:Mappings>
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs
... ... @@ -29,5 +29,6 @@ namespace AIAHTML5.ADMIN.API.Entity
29 29 public string UserStatus { get; set; }
30 30 public Nullable<int> UserTypeId { get; set; }
31 31 public Nullable<int> EditionTypeId { get; set; }
  32 + public Nullable<bool> LoginStatus { get; set; }
32 33 }
33 34 }
... ...
400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs
... ... @@ -65,6 +65,21 @@ namespace AIAHTML5.ADMIN.API.Models
65 65 return false;
66 66 }
67 67 }
  68 + public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName)
  69 + {
  70 + bool loginStatus = false;
  71 + try
  72 + {
  73 + loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName).FirstOrDefault());
  74 +
  75 + return loginStatus;
  76 + }
  77 + catch (Exception ex)
  78 + {
  79 + return false;
  80 + }
  81 + }
  82 +
68 83 public static string UpdateUserId(AIADatabaseV5Entities dbContext, int id, string userId, string oldUserId)
69 84 {
70 85 var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
... ...
400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs
... ... @@ -41,5 +41,6 @@ namespace AIAHTML5.API.Constants
41 41 public const string GET_COUNT_EXPORTED_IMAGE = "usp_GetCountExportedImage";
42 42 public const string INSERT_EXPORTED_IMAGE = "usp_InsertExportedImage";
43 43 public const string GET_USER_DETAIL_BYLOGIN_AND_ACCOUNT = "usp_GetUserDetailsByLoginIdandAccount";
  44 + public const string GET_USER_LOGIN_STATUS = "usp_ManageUserLoginStatus";
44 45 }
45 46 }
46 47 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... ... @@ -502,6 +502,27 @@ namespace AIAHTML5.API.Controllers
502 502 return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
503 503 }
504 504 }
  505 +
  506 + [HttpPost]
  507 + [Route("api/ManageUserLoginStatus")]
  508 + public HttpResponseMessage ManageUserLoginStatus([FromBody]JObject jsonData)
  509 + {
  510 + string loginStatus = string.Empty;
  511 + try
  512 + {
  513 + int userId = jsonData["userId"].Value<int>();
  514 + string tagName = jsonData["tagName"].Value<string>();
  515 +
  516 + loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName);
  517 +
  518 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(loginStatus) };
  519 + }
  520 + catch (Exception ex)
  521 + {
  522 + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
  523 + }
  524 + }
  525 +
505 526 // PUT api/authenticate/5
506 527 public void Put(int id, [FromBody]string value)
507 528 {
... ...
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... ... @@ -348,6 +348,42 @@ namespace AIAHTML5.API.Models
348 348 return objUser;
349 349 }
350 350  
  351 + internal static string GetUserLoginStatus(int userId,string tagName)
  352 + {
  353 + string status=string.Empty;
  354 + DBModel objModel = new DBModel();
  355 +
  356 + SqlConnection conn = new SqlConnection(dbConnectionString);
  357 + SqlCommand cmd = new SqlCommand();
  358 + SqlDataAdapter adapter;
  359 + DataSet ds = new DataSet();
  360 +
  361 + cmd.Connection = conn;
  362 + cmd.CommandText = DBConstants.GET_USER_LOGIN_STATUS;
  363 + cmd.CommandType = CommandType.StoredProcedure;
  364 + cmd.Parameters.AddWithValue("@userId", userId);
  365 + cmd.Parameters.AddWithValue("@tag", tagName);
  366 +
  367 + adapter = new SqlDataAdapter(cmd);
  368 + adapter.Fill(ds);
  369 +
  370 + if (ds != null && ds.Tables.Count > 0)
  371 + {
  372 + DataTable dt = ds.Tables[0];
  373 +
  374 + if (dt.Rows.Count > 0)
  375 + {
  376 + foreach (DataRow dr in dt.Rows)
  377 + {
  378 + status = dr["loginStatus"].ToString();
  379 +
  380 + }
  381 + }
  382 + }
  383 +
  384 + return status;
  385 + }
  386 +
351 387 internal User GetSelectedSettings(int userId)
352 388 {
353 389 logger.Debug(" Inside GetSelectedSettings for userId = " + userId);
... ...
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... ... @@ -315,6 +315,14 @@ namespace AIAHTML5.API.Models
315 315 return objUser;
316 316 }
317 317  
  318 + internal static string GetUserLoginStatus(int userId, string tagName)
  319 + {
  320 + string status = null;
  321 + status = DBModel.GetUserLoginStatus(userId, tagName);
  322 +
  323 + return status;
  324 + }
  325 +
318 326 internal static int SaveUserSelectedSettings(User selectedSettings)
319 327 {
320 328 logger.Debug("inside SaveUserSelectedSettings for Image =" + selectedSettings.Id);
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js
... ... @@ -179,7 +179,6 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
179 179 var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json')
180 180 promise.then(
181 181 function (result) {
182   -
183 182 var threeDAnatomyData = new jinqJs()
184 183 .from(result.root.ThreeDAData)
185 184 .orderBy([{ field: '_Title', sort: 'asc' }])
... ... @@ -493,7 +492,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
493 492 $rootScope.ThreeDWindowLoadComplete = true;
494 493 }
495 494 $scope.JsPanelMouseEnter(windowviewid);
496   -
  495 +
497 496 }
498 497  
499 498 $scope.JsPanelMouseEnter = function (windowviewid) {
... ... @@ -502,6 +501,36 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
502 501 //call when module loaded
503 502 $rootScope.resetMenuOption();
504 503  
  504 + var timeintval = null;
  505 + timeintval = $interval(PointerEventEnableDisable, 5000);
  506 +
  507 + function PointerEventEnableDisable() {
  508 + var pointevents = $("#threedImage_" + windowviewid).css('pointer-events');
  509 + if (pointevents=='auto') {
  510 + $scope.stop3drefresh(timeintval);
  511 + timeintval = $interval(PointerEventEnableDisable, 500);
  512 + $("#threedImage_" + windowviewid).css('pointer-events', 'none');
  513 + }
  514 + else if(pointevents=='none')
  515 + {
  516 + $("#threedImage_" + windowviewid).css('pointer-events', 'auto');
  517 + $scope.stop3drefresh(timeintval);
  518 + timeintval = $interval(PointerEventEnableDisable, 5000);
  519 + }
  520 + else
  521 + {
  522 + //auto clode interval when panel close
  523 + $scope.stop3drefresh(timeintval);
  524 + }
  525 + }
  526 +
  527 + $scope.stop3drefresh = function (timeintval) {
  528 + if (angular.isDefined(timeintval)) {
  529 + $interval.cancel(timeintval);
  530 + timeintval = undefined;
  531 + }
  532 + };
  533 +
505 534 // call from while open module in CB
506 535  
507 536 //click event not work on object-tag document
... ... @@ -514,7 +543,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location
514 543  
515 544 });
516 545  
517   - }
  546 + }
518 547  
519 548 $scope.RemoveJSPanel = function (panelid) {
520 549  
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -667,8 +667,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
667 667 if (navigator.cookieEnabled) {
668 668  
669 669 $rootScope.isLoading = false;
670   -
671   -
  670 + $rootScope.isLoginLoading = false;
  671 +
672 672 //unblock user
673 673 if (url.indexOf('?unb:') != -1) {
674 674  
... ... @@ -690,6 +690,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
690 690 if ($scope.currentUserDetails != undefined) {
691 691 AuthenticateAlreadyLoggedInUser();
692 692 }
  693 +
693 694 var isRememberChecked = $rootScope.getLocalStorageValue('isRememberMeChecked');
694 695  
695 696 if ($rootScope.getLocalStorageValue('isRememberMeChecked') != "" && sessionStorage.getItem("loginSession") == null) {
... ... @@ -729,6 +730,20 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
729 730  
730 731 });
731 732 }
  733 + $rootScope.LoginEnableUI=function()
  734 + {
  735 + $rootScope.isLoginLoading = false;
  736 + $('#spinnerLogin').css('visibility', 'hidden');
  737 + $('.loginPanel').css('pointer-events', 'auto');
  738 + $('.loginPanel').css('opacity', '1');
  739 + }
  740 + $rootScope.LoginDisableUI=function()
  741 + {
  742 + $rootScope.isLoginLoading = true;
  743 + $('#spinnerLogin').css('visibility', 'visible');
  744 + $('.loginPanel').css('pointer-events', 'none');
  745 + $('.loginPanel').css('opacity', '0.7');
  746 + }
732 747 $rootScope.AuthenticateUser = function (userInfo) {
733 748 if (navigator.cookieEnabled) {
734 749 $rootScope.errorMessage = "";
... ... @@ -740,13 +755,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
740 755 }
741 756 else {
742 757  
743   -
  758 + $rootScope.LoginDisableUI();
744 759 AuthenticationService.authenticateUser(userInfo)
745 760 .then(
746 761  
747 762 function (result) {
748 763  
749   - if (result == LoginConstants.USER_NOT_FOUND) {
  764 + if (result == LoginConstants.USER_NOT_FOUND) {
  765 + $rootScope.LoginEnableUI();
750 766 $rootScope.isVisibleLogin = true;
751 767 // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);
752 768 $rootScope.errorMessage = LoginMessageConstants.INVALID_USER;
... ... @@ -829,63 +845,70 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
829 845 }
830 846 if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) {
831 847 $rootScope.isVisibleLogin = true;
  848 + $rootScope.LoginEnableUI();
832 849 $rootScope.errorMessage = LoginMessageConstants.INVALID_PASSWORD;
833 850 $("#messageModal").modal('show');
834 851 }
835 852 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_ID_BLOCKED_24_HRS) {
836 853 $rootScope.isVisibleLogin = true;
  854 + $rootScope.LoginEnableUI();
837 855 $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED;
838 856 $("#messageModal").modal('show');
839 857 }
840 858 else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {
841 859 $rootScope.isVisibleLogin = true;
  860 + $rootScope.LoginEnableUI();
842 861 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
843 862 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
844 863 $("#messageModal").modal('show');
845 864 }
846 865 else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {
847 866 $rootScope.isVisibleLogin = true;
  867 + $rootScope.LoginEnableUI();
848 868 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
849 869 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
850 870 $("#messageModal").modal('show');
851 871 }
852 872 else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {
853 873 $rootScope.isVisibleLogin = true;
  874 + $rootScope.LoginEnableUI();
854 875 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
855 876 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
856 877 $("#messageModal").modal('show');
857 878 }
858 879 else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) {
859 880 $rootScope.isVisibleLogin = true;
  881 + $rootScope.LoginEnableUI();
860 882 $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
861 883 $("#messageModal").modal('show');
862 884 }
863 885 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) {
864 886 $rootScope.isVisibleLogin = true;
  887 + $rootScope.LoginEnableUI();
865 888 $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE;
866 889 $("#messageModal").modal('show');
867 890 }
868 891 else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {
869 892 $rootScope.isVisibleLogin = true;
  893 + $rootScope.LoginEnableUI();
870 894 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
871 895 $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
872 896 $("#messageModal").modal('show');
873 897 }
874 898 else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {
875 899 $rootScope.isVisibleLogin = true;
  900 + $rootScope.LoginEnableUI();
876 901 $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
877 902 $("#messageModal").modal('show');
878 903 }
879 904 else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) {
880 905 $rootScope.isVisibleLogin = true;
  906 + $rootScope.LoginEnableUI();
881 907 $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
882 908 $("#messageModal").modal('show');
883 909 }
884 910 else {
885 911  
886   - // set user session time
887   - $rootScope.loadUserSession();
888   -
889 912 //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true
890 913 if (result.LicenseId == 0 && result.IsActive) {
891 914  
... ... @@ -923,6 +946,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
923 946 $location.path('/');
924 947  
925 948 $timeout(function () {
  949 + $rootScope.LoginEnableUI();
926 950 $scope.RedirectToModule();
927 951 }, 100);
928 952  
... ... @@ -941,11 +965,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
941 965 $rootScope.haveRoleAdmin = false;
942 966 }
943 967  
944   - // Remove Admin Link for LicenseEditionId 3/4 of student
945   - if (result.EditionId == 3 || result.EditionId == 4) {
946   - $rootScope.haveRoleAdmin = false;
947   -
948   - }
949 968  
950 969 if (result.UserTypeId == 6) {
951 970 $('#modestyDiv').css('pointerEvent', 'none');
... ... @@ -1007,10 +1026,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1007 1026 //6. reset the isCommingSoonModel to false in local storage so that upcomming module pop up would not show again to the user after firts time
1008 1027 localStorage.setItem('isCommingSoonModel', false);
1009 1028  
1010   - // for reseller type user first need to update profile
1011   - // only instructor ,not student
1012   - if (result.UserTypeId == 7 && result.EditionId == 1 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) {
1013   -
  1029 + // for reseller type user first need to update profile
  1030 + if (result.UserTypeId == 7 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) {
  1031 + $rootScope.LoginEnableUI();
1014 1032 $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE);
1015 1033  
1016 1034 $("#profileUpdateModal").modal('show');
... ... @@ -1021,6 +1039,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1021 1039 else {
1022 1040 $location.path('/');
1023 1041 $timeout(function () {
  1042 + $rootScope.LoginEnableUI();
1024 1043 $scope.RedirectToModule();
1025 1044  
1026 1045 }, 100);
... ... @@ -1031,6 +1050,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1031 1050 $('#dvTerms').html(result.TermsAndConditionsText);
1032 1051 }
1033 1052 $rootScope.isVisibleLogin = true;
  1053 + $rootScope.LoginEnableUI();
1034 1054 $('#dvTermCondition').fadeIn();
1035 1055 $rootScope.userData = result;
1036 1056 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
... ... @@ -1041,6 +1061,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1041 1061  
1042 1062 }
1043 1063  
  1064 + // set user session time
  1065 + $rootScope.loadUserSession();
  1066 + $rootScope.LoginEnableUI();
1044 1067 }
1045 1068  
1046 1069 }
... ... @@ -1050,6 +1073,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1050 1073 function (error) {
1051 1074 console.log(' Error in authentication = ' + error.statusText);
1052 1075 // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
  1076 + $rootScope.LoginEnableUI();
1053 1077 $rootScope.isVisibleLogin = true;
1054 1078 $rootScope.errorMessage = error;
1055 1079 $("#messageModal").modal('show');
... ... @@ -1170,6 +1194,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1170 1194 if (isCalsCredantialForSIte == "True") {
1171 1195 if($rootScope.siteUrlInfo.mtype!=null && $rootScope.siteUrlInfo.mtype.toLowerCase()=='ca' && $rootScope.siteUrlInfo.userId!=null && $rootScope.siteUrlInfo.accountNumber!=null)
1172 1196 {
  1197 + $rootScope.LoginDisableUI();
1173 1198 AuthenticationService.ByPassLoginToOpenModule($rootScope.siteUrlInfo)
1174 1199 .then(
1175 1200 function (result) {
... ... @@ -1183,6 +1208,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1183 1208 }),
1184 1209 function (error) {
1185 1210 console.log(' Error in bypass login = ' + error.statusText);
  1211 + $rootScope.isVisibleLogin = true;
  1212 + $rootScope.LoginEnableUI();
1186 1213 $rootScope.errorMessage = error;
1187 1214 $("#messageModal").modal('show');
1188 1215 }
... ... @@ -1191,53 +1218,56 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1191 1218 else
1192 1219 {
1193 1220 console.log(' invalid detail in bypass login');
  1221 + $rootScope.isVisibleLogin = true;
1194 1222 $rootScope.errorMessage = "authentication is not allowed due to invalid details format .\nPlease pass the correct details again!";
1195 1223 $("#messageModal").modal('show');
1196 1224 }
1197 1225  
1198 1226 }
1199 1227 else {
1200   -
1201 1228 console.log($rootScope.siteUrlInfo);
1202   -
  1229 + $rootScope.LoginDisableUI();
1203 1230 AuthenticationService.validateClientSite($rootScope.siteUrlInfo)
1204 1231 .then(
1205 1232  
1206 1233 function (result) {
1207   -
1208 1234 console.log(result);
1209 1235 if (result != null) {
1210   -
1211   -
1212 1236 console.log(result);
1213 1237 if (result == LoginConstants.INVALID_CLIENT) {
1214 1238 $rootScope.isVisibleLogin = true;
  1239 + $rootScope.LoginEnableUI();
1215 1240 $rootScope.errorMessage = LoginConstants.INVALID_CLIENT;
1216 1241 $("#messageModal").modal('show');
1217 1242 }
1218 1243 else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) {
1219 1244 $rootScope.isVisibleLogin = true;
  1245 + $rootScope.LoginEnableUI();
1220 1246 $rootScope.errorMessage = LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER;
1221 1247 $("#messageModal").modal('show');
1222 1248 }
1223 1249  
1224 1250 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_ACCOUNT_NUMBER_NOT_NULL) {
1225 1251 $rootScope.isVisibleLogin = true;
  1252 + $rootScope.LoginEnableUI();
1226 1253 $rootScope.errorMessage = LoginMessageConstants.E_ACCOUNT_NUMBER_NOT_NULL;
1227 1254 $("#messageModal").modal('show');
1228 1255 }
1229 1256 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_ID_NOT_NULL) {
1230 1257 $rootScope.isVisibleLogin = true;
  1258 + $rootScope.LoginEnableUI();
1231 1259 $rootScope.errorMessage = LoginMessageConstants.E_EDITION_ID_NOT_NULL;
1232 1260 $("#messageModal").modal('show');
1233 1261 }
1234 1262 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_NOT_LINKED_WITH_SITE) {
1235 1263 $rootScope.isVisibleLogin = true;
  1264 + $rootScope.LoginEnableUI();
1236 1265 $rootScope.errorMessage = LoginMessageConstants.E_EDITION_NOT_LINKED_WITH_SITE;
1237 1266 $("#messageModal").modal('show');
1238 1267 }
1239 1268 else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.LICENSE_INACTIVE) {
1240 1269 $rootScope.isVisibleLogin = true;
  1270 + $rootScope.LoginEnableUI();
1241 1271 $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
1242 1272 $("#messageModal").modal('show');
1243 1273 }
... ... @@ -1283,9 +1313,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1283 1313  
1284 1314 $rootScope.siteId = result.siteId;
1285 1315  
1286   - // set user session time
1287   - $rootScope.loadUserSession();
1288   -
1289 1316 // birendra// initialize exp img detail object
1290 1317 $rootScope.initializeUserForExportImage(result.Id);
1291 1318  
... ... @@ -1371,6 +1398,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1371 1398 $('#dvTerms').html(result.TermsAndConditionsText);
1372 1399 }
1373 1400 $rootScope.isVisibleLogin = true;
  1401 + $rootScope.LoginEnableUI();
1374 1402 $('#dvTermCondition').fadeIn();
1375 1403 $rootScope.userData = result;
1376 1404 $rootScope.haveRoleAdmin = false;
... ... @@ -1378,6 +1406,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1378 1406 $location.path('/');
1379 1407 }
1380 1408 }
  1409 + $rootScope.LoginEnableUI();
  1410 + // set user session time
  1411 + $rootScope.loadUserSession();
  1412 +
1381 1413 }
1382 1414  
1383 1415  
... ... @@ -1388,15 +1420,16 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1388 1420  
1389 1421 },
1390 1422  
1391   - function (error) {
  1423 + function (error) {
1392 1424  
1393   - console.log(' Error in authentication = ' + error.statusText);
1394   - // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
1395   - $rootScope.isVisibleLogin = true;
1396   - $rootScope.errorMessage = error;
1397   - $("#messageModal").modal('show');
  1425 + console.log(' Error in authentication = ' + error.statusText);
  1426 + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
  1427 + $rootScope.LoginEnableUI();
  1428 + $rootScope.isVisibleLogin = true;
  1429 + $rootScope.errorMessage = error;
  1430 + $("#messageModal").modal('show');
1398 1431  
1399   - }
  1432 + }
1400 1433 )
1401 1434  
1402 1435 }
... ... @@ -1473,8 +1506,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1473 1506 $rootScope.userModules = userInfo.Modules;
1474 1507 // ShowAssignedModulesPopup(userInfo.Modules);;
1475 1508 // for reseller type user first need to update profile
1476   - // allow popup for instructor ,not for student.
1477   - if (userInfo.UserTypeId == 7 && userInfo.EditionId == 1 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) {
  1509 + if (userInfo.UserTypeId == 7 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) {
1478 1510  
1479 1511 $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE);
1480 1512  
... ... @@ -1522,43 +1554,120 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1522 1554 }
1523 1555  
1524 1556 $rootScope.loadUserSession = function () {
1525   -
1526 1557 Idle.watch();// start the session
  1558 + $rootScope.isSessionTimeout=false;
  1559 + $rootScope.isRedirectToAdmin=false;
  1560 + $rootScope.userStatus = {
  1561 + userId: null,
  1562 + tagName: null,
  1563 + loginStatus: null,
  1564 + }
  1565 + console.log('user session start');
  1566 + $rootScope.CheckUserSession('insert');
1527 1567  
1528   - $scope.$on('IdleStart', function() {
  1568 + $rootScope.$on('IdleStart', function() {
1529 1569 // this event fire when idle time finish and time out start
1530 1570 // config set in AIA.js -:IdleProvider.idle(1*30);;
1531 1571 //alert('start');
1532 1572 });
1533   - $scope.$on('IdleEnd', function() {
  1573 + $rootScope.$on('IdleEnd', function() {
1534 1574 // this event fires by user activity during timeout period
1535 1575 // it reset idle time and timeout
1536 1576 // config set in AIA.js -:IdleProvider.interrupt('keydown wheel mousedown touchstart touchmove scroll');
1537 1577 // alert('end');
1538 1578 });
1539   - $scope.$on('IdleTimeout', function() {
  1579 + $rootScope.$on('IdleTimeout', function() {
1540 1580 // this event fire when idle time finished and time out also finished
1541 1581 // config set in AIA.js -:IdleProvider.timeout(15);
1542   -
1543   - $rootScope.LogoutUser();
1544   - });
1545   -
1546   - $scope.$on('Keepalive', function() {
  1582 + $rootScope.isSessionTimeout=true;
  1583 + console.log('session is timeout');
  1584 + $rootScope.CheckUserSession('logout');
  1585 + });
  1586 + $rootScope.$on('Keepalive', function() {
1547 1587 // it watch the session on perticular time interval during idle time period
1548 1588 // config set in AIA.js -: KeepaliveProvider.interval(10);
1549 1589 //we will use it to recieve request from databse if user logout from admin activity
1550   - //alert('alive');
  1590 + console.log('ping user session');
  1591 + $rootScope.CheckUserSession('update');
1551 1592 });
1552 1593  
  1594 + // $(window).unload(function(event) {
  1595 + // //var isopenResourceRequest = sessionStorage.getItem('isModuleOpenByOpenResource');
  1596 + // if ($rootScope.closetab==true) {
  1597 + // localStorage.removeItem('loggedInUserDetails');
  1598 + // localStorage.clear();
  1599 + // $rootScope.CheckUserSession('logout');
  1600 + // return "Handler for .unload() called.";
  1601 +
  1602 + // }
  1603 +
  1604 + // });
  1605 +
  1606 + $window.onbeforeunload = function (e) {
  1607 + var confirmation = {};
  1608 + // if($location.url()!= "/") {
  1609 + if ($rootScope.isSessionTimeout==false && $rootScope.isRedirectToAdmin==false) {
  1610 + var event = $rootScope.$broadcast('onBeforeUnload', confirmation);
  1611 + if (event.defaultPrevented) {
  1612 + return confirmation.message;
  1613 + }
  1614 + }
  1615 + // }
  1616 +
  1617 + };
1553 1618 }
1554 1619  
  1620 + $rootScope.$on('onBeforeUnload', function (e, confirmation) {
  1621 + confirmation.message = "All data willl be lost.";
  1622 + e.preventDefault();
  1623 + });
  1624 +
1555 1625 $rootScope.LogoutUser = function () {
  1626 + $rootScope.isSessionTimeout=true;
  1627 + localStorage.removeItem('loggedInUserDetails');
  1628 + localStorage.clear();
  1629 + $rootScope.CheckUserSession('logout');
  1630 + $timeout(function(){
  1631 + document.location = '/';
  1632 + $rootScope.isVisibleLogin = true;
  1633 + },50);
  1634 +
  1635 + }
  1636 + $rootScope.LogoutUserSession = function () {
  1637 + $rootScope.isSessionTimeout=true;
1556 1638 localStorage.removeItem('loggedInUserDetails');
1557 1639 localStorage.clear();
1558 1640 document.location = '/';
1559 1641 $rootScope.isVisibleLogin = true;
1560 1642 }
1561 1643  
  1644 + $rootScope.CheckUserSession = function (tagName) {
  1645 + //console.log('user login id: '+$rootScope.userData.Id);
  1646 + //console.log('user login activity tag: '+tagName);
  1647 + if($rootScope.userData==undefined) return;
  1648 + $rootScope.userStatus.userId=$rootScope.userData.Id;
  1649 + $rootScope.userStatus.tagName=tagName;
  1650 + AuthenticationService.ManageUserLoginStatus($rootScope.userStatus)
  1651 + .then(
  1652 + function (loginStatus) {
  1653 + if(loginStatus!=null)
  1654 + {
  1655 + $rootScope.userStatus.loginStatus = loginStatus;
  1656 + if(loginStatus=='False')
  1657 + {
  1658 + $rootScope.LogoutUserSession();
  1659 + }
  1660 + }
  1661 +
  1662 + }),
  1663 + function (error) {
  1664 + console.log(' Error in user login status = ' + error.statusText);
  1665 + $rootScope.errorMessage = error;
  1666 + $("#messageModal").modal('show');
  1667 + }
  1668 +
  1669 + }
  1670 +
1562 1671 function AuthenticateAlreadyLoggedInUser() {
1563 1672  
1564 1673 isCommingSoonModel = $rootScope.getLocalStorageValue('isCommingSoonModel');
... ... @@ -1953,25 +2062,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
1953 2062 });
1954 2063  
1955 2064 $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" });
1956   - $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" });
1957   -
1958   - $window.onbeforeunload = function (e) {
1959   - var confirmation = {};
1960   - if($location.url()!= "/") {
1961   - var event = $rootScope.$broadcast('onBeforeUnload', confirmation);
1962   - if (event.defaultPrevented) {
1963   - return confirmation.message;
1964   - }
1965   - }
1966   -
1967   - };
  2065 + $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" });
1968 2066 });
1969 2067  
1970   - $scope.$on('onBeforeUnload', function (e, confirmation) {
1971   - confirmation.message = "All data willl be lost.";
1972   - e.preventDefault();
1973   - });
1974   -
1975 2068 $rootScope.$on("$locationChangeSuccess", function () {
1976 2069  
1977 2070 $rootScope.HightLightModuleSelection = function (moduleUrl) {
... ... @@ -7348,6 +7441,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
7348 7441 $rootScope.reDirectURLToAdmin = function () {
7349 7442 $("#profileUpdateModal").modal('hide');
7350 7443 $timeout(function () {
  7444 + $rootScope.isRedirectToAdmin=true;
7351 7445 window.location.href = "Admin";
7352 7446 }, 300)
7353 7447  
... ... @@ -7484,6 +7578,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data
7484 7578  
7485 7579 $rootScope.StoreModuleName = function (moduleName) {
7486 7580  
  7581 + // clear UI of external module like encyclopedia,aod
  7582 + if ($('#siteloader').html() != undefined) {
  7583 + $('#siteloader').remove();
  7584 + }
7487 7585 var userid = $rootScope.userData.Id;
7488 7586 $scope.UpdateUserExportImageData(userid,'ModuleName',moduleName);
7489 7587  
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js
1 1 'use strict';
2 2  
3   -AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams", "$window",
4   -function ($scope, $rootScope, log, $location, pages, $routeParams, $window) {
  3 +AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams", "$window","$interval",
  4 +function ($scope, $rootScope, log, $location, pages, $routeParams, $window,$interval) {
5 5  
6 6 //$rootScope.currentActiveModuleTitle = Modules[10].Name;
7 7 //$rootScope.currentActiveModuleTitle = $routeParams.modname;
... ... @@ -59,11 +59,43 @@ function ($scope, $rootScope, log, $location, pages, $routeParams, $window) {
59 59 }
60 60  
61 61 }
  62 + $scope.refreshIdleTime();
62 63 }
63 64 }
64 65 }
65 66 });
66 67  
  68 + $scope.refreshIdleTime = function () {
  69 + var timeintval = null;
  70 + timeintval = $interval(PointerEventEnableDisable, 5000);
  71 +
  72 + function PointerEventEnableDisable() {
  73 + var pointevents = $("#externalLink").css('pointer-events');
  74 + if (pointevents=='auto') {
  75 + $scope.stopLinkRefresh(timeintval);
  76 + timeintval = $interval(PointerEventEnableDisable, 500);
  77 + $("#externalLink").css('pointer-events', 'none');
  78 + }
  79 + else if(pointevents=='none')
  80 + {
  81 + $("#externalLink").css('pointer-events', 'auto');
  82 + $scope.stopLinkRefresh(timeintval);
  83 + timeintval = $interval(PointerEventEnableDisable, 5000);
  84 + }
  85 + else
  86 + {
  87 + //auto clode interval when panel close
  88 + $scope.stopLinkRefresh(timeintval);
  89 + }
  90 + }
  91 +
  92 + $scope.stopLinkRefresh = function (timeintval) {
  93 + if (angular.isDefined(timeintval)) {
  94 + $interval.cancel(timeintval);
  95 + timeintval = undefined;
  96 + }
  97 + };
  98 + }
67 99 $scope.showTabButton = false;
68 100 $scope.IsVisible = function () {
69 101 $scope.scroll();
... ...
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... ... @@ -573,13 +573,8 @@ AIA.config(function ($routeProvider, pages, $locationProvider) {
573 573 }
574 574 });
575 575 AIA.config(function(IdleProvider, KeepaliveProvider) {
576   - IdleProvider.idle(1*20); // 10 minutes idle
577   - IdleProvider.timeout(15); // after 30 seconds idle, time the user out
578   - KeepaliveProvider.interval(10); // 5 minute keep-alive ping
579   - IdleProvider.interrupt('keydown wheel mousedown touchstart touchmove scroll');
580   -})
581   -// .run(function($rootScope, Idle, $log, Keepalive){
582   -// Idle.watch();
583   -
584   -// $log.debug('app started.');
585   -// });
586 576 \ No newline at end of file
  577 + IdleProvider.idle(20*60); // 20 minutes idle
  578 + IdleProvider.timeout(30); // after 30 seconds idle, time the user out
  579 + KeepaliveProvider.interval(10); // 10 seconds keep-alive ping
  580 + IdleProvider.interrupt('keydown mousemove wheel mousedown touchstart touchmove scroll');
  581 +})
587 582 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js
... ... @@ -15,6 +15,7 @@
15 15 console.log('error')
16 16 deferred.reject(data);
17 17 $rootScope.isVisibleLogin = true;
  18 + $scope.LoginEnableUI();
18 19 $rootScope.errorMessage = data;
19 20 $("#messageModal").modal('show');
20 21  
... ... @@ -55,6 +56,29 @@
55 56 deferred.resolve(data);
56 57 }).error(function (data, status, headers, config) {
57 58 console.log('error')
  59 + $rootScope.isVisibleLogin = true;
  60 + $rootScope.LoginEnableUI();
  61 + deferred.reject(data);
  62 + $rootScope.errorMessage = data;
  63 + $("#messageModal").modal('show');
  64 +
  65 + });
  66 + return deferred.promise;
  67 + },
  68 +
  69 + ManageUserLoginStatus: function (logindata) {
  70 + var deferred = $q.defer();//userId tagName
  71 +
  72 + $http.post('/API/api/ManageUserLoginStatus', JSON.stringify(logindata), {
  73 + headers: {
  74 + 'Content-Type': 'application/json'
  75 + }
  76 + })
  77 + .success(function (data, status, headers, config) {
  78 + console.log('success')
  79 + deferred.resolve(data);
  80 + }).error(function (data, status, headers, config) {
  81 + console.log('error')
58 82 deferred.reject(data);
59 83 $rootScope.errorMessage = data;
60 84 $("#messageModal").modal('show');
... ... @@ -120,6 +144,7 @@
120 144 console.log('error')
121 145 deferred.reject(data);
122 146 $rootScope.isVisibleLogin = true;
  147 + $rootScope.LoginEnableUI();
123 148 $rootScope.errorMessage = data;
124 149 $("#messageModal").modal('show');
125 150  
... ...
400-SOURCECODE/AIAHTML5.Web/index.aspx
... ... @@ -221,6 +221,9 @@
221 221 <div class="form-group">
222 222 <button class="btn btn-primary pull-right" ng-click="AuthenticateUser(userInfo)">Log In</button>
223 223 </div>
  224 + <div id="spinnerLogin" class="spinner" ng-show="isLoginLoading" style="visibility:hidden">
  225 + <img id="img-spinner" src="content/images/common/loading.gif" alt="Loading" />
  226 + </div>
224 227 </form>
225 228 </div>
226 229 </div>
... ...
400-SOURCECODE/Admin/package-lock.json
... ... @@ -276,6 +276,16 @@
276 276 "tsickle": "^0.21.0"
277 277 }
278 278 },
  279 + "@ng-idle/core": {
  280 + "version": "2.0.0-beta.9",
  281 + "resolved": "https://registry.npmjs.org/@ng-idle/core/-/core-2.0.0-beta.9.tgz",
  282 + "integrity": "sha1-+ZsIF0kc2lTAh9bNhs7SMQ//5qQ="
  283 + },
  284 + "@ng-idle/keepalive": {
  285 + "version": "2.0.0-beta.9",
  286 + "resolved": "https://registry.npmjs.org/@ng-idle/keepalive/-/keepalive-2.0.0-beta.9.tgz",
  287 + "integrity": "sha1-f3HkrIcG042pZl04JWDPv72IEh8="
  288 + },
279 289 "@ng-select/ng-select": {
280 290 "version": "2.20.5",
281 291 "resolved": "https://registry.npmjs.org/@ng-select/ng-select/-/ng-select-2.20.5.tgz",
... ... @@ -485,6 +495,14 @@
485 495 "resolved": "https://registry.npmjs.org/angular2-json2csv/-/angular2-json2csv-1.1.2.tgz",
486 496 "integrity": "sha1-ETRWynbEyZiLU44jAUHCwT4DxpI="
487 497 },
  498 + "angular2-moment": {
  499 + "version": "1.9.0",
  500 + "resolved": "https://registry.npmjs.org/angular2-moment/-/angular2-moment-1.9.0.tgz",
  501 + "integrity": "sha512-ybPjYizpKVWAI2Z4AqxAS6s3FMkF3+zRpfvxX1wIdSJUFjl83XxQ5f2yn7retX68NSYZZ/JTK9KGnvOzZfrIZw==",
  502 + "requires": {
  503 + "moment": "^2.19.3"
  504 + }
  505 + },
488 506 "angular4-slimscroll": {
489 507 "version": "1.0.5",
490 508 "resolved": "https://registry.npmjs.org/angular4-slimscroll/-/angular4-slimscroll-1.0.5.tgz",
... ... @@ -7001,6 +7019,11 @@
7001 7019 "minimist": "0.0.8"
7002 7020 }
7003 7021 },
  7022 + "moment": {
  7023 + "version": "2.28.0",
  7024 + "resolved": "https://registry.npmjs.org/moment/-/moment-2.28.0.tgz",
  7025 + "integrity": "sha512-Z5KOjYmnHyd/ukynmFd/WwyXHd7L4J9vTI/nn5Ap9AVUgaAE15VvQ9MOGmJJygEUklupqIrFnor/tjTwRU+tQw=="
  7026 + },
7004 7027 "move-concurrently": {
7005 7028 "version": "1.0.1",
7006 7029 "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
... ...
400-SOURCECODE/Admin/package.json
... ... @@ -23,9 +23,12 @@
23 23 "@angular/platform-browser": "^4.2.4",
24 24 "@angular/platform-browser-dynamic": "^4.2.4",
25 25 "@angular/router": "^4.2.4",
  26 + "@ng-idle/core": "^2.0.0-beta.9",
  27 + "@ng-idle/keepalive": "^2.0.0-beta.9",
26 28 "@ng-select/ng-select": "^2.1.2",
27 29 "@types/node": "^6.0.102",
28 30 "angular2-json2csv": "^1.1.2",
  31 + "angular2-moment": "^1.9.0",
29 32 "angular4-slimscroll": "^1.0.5",
30 33 "classlist.js": "1.1.20150312",
31 34 "core-js": "^2.5.3",
... ...
400-SOURCECODE/Admin/src/app/app.component.html
... ... @@ -106,7 +106,7 @@
106 106 <div class="wel-brog">
107 107 <div class="btn-group pull-right mob1">
108 108 <ul class="nav navbar-nav navbar-right hidden-sm">
109   - <li class="marginR5" data-toggle="tooltip" data-placement="top" title="Logout"><a (click)="logout()"><i class="fa fa-power-off"></i></a></li>
  109 + <li class="marginR5" data-toggle="tooltip" data-placement="top" title="Logout"><a (click)="logout()"><i class="fa fa-power-off" style="cursor:pointer"></i></a></li>
110 110 </ul>
111 111 </div>
112 112 <div class="btn-group pull-right hidden-sm mar-top17 mob2">
... ...
400-SOURCECODE/Admin/src/app/app.component.ts
... ... @@ -8,6 +8,10 @@ import { UserManageRightsModel } from &#39;./components/userentity/datamodel&#39;;
8 8 //import { MyAuthService } from './shared/my-auth.service';
9 9 import { GlobalService } from './shared/global';
10 10 import { Router, NavigationEnd } from '@angular/router';
  11 +import { LoadingService } from './shared/loading.service';
  12 +import {Idle, DEFAULT_INTERRUPTSOURCES} from '@ng-idle/core';
  13 +import {Keepalive} from '@ng-idle/keepalive';
  14 +import { Title } from '@angular/platform-browser';
11 15  
12 16 //import { HttpClient } from '@angular/common/http';
13 17 //import { HttpErrorResponse } from '@angular/common/http';
... ... @@ -28,8 +32,56 @@ export class AppComponent implements OnInit {
28 32 public UpdateProfileVisible: boolean;
29 33 public UserManageRightsList: Array<UserManageRightsModel>;
30 34  
31   - constructor(private userservice: UserService, public global: GlobalService, private router: Router,
32   - ) { }
  35 + constructor(private idle: Idle, private keepalive: Keepalive,private titleService: Title,private userservice: UserService,private _loadingService: LoadingService, public global: GlobalService, private router: Router,) {
  36 + const projectTitle= this.titleService.getTitle();
  37 +
  38 + // sets an idle timeout of 20 minutes.
  39 + this.idle.setIdle(20*60);
  40 +
  41 + // sets a timeout period of 30 seconds. after 30 seconds of inactivity, the user will be considered timed out.
  42 + this.idle.setTimeout(30);
  43 +
  44 + // sets the ping interval to 10 seconds
  45 + this.keepalive.interval(10);
  46 +
  47 + // sets the default interrupts, in this case, things like clicks, scrolls,mousemove touches to the document
  48 + this.idle.setInterrupts(DEFAULT_INTERRUPTSOURCES);
  49 +
  50 + this.idle.onInterrupt.subscribe(() => {
  51 + this.titleService.setTitle(projectTitle);
  52 + })
  53 +
  54 + this.idle.onTimeout.subscribe(() => {
  55 + //console.log("Timed out!");
  56 + this.titleService.setTitle('Your session has expired!');
  57 + this._loadingService.ShowLoading("global-loading");
  58 + this.loginManageStatus('logout');
  59 + });
  60 +
  61 + this.idle.onTimeoutWarning.subscribe((countdown) => {
  62 + // console.log("You will time out in "+countdown);
  63 + var minute=Math.floor(countdown/60);
  64 + var remaining = minute+':'+(("00" + (countdown - minute * 60)).slice(-2) );
  65 + this.titleService.setTitle(remaining+' until your session times out!');
  66 + });
  67 +
  68 + this.keepalive.onPing.subscribe(() =>{
  69 + // this.lastPing = new Date();
  70 + // console.log("last ping: "+this.lastPing);
  71 + this.loginManageStatus('update');
  72 + });
  73 +
  74 + // this.idle.onIdleEnd.subscribe(() => {
  75 + // console.log("No longer idle. ");
  76 + // });
  77 + // this.idle.onIdleStart.subscribe(() =>{
  78 + // console.log("You\'ve gone idle!");
  79 + // });
  80 +
  81 + this.idle.watch();
  82 +
  83 + }
  84 +
33 85 ngOnInit(): void {
34 86 this.menustaus = "True";
35 87 this.global.getJSON().subscribe(data => {
... ... @@ -69,17 +121,38 @@ export class AppComponent implements OnInit {
69 121 }
70 122 }
71 123 }, error => console.log(error));
72   -
73   -
74 124 }
  125 +
75 126 logout() {
76   - localStorage.removeItem('loggedInUserDetails');
77   - //window.location.href = this.global.LiveURL;
78   - window.location.href = window.location.origin;
  127 + this._loadingService.ShowLoading("global-loading");
  128 + this.loginManageStatus('logout');
  129 + }
  130 + loginManageStatus(tagname:string) {
  131 + this.userservice.ManageUserLoginStatus({
  132 + userId: this.global.UserId,
  133 + tagName: tagname
  134 + }).subscribe(status => {
  135 + console.log(status);
  136 + if(status=='False')
  137 + {
  138 + if(tagname=='logout')
  139 + {
  140 + this._loadingService.HideLoading("global-loading");
  141 + }
  142 +
  143 + // comments below statement while unit testing on 'ng serve --open' command
  144 +
  145 + // localStorage.removeItem('loggedInUserDetails');
  146 + // window.location.href = window.location.origin;
  147 + }
  148 +
  149 + },error => console.log(error));
79 150 }
  151 +
80 152 Product() {
81 153 //window.location.href = this.global.LiveURL;
82 154 window.location.href = window.location.origin;
83 155 //this.router.navigate([this.global.LiveURL]);
84 156 }
  157 +
85 158 }
... ...
400-SOURCECODE/Admin/src/app/app.module.ts
1 1 import { FormsModule, ReactiveFormsModule } from '@angular/forms';
2   -import { BrowserModule } from '@angular/platform-browser';
  2 +import { BrowserModule,Title } from '@angular/platform-browser';
3 3 import { NgModule } from '@angular/core';
4 4 import { RouterModule, Routes } from '@angular/router';
5 5 import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
... ... @@ -8,6 +8,10 @@ import { HttpModule } from &#39;@angular/http&#39;;
8 8 //import { Ng2SmartTableModule } from 'ng2-smart-table';
9 9 import { Ng2Bs3ModalModule } from 'ng2-bs3-modal/ng2-bs3-modal';
10 10 import { CsvService } from "angular2-json2csv";
  11 +
  12 +import { NgIdleKeepaliveModule } from '@ng-idle/keepalive';
  13 +import { MomentModule } from 'angular2-moment';
  14 +
11 15 import { BsDatepickerModule, ModalModule } from 'ngx-bootstrap';
12 16 import { BsModalService } from 'ngx-bootstrap/modal';
13 17 import { BsDropdownModule } from 'ngx-bootstrap';
... ... @@ -83,11 +87,11 @@ import { MyFilterPipe } from &#39;./shared/my-filter.pipe&#39;;
83 87 ],
84 88 imports: [
85 89 BrowserModule, AppRoutingModule, HttpClientModule, FormsModule, ReactiveFormsModule, HttpModule, Ng2Bs3ModalModule,
86   - BsDatepickerModule.forRoot(), ModalModule.forRoot(), BsDropdownModule.forRoot(), Ng2OrderModule
  90 + BsDatepickerModule.forRoot(), ModalModule.forRoot(), BsDropdownModule.forRoot(), Ng2OrderModule,MomentModule,NgIdleKeepaliveModule.forRoot()
87 91 //ModalModule.forRoot()
88 92 // , AngularFireModule.initializeApp(firebaseConfig),
89 93 ],
90   - providers: [GlobalService, ConfirmService, BsModalService, LoadingService, CsvService,
  94 + providers: [GlobalService, ConfirmService, BsModalService, LoadingService, CsvService,Title,
91 95 // MyAuthService, AngularFireAuth, FirebaseApp, AngularFireModule,
92 96  
93 97 //AuthService,
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/updateuserprofile.component.ts
... ... @@ -91,7 +91,6 @@ export class UpdateUserProfile implements OnInit {
91 91  
92 92 this.userservice.GetUserById()
93 93 .subscribe(x => { console.log(x); this.bindUsers(x) }, error => this.error = <any>error);
94   - this._loadingService.HideLoading("global-loading");
95 94 }
96 95 UpdateUserProfile() {
97 96 this.alerts = '';
... ... @@ -114,7 +113,7 @@ export class UpdateUserProfile implements OnInit {
114 113  
115 114 if (this.userFrm.valid && this.alerts == '') {
116 115 var obj = this.userFrm.value;
117   -
  116 + this._loadingService.ShowLoading("global-loading");
118 117 return this.userservice.UpdateUserProfileById(obj)
119 118 .subscribe(
120 119 n => (this.AfterInsertData(n)),
... ... @@ -122,7 +121,8 @@ export class UpdateUserProfile implements OnInit {
122 121 }
123 122 }
124 123 AfterInsertData(data) {
125   - if (data.Status == "False") {
  124 + if (data.Status == "False") {
  125 + this._loadingService.HideLoading("global-loading");
126 126 return false;
127 127 } else {
128 128 this.status = true;
... ... @@ -132,6 +132,7 @@ export class UpdateUserProfile implements OnInit {
132 132 loggedInUser.LastName = this.userFrm.value.lastName;
133 133 localStorage.setItem("loggedInUserDetails", JSON.stringify(loggedInUser));
134 134 this.global.DisplayName = loggedInUser.FirstName + " " + loggedInUser.LastName;
  135 + this._loadingService.HideLoading("global-loading");
135 136 this._confirmService.activate("User Profile Updated Successfully.", "alertMsg");
136 137  
137 138 }
... ... @@ -147,7 +148,8 @@ export class UpdateUserProfile implements OnInit {
147 148 this.userFrm.controls['id'].setValue(this.user.Id)
148 149 this.userFrm.controls['firstName'].setValue(this.user.FirstName)
149 150 this.userFrm.controls['lastName'].setValue(this.user.LastName)
150   - this.userFrm.controls['emailId'].setValue(this.user.EmailId)
  151 + this.userFrm.controls['emailId'].setValue(this.user.EmailId);
  152 + this._loadingService.HideLoading("global-loading");
151 153 }
152 154  
153 155 validationMessages = {
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts
... ... @@ -54,6 +54,20 @@ export class UserService {
54 54 }
55 55 //////////// End /////////////////////
56 56  
  57 + //////////Manage UserLogin Status///////////
  58 + ManageUserLoginStatus(obj: any) {
  59 + var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName };
  60 + console.log(obj);
  61 + var headers = new Headers({
  62 + 'Content-Type': 'application/json'
  63 + });
  64 + return this.http.post(this.commonService.resourceBaseUrl + "User/ManageUserLoginStatus",
  65 + JSON.stringify(jsonData), { headers: headers })
  66 + .map(this.extractData)
  67 + .catch((res: Response) => this.handleError(res));
  68 + }
  69 + //////////// End /////////////////////
  70 +
57 71  
58 72  
59 73 //////////Update User Userid///////////////
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.html
... ... @@ -119,6 +119,7 @@
119 119 <th>Account Number</th>
120 120 <th>Product Edition</th>
121 121 <th>Status</th>
  122 + <th>Login Status</th>
122 123 </tr>
123 124 </thead>
124 125  
... ... @@ -143,6 +144,10 @@
143 144 <span *ngIf="UserEntity.UserStatus=='Active'" class="label label-success">Active</span>
144 145 <span *ngIf="UserEntity.UserStatus!='Active'" class="label label-default">Inactive</span>
145 146 </td>
  147 + <td>
  148 + <span *ngIf="UserEntity.LoginStatus==true" class="label label-success">Logged-In</span>
  149 + <span *ngIf="UserEntity.LoginStatus==false" class="label label-default">Logged-Out</span>
  150 + </td>
146 151 </tr>
147 152  
148 153  
... ... @@ -156,9 +161,11 @@
156 161 <div [style.display]="(global.UserTypeName=='Super Admin') ? 'block' : 'none'">
157 162 <button class="btn btn-primary btn-sm" (click)="EditManageUserRights()" [ngClass]="{disabled : !buttonStatus}"><i class="fa fa-thumbs-up"></i> Manage Rights</button>
158 163 <button class="btn btn-primary btn-sm" (click)="EditUser()" [ngClass]="{disabled : !EditbuttonStatus}"><i class="fa fa-edit"></i> Edit</button>
  164 + <button class="btn btn-primary btn-sm" (click)="ForceLogoutUser()" [ngClass]="{disabled : !logoutUserSession}"><i class="fa fa-power-off"></i> Logout User</button>
159 165 </div>
160 166 <div [style.display]="(global.UserTypeName!='Super Admin') ? 'block' : 'none'">
161 167 <button class="btn btn-primary btn-sm" (click)="EditUser()" [ngClass]="{disabled : !EditbuttonStatus}"><i class="fa fa-edit"></i> Edit</button>
  168 + <button class="btn btn-primary btn-sm" (click)="ForceLogoutUser()" [ngClass]="{disabled : !logoutUserSession}"><i class="fa fa-power-off"></i> Logout User</button>
162 169 </div>
163 170 </div>
164 171 </div>
... ...
400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts
... ... @@ -58,6 +58,7 @@ export class UsersList implements OnInit, AfterViewChecked {
58 58 UncheckedRecords: Array<number>;
59 59 buttonStatus: boolean;
60 60 EditbuttonStatus: boolean;
  61 + logoutUserSession: boolean;
61 62 //@ViewChild("profileModal")
62 63 //profileModal: ModalComponent;
63 64 //errorMessage: any;
... ... @@ -127,7 +128,6 @@ export class UsersList implements OnInit, AfterViewChecked {
127 128 this._loadingService.ShowLoading("global-loading");
128 129 this.GetUserType();
129 130 this.GetAccountType();
130   - this._loadingService.HideLoading("global-loading");
131 131 this.recordCount = 0;
132 132 this.pageNo = 1;
133 133 this.pageLength = 10;
... ... @@ -168,8 +168,6 @@ export class UsersList implements OnInit, AfterViewChecked {
168 168 testScript.setAttribute("type", "text/javascript");
169 169 document.body.appendChild(testScript);
170 170 }
171   -
172   - this._loadingService.HideLoading("global-loading");
173 171  
174 172 //this.GetUserList();
175 173 }
... ... @@ -234,6 +232,14 @@ export class UsersList implements OnInit, AfterViewChecked {
234 232 else {
235 233 this.buttonStatus = null;
236 234 }
  235 + if (item['LoginStatus'] == true) {
  236 + this.logoutUserSession=true;
  237 + }
  238 + else{
  239 + this.logoutUserSession = null;
  240 + }
  241 +
  242 +
237 243 }
238 244 public SetClickedRowManageRight(j: number, item: any) {
239 245  
... ... @@ -275,7 +281,6 @@ export class UsersList implements OnInit, AfterViewChecked {
275 281 var tempArr = evt.split(',');
276 282 this.pageNo = parseInt(tempArr[0]);
277 283 this.pageLength = parseInt(tempArr[1]);
278   - this._loadingService.ShowLoading("global-loading");
279 284 var UserFilterControl = this.Users.value;
280 285  
281 286 this.userservice.GetUserList(
... ... @@ -292,6 +297,8 @@ export class UsersList implements OnInit, AfterViewChecked {
292 297  
293 298 }
294 299 SearchRecords() {
  300 + this.EditbuttonStatus=undefined;
  301 + this.logoutUserSession=undefined;
295 302 this.buttonStatus = null;
296 303 this.selectedRow = -1;
297 304 this.SearchUserList('1, ' + this.pageLength);
... ... @@ -309,12 +316,15 @@ export class UsersList implements OnInit, AfterViewChecked {
309 316 }
310 317 }
311 318 CancelEditUser() {
312   - this.SearchUserList('1, ' + this.pageLength);
  319 + this.SearchUserList(this.pageNo +','+ this.pageLength);
313 320 this.Mode = 'Manage';
314 321 this.modalTitle = 'LIST USER';
315 322 this.topPos = '2000px';
316 323 this.divClass = 'col-sm-12';
317 324 this.selectedRow = -1;
  325 + this.EditbuttonStatus=undefined;
  326 + this.buttonStatus=undefined;
  327 + this.logoutUserSession=undefined;
318 328 }
319 329 EditUser() {
320 330 if (this.EditbuttonStatus) {
... ... @@ -375,7 +385,23 @@ export class UsersList implements OnInit, AfterViewChecked {
375 385 //this.managerightFrm.contains['UserId'].setValue(this.UserEntity.Id);
376 386  
377 387 }
378   -
  388 + ForceLogoutUser(){
  389 + if (this.logoutUserSession) {
  390 + this._loadingService.ShowLoading("global-loading");
  391 + this.userservice.ManageUserLoginStatus({
  392 + userId: this.selectedId,
  393 + tagName: 'logout'
  394 + }).subscribe(x => {
  395 + console.log(x);
  396 + this.EditbuttonStatus=undefined;
  397 + this.logoutUserSession=undefined;
  398 + this.buttonStatus = null;
  399 + this.selectedRow = -1;
  400 + this.SearchUserList(this.pageNo +','+ this.pageLength);
  401 +
  402 + },error => console.log(error));
  403 + }
  404 + }
379 405  
380 406 public UpdateUser() {
381 407 this.alerts = '';
... ...
400-SOURCECODE/Admin/src/assets/styles/bootstrap.css
... ... @@ -1325,7 +1325,7 @@ pre code {
1325 1325 width: 50%;
1326 1326 }
1327 1327 .col-lg-5 {
1328   - width: 41.66666667%;
  1328 + width: 45.66666667%;
1329 1329 }
1330 1330 .col-lg-4 {
1331 1331 width: 33.33333333%;
... ...