Merged
Merge Request #1020
·
created by
Add timeout
merge session time out to develop branch
From
AddTimeout
into
AIA_Develop
Showing
27 changed files
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
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
1 | 1 | 'use strict'; |
2 | 2 | |
3 | -AIA.controller("HomeController", ["$rootScope", "$scope", "Modules", "$log", "$location", "$compile", "$timeout", "DataService", "AuthenticationService", "ConfigurationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", "AIAConstants","ModuleService","$window", | |
4 | -function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, DataService, AuthenticationService, ConfigurationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants, AIAConstants, ModuleService,$window) { | |
3 | +AIA.controller("HomeController", ["$rootScope", "$scope", "Modules", "$log", "$location", "$compile", "$timeout", "DataService", "AuthenticationService", "ConfigurationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", "AIAConstants","ModuleService","$window","Idle", "Keepalive", | |
4 | +function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, DataService, AuthenticationService, ConfigurationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants, AIAConstants, ModuleService,$window,Idle, Keepalive) { | |
5 | 5 | |
6 | 6 | //$scope.pageToOpen = { |
7 | 7 | // name: 'MainMenu' |
... | ... | @@ -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) { |
... | ... | @@ -718,7 +719,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
718 | 719 | $scope.helpTopicLink(); |
719 | 720 | }, 2000); |
720 | 721 | |
721 | - | |
722 | 722 | } |
723 | 723 | $rootScope.getConfigurationValues = function () { |
724 | 724 | ConfigurationService.getCofigValue() |
... | ... | @@ -730,6 +730,20 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
730 | 730 | |
731 | 731 | }); |
732 | 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 | + } | |
733 | 747 | $rootScope.AuthenticateUser = function (userInfo) { |
734 | 748 | if (navigator.cookieEnabled) { |
735 | 749 | $rootScope.errorMessage = ""; |
... | ... | @@ -741,13 +755,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
741 | 755 | } |
742 | 756 | else { |
743 | 757 | |
744 | - | |
758 | + $rootScope.LoginDisableUI(); | |
745 | 759 | AuthenticationService.authenticateUser(userInfo) |
746 | 760 | .then( |
747 | 761 | |
748 | 762 | function (result) { |
749 | 763 | |
750 | - if (result == LoginConstants.USER_NOT_FOUND) { | |
764 | + if (result == LoginConstants.USER_NOT_FOUND) { | |
765 | + $rootScope.LoginEnableUI(); | |
751 | 766 | $rootScope.isVisibleLogin = true; |
752 | 767 | // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); |
753 | 768 | $rootScope.errorMessage = LoginMessageConstants.INVALID_USER; |
... | ... | @@ -830,61 +845,70 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
830 | 845 | } |
831 | 846 | if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) { |
832 | 847 | $rootScope.isVisibleLogin = true; |
848 | + $rootScope.LoginEnableUI(); | |
833 | 849 | $rootScope.errorMessage = LoginMessageConstants.INVALID_PASSWORD; |
834 | 850 | $("#messageModal").modal('show'); |
835 | 851 | } |
836 | 852 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_ID_BLOCKED_24_HRS) { |
837 | 853 | $rootScope.isVisibleLogin = true; |
854 | + $rootScope.LoginEnableUI(); | |
838 | 855 | $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED; |
839 | 856 | $("#messageModal").modal('show'); |
840 | 857 | } |
841 | 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) { |
842 | 859 | $rootScope.isVisibleLogin = true; |
860 | + $rootScope.LoginEnableUI(); | |
843 | 861 | $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; |
844 | 862 | $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; |
845 | 863 | $("#messageModal").modal('show'); |
846 | 864 | } |
847 | 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) { |
848 | 866 | $rootScope.isVisibleLogin = true; |
867 | + $rootScope.LoginEnableUI(); | |
849 | 868 | $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; |
850 | 869 | $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; |
851 | 870 | $("#messageModal").modal('show'); |
852 | 871 | } |
853 | 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) { |
854 | 873 | $rootScope.isVisibleLogin = true; |
874 | + $rootScope.LoginEnableUI(); | |
855 | 875 | $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; |
856 | 876 | $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; |
857 | 877 | $("#messageModal").modal('show'); |
858 | 878 | } |
859 | 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)) { |
860 | 880 | $rootScope.isVisibleLogin = true; |
881 | + $rootScope.LoginEnableUI(); | |
861 | 882 | $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; |
862 | 883 | $("#messageModal").modal('show'); |
863 | 884 | } |
864 | 885 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) { |
865 | 886 | $rootScope.isVisibleLogin = true; |
887 | + $rootScope.LoginEnableUI(); | |
866 | 888 | $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE; |
867 | 889 | $("#messageModal").modal('show'); |
868 | 890 | } |
869 | 891 | else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) { |
870 | 892 | $rootScope.isVisibleLogin = true; |
893 | + $rootScope.LoginEnableUI(); | |
871 | 894 | $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; |
872 | 895 | $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; |
873 | 896 | $("#messageModal").modal('show'); |
874 | 897 | } |
875 | 898 | else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) { |
876 | 899 | $rootScope.isVisibleLogin = true; |
900 | + $rootScope.LoginEnableUI(); | |
877 | 901 | $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; |
878 | 902 | $("#messageModal").modal('show'); |
879 | 903 | } |
880 | 904 | else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) { |
881 | 905 | $rootScope.isVisibleLogin = true; |
906 | + $rootScope.LoginEnableUI(); | |
882 | 907 | $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; |
883 | 908 | $("#messageModal").modal('show'); |
884 | 909 | } |
885 | 910 | else { |
886 | 911 | |
887 | - | |
888 | 912 | //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true |
889 | 913 | if (result.LicenseId == 0 && result.IsActive) { |
890 | 914 | |
... | ... | @@ -922,6 +946,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
922 | 946 | $location.path('/'); |
923 | 947 | |
924 | 948 | $timeout(function () { |
949 | + $rootScope.LoginEnableUI(); | |
925 | 950 | $scope.RedirectToModule(); |
926 | 951 | }, 100); |
927 | 952 | |
... | ... | @@ -940,11 +965,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
940 | 965 | $rootScope.haveRoleAdmin = false; |
941 | 966 | } |
942 | 967 | |
943 | - // Remove Admin Link for LicenseEditionId 3/4 of student | |
944 | - if (result.EditionId == 3 || result.EditionId == 4) { | |
945 | - $rootScope.haveRoleAdmin = false; | |
946 | - | |
947 | - } | |
948 | 968 | |
949 | 969 | if (result.UserTypeId == 6) { |
950 | 970 | $('#modestyDiv').css('pointerEvent', 'none'); |
... | ... | @@ -1006,10 +1026,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1006 | 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 |
1007 | 1027 | localStorage.setItem('isCommingSoonModel', false); |
1008 | 1028 | |
1009 | - // for reseller type user first need to update profile | |
1010 | - // only instructor ,not student | |
1011 | - if (result.UserTypeId == 7 && result.EditionId == 1 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) { | |
1012 | - | |
1029 | + // for reseller type user first need to update profile | |
1030 | + if (result.UserTypeId == 7 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) { | |
1031 | + $rootScope.LoginEnableUI(); | |
1013 | 1032 | $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE); |
1014 | 1033 | |
1015 | 1034 | $("#profileUpdateModal").modal('show'); |
... | ... | @@ -1020,6 +1039,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1020 | 1039 | else { |
1021 | 1040 | $location.path('/'); |
1022 | 1041 | $timeout(function () { |
1042 | + $rootScope.LoginEnableUI(); | |
1023 | 1043 | $scope.RedirectToModule(); |
1024 | 1044 | |
1025 | 1045 | }, 100); |
... | ... | @@ -1030,6 +1050,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1030 | 1050 | $('#dvTerms').html(result.TermsAndConditionsText); |
1031 | 1051 | } |
1032 | 1052 | $rootScope.isVisibleLogin = true; |
1053 | + $rootScope.LoginEnableUI(); | |
1033 | 1054 | $('#dvTermCondition').fadeIn(); |
1034 | 1055 | $rootScope.userData = result; |
1035 | 1056 | localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); |
... | ... | @@ -1040,6 +1061,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1040 | 1061 | |
1041 | 1062 | } |
1042 | 1063 | |
1064 | + // set user session time | |
1065 | + $rootScope.loadUserSession(); | |
1066 | + $rootScope.LoginEnableUI(); | |
1043 | 1067 | } |
1044 | 1068 | |
1045 | 1069 | } |
... | ... | @@ -1049,6 +1073,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1049 | 1073 | function (error) { |
1050 | 1074 | console.log(' Error in authentication = ' + error.statusText); |
1051 | 1075 | // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); |
1076 | + $rootScope.LoginEnableUI(); | |
1052 | 1077 | $rootScope.isVisibleLogin = true; |
1053 | 1078 | $rootScope.errorMessage = error; |
1054 | 1079 | $("#messageModal").modal('show'); |
... | ... | @@ -1169,6 +1194,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1169 | 1194 | if (isCalsCredantialForSIte == "True") { |
1170 | 1195 | if($rootScope.siteUrlInfo.mtype!=null && $rootScope.siteUrlInfo.mtype.toLowerCase()=='ca' && $rootScope.siteUrlInfo.userId!=null && $rootScope.siteUrlInfo.accountNumber!=null) |
1171 | 1196 | { |
1197 | + $rootScope.LoginDisableUI(); | |
1172 | 1198 | AuthenticationService.ByPassLoginToOpenModule($rootScope.siteUrlInfo) |
1173 | 1199 | .then( |
1174 | 1200 | function (result) { |
... | ... | @@ -1182,6 +1208,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1182 | 1208 | }), |
1183 | 1209 | function (error) { |
1184 | 1210 | console.log(' Error in bypass login = ' + error.statusText); |
1211 | + $rootScope.isVisibleLogin = true; | |
1212 | + $rootScope.LoginEnableUI(); | |
1185 | 1213 | $rootScope.errorMessage = error; |
1186 | 1214 | $("#messageModal").modal('show'); |
1187 | 1215 | } |
... | ... | @@ -1190,53 +1218,56 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1190 | 1218 | else |
1191 | 1219 | { |
1192 | 1220 | console.log(' invalid detail in bypass login'); |
1221 | + $rootScope.isVisibleLogin = true; | |
1193 | 1222 | $rootScope.errorMessage = "authentication is not allowed due to invalid details format .\nPlease pass the correct details again!"; |
1194 | 1223 | $("#messageModal").modal('show'); |
1195 | 1224 | } |
1196 | 1225 | |
1197 | 1226 | } |
1198 | 1227 | else { |
1199 | - | |
1200 | 1228 | console.log($rootScope.siteUrlInfo); |
1201 | - | |
1229 | + $rootScope.LoginDisableUI(); | |
1202 | 1230 | AuthenticationService.validateClientSite($rootScope.siteUrlInfo) |
1203 | 1231 | .then( |
1204 | 1232 | |
1205 | 1233 | function (result) { |
1206 | - | |
1207 | 1234 | console.log(result); |
1208 | 1235 | if (result != null) { |
1209 | - | |
1210 | - | |
1211 | 1236 | console.log(result); |
1212 | 1237 | if (result == LoginConstants.INVALID_CLIENT) { |
1213 | 1238 | $rootScope.isVisibleLogin = true; |
1239 | + $rootScope.LoginEnableUI(); | |
1214 | 1240 | $rootScope.errorMessage = LoginConstants.INVALID_CLIENT; |
1215 | 1241 | $("#messageModal").modal('show'); |
1216 | 1242 | } |
1217 | 1243 | else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) { |
1218 | 1244 | $rootScope.isVisibleLogin = true; |
1245 | + $rootScope.LoginEnableUI(); | |
1219 | 1246 | $rootScope.errorMessage = LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER; |
1220 | 1247 | $("#messageModal").modal('show'); |
1221 | 1248 | } |
1222 | 1249 | |
1223 | 1250 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_ACCOUNT_NUMBER_NOT_NULL) { |
1224 | 1251 | $rootScope.isVisibleLogin = true; |
1252 | + $rootScope.LoginEnableUI(); | |
1225 | 1253 | $rootScope.errorMessage = LoginMessageConstants.E_ACCOUNT_NUMBER_NOT_NULL; |
1226 | 1254 | $("#messageModal").modal('show'); |
1227 | 1255 | } |
1228 | 1256 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_ID_NOT_NULL) { |
1229 | 1257 | $rootScope.isVisibleLogin = true; |
1258 | + $rootScope.LoginEnableUI(); | |
1230 | 1259 | $rootScope.errorMessage = LoginMessageConstants.E_EDITION_ID_NOT_NULL; |
1231 | 1260 | $("#messageModal").modal('show'); |
1232 | 1261 | } |
1233 | 1262 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_NOT_LINKED_WITH_SITE) { |
1234 | 1263 | $rootScope.isVisibleLogin = true; |
1264 | + $rootScope.LoginEnableUI(); | |
1235 | 1265 | $rootScope.errorMessage = LoginMessageConstants.E_EDITION_NOT_LINKED_WITH_SITE; |
1236 | 1266 | $("#messageModal").modal('show'); |
1237 | 1267 | } |
1238 | 1268 | else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.LICENSE_INACTIVE) { |
1239 | 1269 | $rootScope.isVisibleLogin = true; |
1270 | + $rootScope.LoginEnableUI(); | |
1240 | 1271 | $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; |
1241 | 1272 | $("#messageModal").modal('show'); |
1242 | 1273 | } |
... | ... | @@ -1367,6 +1398,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1367 | 1398 | $('#dvTerms').html(result.TermsAndConditionsText); |
1368 | 1399 | } |
1369 | 1400 | $rootScope.isVisibleLogin = true; |
1401 | + $rootScope.LoginEnableUI(); | |
1370 | 1402 | $('#dvTermCondition').fadeIn(); |
1371 | 1403 | $rootScope.userData = result; |
1372 | 1404 | $rootScope.haveRoleAdmin = false; |
... | ... | @@ -1374,6 +1406,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1374 | 1406 | $location.path('/'); |
1375 | 1407 | } |
1376 | 1408 | } |
1409 | + $rootScope.LoginEnableUI(); | |
1410 | + // set user session time | |
1411 | + $rootScope.loadUserSession(); | |
1412 | + | |
1377 | 1413 | } |
1378 | 1414 | |
1379 | 1415 | |
... | ... | @@ -1384,15 +1420,16 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1384 | 1420 | |
1385 | 1421 | }, |
1386 | 1422 | |
1387 | - function (error) { | |
1423 | + function (error) { | |
1388 | 1424 | |
1389 | - console.log(' Error in authentication = ' + error.statusText); | |
1390 | - // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); | |
1391 | - $rootScope.isVisibleLogin = true; | |
1392 | - $rootScope.errorMessage = error; | |
1393 | - $("#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'); | |
1394 | 1431 | |
1395 | - } | |
1432 | + } | |
1396 | 1433 | ) |
1397 | 1434 | |
1398 | 1435 | } |
... | ... | @@ -1469,8 +1506,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1469 | 1506 | $rootScope.userModules = userInfo.Modules; |
1470 | 1507 | // ShowAssignedModulesPopup(userInfo.Modules);; |
1471 | 1508 | // for reseller type user first need to update profile |
1472 | - // allow popup for instructor ,not for student. | |
1473 | - if (userInfo.UserTypeId == 7 && userInfo.EditionId == 1 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) { | |
1509 | + if (userInfo.UserTypeId == 7 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) { | |
1474 | 1510 | |
1475 | 1511 | $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE); |
1476 | 1512 | |
... | ... | @@ -1517,14 +1553,121 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1517 | 1553 | |
1518 | 1554 | } |
1519 | 1555 | |
1556 | + $rootScope.loadUserSession = function () { | |
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'); | |
1567 | + | |
1568 | + $rootScope.$on('IdleStart', function() { | |
1569 | + // this event fire when idle time finish and time out start | |
1570 | + // config set in AIA.js -:IdleProvider.idle(1*30);; | |
1571 | + //alert('start'); | |
1572 | + }); | |
1573 | + $rootScope.$on('IdleEnd', function() { | |
1574 | + // this event fires by user activity during timeout period | |
1575 | + // it reset idle time and timeout | |
1576 | + // config set in AIA.js -:IdleProvider.interrupt('keydown wheel mousedown touchstart touchmove scroll'); | |
1577 | + // alert('end'); | |
1578 | + }); | |
1579 | + $rootScope.$on('IdleTimeout', function() { | |
1580 | + // this event fire when idle time finished and time out also finished | |
1581 | + // config set in AIA.js -:IdleProvider.timeout(15); | |
1582 | + $rootScope.isSessionTimeout=true; | |
1583 | + console.log('session is timeout'); | |
1584 | + $rootScope.CheckUserSession('logout'); | |
1585 | + }); | |
1586 | + $rootScope.$on('Keepalive', function() { | |
1587 | + // it watch the session on perticular time interval during idle time period | |
1588 | + // config set in AIA.js -: KeepaliveProvider.interval(10); | |
1589 | + //we will use it to recieve request from databse if user logout from admin activity | |
1590 | + console.log('ping user session'); | |
1591 | + $rootScope.CheckUserSession('update'); | |
1592 | + }); | |
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 | + }; | |
1618 | + } | |
1619 | + | |
1620 | + $rootScope.$on('onBeforeUnload', function (e, confirmation) { | |
1621 | + confirmation.message = "All data willl be lost."; | |
1622 | + e.preventDefault(); | |
1623 | + }); | |
1520 | 1624 | |
1521 | 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; | |
1522 | 1638 | localStorage.removeItem('loggedInUserDetails'); |
1523 | 1639 | localStorage.clear(); |
1524 | 1640 | document.location = '/'; |
1525 | 1641 | $rootScope.isVisibleLogin = true; |
1526 | 1642 | } |
1527 | 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 | + | |
1528 | 1671 | function AuthenticateAlreadyLoggedInUser() { |
1529 | 1672 | |
1530 | 1673 | isCommingSoonModel = $rootScope.getLocalStorageValue('isCommingSoonModel'); |
... | ... | @@ -1919,25 +2062,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
1919 | 2062 | }); |
1920 | 2063 | |
1921 | 2064 | $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); |
1922 | - $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" }); | |
1923 | - | |
1924 | - $window.onbeforeunload = function (e) { | |
1925 | - var confirmation = {}; | |
1926 | - if($location.url()!= "/") { | |
1927 | - var event = $rootScope.$broadcast('onBeforeUnload', confirmation); | |
1928 | - if (event.defaultPrevented) { | |
1929 | - return confirmation.message; | |
1930 | - } | |
1931 | - } | |
1932 | - | |
1933 | - }; | |
2065 | + $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" }); | |
1934 | 2066 | }); |
1935 | 2067 | |
1936 | - $scope.$on('onBeforeUnload', function (e, confirmation) { | |
1937 | - confirmation.message = "All data willl be lost."; | |
1938 | - e.preventDefault(); | |
1939 | - }); | |
1940 | - | |
1941 | 2068 | $rootScope.$on("$locationChangeSuccess", function () { |
1942 | 2069 | |
1943 | 2070 | $rootScope.HightLightModuleSelection = function (moduleUrl) { |
... | ... | @@ -7314,6 +7441,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
7314 | 7441 | $rootScope.reDirectURLToAdmin = function () { |
7315 | 7442 | $("#profileUpdateModal").modal('hide'); |
7316 | 7443 | $timeout(function () { |
7444 | + $rootScope.isRedirectToAdmin=true; | |
7317 | 7445 | window.location.href = "Admin"; |
7318 | 7446 | }, 300) |
7319 | 7447 | |
... | ... | @@ -7450,6 +7578,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
7450 | 7578 | |
7451 | 7579 | $rootScope.StoreModuleName = function (moduleName) { |
7452 | 7580 | |
7581 | + // clear UI of external module like encyclopedia,aod | |
7582 | + if ($('#siteloader').html() != undefined) { | |
7583 | + $('#siteloader').remove(); | |
7584 | + } | |
7453 | 7585 | var userid = $rootScope.userData.Id; |
7454 | 7586 | $scope.UpdateUserExportImageData(userid,'ModuleName',moduleName); |
7455 | 7587 | |
... | ... | @@ -7603,7 +7735,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data |
7603 | 7735 | }; |
7604 | 7736 | |
7605 | 7737 | }] |
7606 | -); | |
7738 | +) | |
7607 | 7739 | function printImagePreview(event) { |
7608 | 7740 | var scope = angular.element(document.querySelector('[ng-controller="HomeController"]')).scope(); |
7609 | 7741 | ... | ... |
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
1 | 1 | 'use strict'; |
2 | 2 | |
3 | -var AIA = angular.module('AIA', ['ngSanitize', 'ngRoute', 'ngStorage', 'ui.bootstrap']); | |
3 | +var AIA = angular.module('AIA', ['ngSanitize', 'ngRoute', 'ngStorage', 'ui.bootstrap','ngIdle']); | |
4 | 4 | |
5 | 5 | |
6 | 6 | |
... | ... | @@ -571,4 +571,10 @@ AIA.config(function ($routeProvider, pages, $locationProvider) { |
571 | 571 | |
572 | 572 | } |
573 | 573 | } |
574 | -}); | |
575 | 574 | \ No newline at end of file |
575 | +}); | |
576 | +AIA.config(function(IdleProvider, KeepaliveProvider) { | |
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 | +}) | |
576 | 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> |
... | ... | @@ -1515,6 +1518,7 @@ |
1515 | 1518 | <script src="libs/angular/1.4.9/angular-sanitize.min.js"></script> |
1516 | 1519 | <script src="themes/default/scripts/bootstrap/3.3.5/ui-bootstrap-tpls-0.3.0.min.js"></script> |
1517 | 1520 | <script src="libs/angular/1.4.9/ngStorage.js"></script> |
1521 | + <script src="libs/angular/1.4.9/angular-idle.min.js"></script> | |
1518 | 1522 | <script src="content/js/custom/custom.js"></script> |
1519 | 1523 | <!--Annotation Toolbar : jcanvas Library--> |
1520 | 1524 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/libs/angular/1.4.9/angular-idle.min.js
0 → 100644
1 | +/*** Directives and services for responding to idle users in AngularJS | |
2 | +* @author Mike Grabski <me@mikegrabski.com> | |
3 | +* @version v1.3.2 | |
4 | +* @link https://github.com/HackedByChinese/ng-idle.git | |
5 | +* @license MIT | |
6 | +*/ | |
7 | + | |
8 | +!function(a,b,c){"use strict";b.module("ngIdle",["ngIdle.keepalive","ngIdle.idle","ngIdle.countdown","ngIdle.title","ngIdle.localStorage"]),b.module("ngIdle.keepalive",[]).provider("Keepalive",function(){var a={http:null,interval:600};this.http=function(c){if(!c)throw new Error("Argument must be a string containing a URL, or an object containing the HTTP request configuration.");b.isString(c)&&(c={url:c,method:"GET"}),c.cache=!1,a.http=c};var c=this.interval=function(b){if(b=parseInt(b),isNaN(b)||0>=b)throw new Error("Interval must be expressed in seconds and be greater than 0.");a.interval=b};this.$get=["$rootScope","$log","$interval","$http",function(d,e,f,g){function h(a){d.$broadcast("KeepaliveResponse",a.data,a.status)}function i(){d.$broadcast("Keepalive"),b.isObject(a.http)&&g(a.http).then(h)["catch"](h)}var j={ping:null};return{_options:function(){return a},setInterval:c,start:function(){return f.cancel(j.ping),j.ping=f(i,1e3*a.interval),j.ping},stop:function(){f.cancel(j.ping)},ping:function(){i()}}}]}),b.module("ngIdle.idle",["ngIdle.keepalive","ngIdle.localStorage"]).provider("Idle",function(){var a={idle:1200,timeout:30,autoResume:"idle",interrupt:"mousemove keydown DOMMouseScroll mousewheel mousedown touchstart touchmove scroll",windowInterrupt:null,keepalive:!0},c=this.timeout=function(c){if(c===!1)a.timeout=0;else{if(!(b.isNumber(c)&&c>=0))throw new Error("Timeout must be zero or false to disable the feature, or a positive integer (in seconds) to enable it.");a.timeout=c}};this.interrupt=function(b){a.interrupt=b},this.windowInterrupt=function(b){a.windowInterrupt=b};var d=this.idle=function(b){if(0>=b)throw new Error("Idle must be a value in seconds, greater than 0.");a.idle=b};this.autoResume=function(b){b===!0?a.autoResume="idle":b===!1?a.autoResume="off":a.autoResume=b},this.keepalive=function(b){a.keepalive=b===!0},this.$get=["$interval","$log","$rootScope","$document","Keepalive","IdleLocalStorage","$window",function(e,f,g,h,i,j,k){function l(){a.keepalive&&(u.running&&i.ping(),i.start())}function m(){a.keepalive&&i.stop()}function n(){u.idling=!u.idling;var b=u.idling?"IdleStart":"IdleEnd";u.idling?(g.$broadcast(b),m(),a.timeout&&(u.countdown=a.timeout,o(),u.timeout=e(o,1e3,a.timeout,!1))):(l(),g.$broadcast(b)),e.cancel(u.idle)}function o(){if(u.idling){if(u.countdown<=0)return void q();g.$broadcast("IdleWarn",u.countdown),u.countdown--}}function p(a){g.$broadcast("IdleInterrupt",a)}function q(){m(),e.cancel(u.idle),e.cancel(u.timeout),u.idling=!0,u.running=!1,u.countdown=0,g.$broadcast("IdleTimeout")}function r(a,b,c){var d=a.running();a.unwatch(),b(c),d&&a.watch()}function s(){var a=j.get("expiry");return a&&a.time?new Date(a.time):null}function t(a){a?j.set("expiry",{id:v,time:a}):j.remove("expiry")}var u={idle:null,timeout:null,idling:!1,running:!1,countdown:null},v=(new Date).getTime(),w={_options:function(){return a},_getNow:function(){return new Date},getIdle:function(){return a.idle},getTimeout:function(){return a.timeout},setIdle:function(a){r(this,d,a)},setTimeout:function(a){r(this,c,a)},isExpired:function(){var a=s();return null!==a&&a<=this._getNow()},running:function(){return u.running},idling:function(){return u.idling},watch:function(b){e.cancel(u.idle),e.cancel(u.timeout);var c=a.timeout?a.timeout:0;b||t(new Date((new Date).getTime()+1e3*(a.idle+c))),u.idling?n():u.running||l(),u.running=!0,u.idle=e(n,1e3*a.idle,0,!1)},unwatch:function(){e.cancel(u.idle),e.cancel(u.timeout),u.idling=!1,u.running=!1,t(null),m()},interrupt:function(b){if(u.running){if(a.timeout&&this.isExpired())return void q();p(b),(b||"idle"===a.autoResume||"notIdle"===a.autoResume&&!u.idling)&&this.watch(b)}}},x={clientX:null,clientY:null,swap:function(a){var b={clientX:this.clientX,clientY:this.clientY};return this.clientX=a.clientX,this.clientY=a.clientY,b},hasMoved:function(a){var b=this.swap(a);return null===this.clientX||a.movementX||a.movementY?!0:b.clientX!=a.clientX||b.clientY!=a.clientY?!0:!1}};if(h.find("html").on(a.interrupt,function(a){"mousemove"===a.type&&a.originalEvent&&0===a.originalEvent.movementX&&0===a.originalEvent.movementY||("mousemove"!==a.type||x.hasMoved(a))&&w.interrupt()}),a.windowInterrupt)for(var y=a.windowInterrupt.split(" "),z=function(){w.interrupt()},A=0;A<y.length;A++)k.addEventListener?(k.addEventListener(y[A],z,!1),g.$on("$destroy",function(){k.removeEventListener(y[A],z,!1)})):(k.attachEvent(y[A],z),g.$on("$destroy",function(){k.detachEvent(y[A],z)}));var B=function(a){if("ngIdle.expiry"===a.key&&a.newValue&&a.newValue!==a.oldValue){var c=b.fromJson(a.newValue);if(c.id===v)return;w.interrupt(!0)}};return k.addEventListener?(k.addEventListener("storage",B,!1),g.$on("$destroy",function(){k.removeEventListener("storage",B,!1)})):k.attachEvent&&(k.attachEvent("onstorage",B),g.$on("$destroy",function(){k.detachEvent("onstorage",B)})),w}]}),b.module("ngIdle.countdown",["ngIdle.idle"]).directive("idleCountdown",["Idle",function(a){return{restrict:"A",scope:{value:"=idleCountdown"},link:function(b){b.value=a.getTimeout(),b.$on("IdleWarn",function(a,c){b.$evalAsync(function(){b.value=c})}),b.$on("IdleTimeout",function(){b.$evalAsync(function(){b.value=0})})}}}]),b.module("ngIdle.title",[]).provider("Title",function(){function a(a,b,c){return new Array(b-String(a).length+1).join(c||"0")+a}var c={enabled:!0},d=this.enabled=function(a){c.enabled=a===!0};this.$get=["$document","$interpolate",function(e,f){var g={original:null,idle:"{{minutes}}:{{seconds}} until your session times out!",timedout:"Your session has expired."};return{setEnabled:d,isEnabled:function(){return c.enabled},original:function(a){return b.isUndefined(a)?g.original:void(g.original=a)},store:function(a){(a||!g.original)&&(g.original=this.value())},value:function(a){return b.isUndefined(a)?e[0].title:void(e[0].title=a)},idleMessage:function(a){return b.isUndefined(a)?g.idle:void(g.idle=a)},timedOutMessage:function(a){return b.isUndefined(a)?g.timedout:void(g.timedout=a)},setAsIdle:function(b){this.store();var c={totalSeconds:b};c.minutes=Math.floor(b/60),c.seconds=a(b-60*c.minutes,2),this.value(f(this.idleMessage())(c))},setAsTimedOut:function(){this.store(),this.value(this.timedOutMessage())},restore:function(){this.original()&&this.value(this.original())}}}]}).directive("title",["Title",function(a){return{restrict:"E",link:function(b,c,d){a.isEnabled()&&!d.idleDisabled&&(a.store(!0),b.$on("IdleStart",function(){a.original(c[0].innerText)}),b.$on("IdleWarn",function(b,c){a.setAsIdle(c)}),b.$on("IdleEnd",function(){a.restore()}),b.$on("IdleTimeout",function(){a.setAsTimedOut()}))}}}]),b.module("ngIdle.localStorage",[]).service("IdleStorageAccessor",["$window",function(a){return{get:function(){return a.localStorage}}}]).service("IdleLocalStorage",["IdleStorageAccessor",function(a){function d(){var a={};this.setItem=function(b,c){a[b]=c},this.getItem=function(b){return"undefined"!=typeof a[b]?a[b]:null},this.removeItem=function(b){a[b]=c}}function e(){try{var b=a.get();return b.setItem("ngIdleStorage",""),b.removeItem("ngIdleStorage"),b}catch(c){return new d}}var f=e();return{set:function(a,c){f.setItem("ngIdle."+a,b.toJson(c))},get:function(a){return b.fromJson(f.getItem("ngIdle."+a))},remove:function(a){f.removeItem("ngIdle."+a)},_wrapped:function(){return f}}}])}(window,window.angular); | |
9 | +//# sourceMappingURL=angular-idle.map | |
0 | 10 | \ No newline at end of file | ... | ... |
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 './components/userentity/datamodel'; |
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 '@angular/http'; |
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 './shared/my-filter.pipe'; |
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