diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs index 394381a..5c44246 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs @@ -111,6 +111,27 @@ namespace AIAHTML5.ADMIN.API.Controllers return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } + + [Route("ManageUserLoginStatus")] + [HttpPost] + public HttpResponseMessage ManageUserLoginStatus(JObject jsonData) + { + bool Status = false; + int userId = jsonData["userId"].Value(); + string tagName = jsonData["tagName"].Value(); + try + { + Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName); + + return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); + } + catch (Exception ex) + { + // Log exception code goes here + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); + } + } + [Route("UpdateUserId")] [HttpPost] public HttpResponseMessage UpdateUserId(UserModel userInfo) diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs index 614ea78..8d91ed6 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs @@ -4990,5 +4990,18 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, iUserTypeIdParameter, sEmailIdParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iLicenseIdParameter, iEditionIdParameter, status); } + + public virtual ObjectResult> usp_ManageUserLoginStatus(Nullable userId, string tag) + { + var userIdParameter = userId.HasValue ? + new ObjectParameter("userId", userId) : + new ObjectParameter("userId", typeof(int)); + + var tagParameter = tag != null ? + new ObjectParameter("tag", tag) : + new ObjectParameter("tag", typeof(string)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction>("usp_ManageUserLoginStatus", userIdParameter, tagParameter); + } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs index 660d3a3..d216bd6 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Designer.cs @@ -1,4 +1,4 @@ -// T4 code generation is enabled for model 'E:\AIAProject\400-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'. +// T4 code generation is enabled for model 'F:\AIAProject\400-SOURCECODE\AIAHTML5.ADMIN.API\Entity\AIADBEntity.edmx'. // To enable legacy code generation, change the value of the 'Code Generation Strategy' designer // property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model // is open in the designer. diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx index f74da8e..dd0e4c6 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx @@ -1406,6 +1406,10 @@ + + + + @@ -2996,6 +3000,10 @@ + + + + @@ -4318,6 +4326,7 @@ + @@ -6284,6 +6293,7 @@ + @@ -6305,6 +6315,7 @@ + diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs index ec11704..0bea143 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/usp_GetUsersList_Result.cs @@ -29,5 +29,6 @@ namespace AIAHTML5.ADMIN.API.Entity public string UserStatus { get; set; } public Nullable UserTypeId { get; set; } public Nullable EditionTypeId { get; set; } + public Nullable LoginStatus { get; set; } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs index 14b140c..4a15fe3 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs @@ -65,6 +65,21 @@ namespace AIAHTML5.ADMIN.API.Models return false; } } + public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName) + { + bool loginStatus = false; + try + { + loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName).FirstOrDefault()); + + return loginStatus; + } + catch (Exception ex) + { + return false; + } + } + public static string UpdateUserId(AIADatabaseV5Entities dbContext, int id, string userId, string oldUserId) { var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs index 855759f..db51b65 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs @@ -41,5 +41,6 @@ namespace AIAHTML5.API.Constants public const string GET_COUNT_EXPORTED_IMAGE = "usp_GetCountExportedImage"; public const string INSERT_EXPORTED_IMAGE = "usp_InsertExportedImage"; public const string GET_USER_DETAIL_BYLOGIN_AND_ACCOUNT = "usp_GetUserDetailsByLoginIdandAccount"; + public const string GET_USER_LOGIN_STATUS = "usp_ManageUserLoginStatus"; } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index ccc309e..040af8b 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -502,6 +502,27 @@ namespace AIAHTML5.API.Controllers return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); } } + + [HttpPost] + [Route("api/ManageUserLoginStatus")] + public HttpResponseMessage ManageUserLoginStatus([FromBody]JObject jsonData) + { + string loginStatus = string.Empty; + try + { + int userId = jsonData["userId"].Value(); + string tagName = jsonData["tagName"].Value(); + + loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName); + + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(loginStatus) }; + } + catch (Exception ex) + { + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); + } + } + // PUT api/authenticate/5 public void Put(int id, [FromBody]string value) { diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index 23e314d..78d7571 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -348,6 +348,42 @@ namespace AIAHTML5.API.Models return objUser; } + internal static string GetUserLoginStatus(int userId,string tagName) + { + string status=string.Empty; + DBModel objModel = new DBModel(); + + SqlConnection conn = new SqlConnection(dbConnectionString); + SqlCommand cmd = new SqlCommand(); + SqlDataAdapter adapter; + DataSet ds = new DataSet(); + + cmd.Connection = conn; + cmd.CommandText = DBConstants.GET_USER_LOGIN_STATUS; + cmd.CommandType = CommandType.StoredProcedure; + cmd.Parameters.AddWithValue("@userId", userId); + cmd.Parameters.AddWithValue("@tag", tagName); + + adapter = new SqlDataAdapter(cmd); + adapter.Fill(ds); + + if (ds != null && ds.Tables.Count > 0) + { + DataTable dt = ds.Tables[0]; + + if (dt.Rows.Count > 0) + { + foreach (DataRow dr in dt.Rows) + { + status = dr["loginStatus"].ToString(); + + } + } + } + + return status; + } + internal User GetSelectedSettings(int userId) { logger.Debug(" Inside GetSelectedSettings for userId = " + userId); diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index 085aa1d..08fec49 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -315,6 +315,14 @@ namespace AIAHTML5.API.Models return objUser; } + internal static string GetUserLoginStatus(int userId, string tagName) + { + string status = null; + status = DBModel.GetUserLoginStatus(userId, tagName); + + return status; + } + internal static int SaveUserSelectedSettings(User selectedSettings) { logger.Debug("inside SaveUserSelectedSettings for Image =" + selectedSettings.Id); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js index 678f96e..26ba7f8 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/3dAController.js @@ -179,7 +179,6 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location var promise = DataService.getJson('~/../content/data/json/3da/3da_dat_contentlist.json') promise.then( function (result) { - var threeDAnatomyData = new jinqJs() .from(result.root.ThreeDAData) .orderBy([{ field: '_Title', sort: 'asc' }]) @@ -493,7 +492,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location $rootScope.ThreeDWindowLoadComplete = true; } $scope.JsPanelMouseEnter(windowviewid); - + } $scope.JsPanelMouseEnter = function (windowviewid) { @@ -502,6 +501,36 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location //call when module loaded $rootScope.resetMenuOption(); + var timeintval = null; + timeintval = $interval(PointerEventEnableDisable, 5000); + + function PointerEventEnableDisable() { + var pointevents = $("#threedImage_" + windowviewid).css('pointer-events'); + if (pointevents=='auto') { + $scope.stop3drefresh(timeintval); + timeintval = $interval(PointerEventEnableDisable, 500); + $("#threedImage_" + windowviewid).css('pointer-events', 'none'); + } + else if(pointevents=='none') + { + $("#threedImage_" + windowviewid).css('pointer-events', 'auto'); + $scope.stop3drefresh(timeintval); + timeintval = $interval(PointerEventEnableDisable, 5000); + } + else + { + //auto clode interval when panel close + $scope.stop3drefresh(timeintval); + } + } + + $scope.stop3drefresh = function (timeintval) { + if (angular.isDefined(timeintval)) { + $interval.cancel(timeintval); + timeintval = undefined; + } + }; + // call from while open module in CB //click event not work on object-tag document @@ -514,7 +543,7 @@ function ($scope, $rootScope, pages, log, $http, DataService, $filter, $location }); - } + } $scope.RemoveJSPanel = function (panelid) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 189f549..39d7d82 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -667,8 +667,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if (navigator.cookieEnabled) { $rootScope.isLoading = false; - - + $rootScope.isLoginLoading = false; + //unblock user if (url.indexOf('?unb:') != -1) { @@ -690,6 +690,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if ($scope.currentUserDetails != undefined) { AuthenticateAlreadyLoggedInUser(); } + var isRememberChecked = $rootScope.getLocalStorageValue('isRememberMeChecked'); if ($rootScope.getLocalStorageValue('isRememberMeChecked') != "" && sessionStorage.getItem("loginSession") == null) { @@ -729,6 +730,20 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }); } + $rootScope.LoginEnableUI=function() + { + $rootScope.isLoginLoading = false; + $('#spinnerLogin').css('visibility', 'hidden'); + $('.loginPanel').css('pointer-events', 'auto'); + $('.loginPanel').css('opacity', '1'); + } + $rootScope.LoginDisableUI=function() + { + $rootScope.isLoginLoading = true; + $('#spinnerLogin').css('visibility', 'visible'); + $('.loginPanel').css('pointer-events', 'none'); + $('.loginPanel').css('opacity', '0.7'); + } $rootScope.AuthenticateUser = function (userInfo) { if (navigator.cookieEnabled) { $rootScope.errorMessage = ""; @@ -740,13 +755,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } else { - + $rootScope.LoginDisableUI(); AuthenticationService.authenticateUser(userInfo) .then( function (result) { - if (result == LoginConstants.USER_NOT_FOUND) { + if (result == LoginConstants.USER_NOT_FOUND) { + $rootScope.LoginEnableUI(); $rootScope.isVisibleLogin = true; // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); $rootScope.errorMessage = LoginMessageConstants.INVALID_USER; @@ -829,63 +845,70 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.INVALID_PASSWORD; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_ID_BLOCKED_24_HRS) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.'; $("#messageModal").modal('show'); } else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else { - // set user session time - $rootScope.loadUserSession(); - //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true if (result.LicenseId == 0 && result.IsActive) { @@ -923,6 +946,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $location.path('/'); $timeout(function () { + $rootScope.LoginEnableUI(); $scope.RedirectToModule(); }, 100); @@ -941,11 +965,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.haveRoleAdmin = false; } - // Remove Admin Link for LicenseEditionId 3/4 of student - if (result.EditionId == 3 || result.EditionId == 4) { - $rootScope.haveRoleAdmin = false; - - } if (result.UserTypeId == 6) { $('#modestyDiv').css('pointerEvent', 'none'); @@ -1007,10 +1026,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data //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 localStorage.setItem('isCommingSoonModel', false); - // for reseller type user first need to update profile - // only instructor ,not student - if (result.UserTypeId == 7 && result.EditionId == 1 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) { - + // for reseller type user first need to update profile + if (result.UserTypeId == 7 && (result.FirstName == "" || result.EmailId == "" || result.LastName == "")) { + $rootScope.LoginEnableUI(); $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE); $("#profileUpdateModal").modal('show'); @@ -1021,6 +1039,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data else { $location.path('/'); $timeout(function () { + $rootScope.LoginEnableUI(); $scope.RedirectToModule(); }, 100); @@ -1031,6 +1050,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#dvTerms').html(result.TermsAndConditionsText); } $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $('#dvTermCondition').fadeIn(); $rootScope.userData = result; localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); @@ -1041,6 +1061,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } + // set user session time + $rootScope.loadUserSession(); + $rootScope.LoginEnableUI(); } } @@ -1050,6 +1073,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data function (error) { console.log(' Error in authentication = ' + error.statusText); // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.LoginEnableUI(); $rootScope.isVisibleLogin = true; $rootScope.errorMessage = error; $("#messageModal").modal('show'); @@ -1170,6 +1194,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data if (isCalsCredantialForSIte == "True") { if($rootScope.siteUrlInfo.mtype!=null && $rootScope.siteUrlInfo.mtype.toLowerCase()=='ca' && $rootScope.siteUrlInfo.userId!=null && $rootScope.siteUrlInfo.accountNumber!=null) { + $rootScope.LoginDisableUI(); AuthenticationService.ByPassLoginToOpenModule($rootScope.siteUrlInfo) .then( function (result) { @@ -1183,6 +1208,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }), function (error) { console.log(' Error in bypass login = ' + error.statusText); + $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = error; $("#messageModal").modal('show'); } @@ -1191,53 +1218,56 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data else { console.log(' invalid detail in bypass login'); + $rootScope.isVisibleLogin = true; $rootScope.errorMessage = "authentication is not allowed due to invalid details format .\nPlease pass the correct details again!"; $("#messageModal").modal('show'); } } else { - console.log($rootScope.siteUrlInfo); - + $rootScope.LoginDisableUI(); AuthenticationService.validateClientSite($rootScope.siteUrlInfo) .then( function (result) { - console.log(result); if (result != null) { - - console.log(result); if (result == LoginConstants.INVALID_CLIENT) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginConstants.INVALID_CLIENT; $("#messageModal").modal('show'); } else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_ACCOUNT_NUMBER_NOT_NULL) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.E_ACCOUNT_NUMBER_NOT_NULL; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_ID_NOT_NULL) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.E_EDITION_ID_NOT_NULL; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_NOT_LINKED_WITH_SITE) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.E_EDITION_NOT_LINKED_WITH_SITE; $("#messageModal").modal('show'); } else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.LICENSE_INACTIVE) { $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } @@ -1283,9 +1313,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.siteId = result.siteId; - // set user session time - $rootScope.loadUserSession(); - // birendra// initialize exp img detail object $rootScope.initializeUserForExportImage(result.Id); @@ -1371,6 +1398,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $('#dvTerms').html(result.TermsAndConditionsText); } $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $('#dvTermCondition').fadeIn(); $rootScope.userData = result; $rootScope.haveRoleAdmin = false; @@ -1378,6 +1406,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $location.path('/'); } } + $rootScope.LoginEnableUI(); + // set user session time + $rootScope.loadUserSession(); + } @@ -1388,15 +1420,16 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }, - function (error) { + function (error) { - console.log(' Error in authentication = ' + error.statusText); - // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); - $rootScope.isVisibleLogin = true; - $rootScope.errorMessage = error; - $("#messageModal").modal('show'); + console.log(' Error in authentication = ' + error.statusText); + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.LoginEnableUI(); + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = error; + $("#messageModal").modal('show'); - } + } ) } @@ -1473,8 +1506,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.userModules = userInfo.Modules; // ShowAssignedModulesPopup(userInfo.Modules);; // for reseller type user first need to update profile - // allow popup for instructor ,not for student. - if (userInfo.UserTypeId == 7 && userInfo.EditionId == 1 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) { + if (userInfo.UserTypeId == 7 && (userInfo.FirstName == "" || userInfo.EmailId == "" || userInfo.LastName == "")) { $('#updateprofile').html(LoginMessageConstants.USER_UPDATE_PROFILE); @@ -1522,43 +1554,120 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data } $rootScope.loadUserSession = function () { - Idle.watch();// start the session + $rootScope.isSessionTimeout=false; + $rootScope.isRedirectToAdmin=false; + $rootScope.userStatus = { + userId: null, + tagName: null, + loginStatus: null, + } + console.log('user session start'); + $rootScope.CheckUserSession('insert'); - $scope.$on('IdleStart', function() { + $rootScope.$on('IdleStart', function() { // this event fire when idle time finish and time out start // config set in AIA.js -:IdleProvider.idle(1*30);; //alert('start'); }); - $scope.$on('IdleEnd', function() { + $rootScope.$on('IdleEnd', function() { // this event fires by user activity during timeout period // it reset idle time and timeout // config set in AIA.js -:IdleProvider.interrupt('keydown wheel mousedown touchstart touchmove scroll'); // alert('end'); }); - $scope.$on('IdleTimeout', function() { + $rootScope.$on('IdleTimeout', function() { // this event fire when idle time finished and time out also finished // config set in AIA.js -:IdleProvider.timeout(15); - - $rootScope.LogoutUser(); - }); - - $scope.$on('Keepalive', function() { + $rootScope.isSessionTimeout=true; + console.log('session is timeout'); + $rootScope.CheckUserSession('logout'); + }); + $rootScope.$on('Keepalive', function() { // it watch the session on perticular time interval during idle time period // config set in AIA.js -: KeepaliveProvider.interval(10); //we will use it to recieve request from databse if user logout from admin activity - //alert('alive'); + console.log('ping user session'); + $rootScope.CheckUserSession('update'); }); + // $(window).unload(function(event) { + // //var isopenResourceRequest = sessionStorage.getItem('isModuleOpenByOpenResource'); + // if ($rootScope.closetab==true) { + // localStorage.removeItem('loggedInUserDetails'); + // localStorage.clear(); + // $rootScope.CheckUserSession('logout'); + // return "Handler for .unload() called."; + + // } + + // }); + + $window.onbeforeunload = function (e) { + var confirmation = {}; + // if($location.url()!= "/") { + if ($rootScope.isSessionTimeout==false && $rootScope.isRedirectToAdmin==false) { + var event = $rootScope.$broadcast('onBeforeUnload', confirmation); + if (event.defaultPrevented) { + return confirmation.message; + } + } + // } + + }; } + $rootScope.$on('onBeforeUnload', function (e, confirmation) { + confirmation.message = "All data willl be lost."; + e.preventDefault(); + }); + $rootScope.LogoutUser = function () { + $rootScope.isSessionTimeout=true; + localStorage.removeItem('loggedInUserDetails'); + localStorage.clear(); + $rootScope.CheckUserSession('logout'); + $timeout(function(){ + document.location = '/'; + $rootScope.isVisibleLogin = true; + },50); + + } + $rootScope.LogoutUserSession = function () { + $rootScope.isSessionTimeout=true; localStorage.removeItem('loggedInUserDetails'); localStorage.clear(); document.location = '/'; $rootScope.isVisibleLogin = true; } + $rootScope.CheckUserSession = function (tagName) { + //console.log('user login id: '+$rootScope.userData.Id); + //console.log('user login activity tag: '+tagName); + if($rootScope.userData==undefined) return; + $rootScope.userStatus.userId=$rootScope.userData.Id; + $rootScope.userStatus.tagName=tagName; + AuthenticationService.ManageUserLoginStatus($rootScope.userStatus) + .then( + function (loginStatus) { + if(loginStatus!=null) + { + $rootScope.userStatus.loginStatus = loginStatus; + if(loginStatus=='False') + { + $rootScope.LogoutUserSession(); + } + } + + }), + function (error) { + console.log(' Error in user login status = ' + error.statusText); + $rootScope.errorMessage = error; + $("#messageModal").modal('show'); + } + + } + function AuthenticateAlreadyLoggedInUser() { isCommingSoonModel = $rootScope.getLocalStorageValue('isCommingSoonModel'); @@ -1953,25 +2062,9 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data }); $("#font-color .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#000000" }); - $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" }); - - $window.onbeforeunload = function (e) { - var confirmation = {}; - if($location.url()!= "/") { - var event = $rootScope.$broadcast('onBeforeUnload', confirmation); - if (event.defaultPrevented) { - return confirmation.message; - } - } - - }; + $("#drawTextBGColorpicker .minicolors .minicolors-swatch .minicolors-swatch-color").css({ "background-color": "#ffffff" }); }); - $scope.$on('onBeforeUnload', function (e, confirmation) { - confirmation.message = "All data willl be lost."; - e.preventDefault(); - }); - $rootScope.$on("$locationChangeSuccess", function () { $rootScope.HightLightModuleSelection = function (moduleUrl) { @@ -7348,6 +7441,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.reDirectURLToAdmin = function () { $("#profileUpdateModal").modal('hide'); $timeout(function () { + $rootScope.isRedirectToAdmin=true; window.location.href = "Admin"; }, 300) @@ -7484,6 +7578,10 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.StoreModuleName = function (moduleName) { + // clear UI of external module like encyclopedia,aod + if ($('#siteloader').html() != undefined) { + $('#siteloader').remove(); + } var userid = $rootScope.userData.Id; $scope.UpdateUserExportImageData(userid,'ModuleName',moduleName); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js index 23c20ab..3fff875 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js @@ -1,7 +1,7 @@ 'use strict'; -AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams", "$window", -function ($scope, $rootScope, log, $location, pages, $routeParams, $window) { +AIA.controller("LinkController", ["$scope", "$rootScope", "$log", "$location", "pages", "$routeParams", "$window","$interval", +function ($scope, $rootScope, log, $location, pages, $routeParams, $window,$interval) { //$rootScope.currentActiveModuleTitle = Modules[10].Name; //$rootScope.currentActiveModuleTitle = $routeParams.modname; @@ -59,11 +59,43 @@ function ($scope, $rootScope, log, $location, pages, $routeParams, $window) { } } + $scope.refreshIdleTime(); } } } }); + $scope.refreshIdleTime = function () { + var timeintval = null; + timeintval = $interval(PointerEventEnableDisable, 5000); + + function PointerEventEnableDisable() { + var pointevents = $("#externalLink").css('pointer-events'); + if (pointevents=='auto') { + $scope.stopLinkRefresh(timeintval); + timeintval = $interval(PointerEventEnableDisable, 500); + $("#externalLink").css('pointer-events', 'none'); + } + else if(pointevents=='none') + { + $("#externalLink").css('pointer-events', 'auto'); + $scope.stopLinkRefresh(timeintval); + timeintval = $interval(PointerEventEnableDisable, 5000); + } + else + { + //auto clode interval when panel close + $scope.stopLinkRefresh(timeintval); + } + } + + $scope.stopLinkRefresh = function (timeintval) { + if (angular.isDefined(timeintval)) { + $interval.cancel(timeintval); + timeintval = undefined; + } + }; + } $scope.showTabButton = false; $scope.IsVisible = function () { $scope.scroll(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js index a3396da..58484c2 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js @@ -573,13 +573,8 @@ AIA.config(function ($routeProvider, pages, $locationProvider) { } }); AIA.config(function(IdleProvider, KeepaliveProvider) { - IdleProvider.idle(1*20); // 10 minutes idle - IdleProvider.timeout(15); // after 30 seconds idle, time the user out - KeepaliveProvider.interval(10); // 5 minute keep-alive ping - IdleProvider.interrupt('keydown wheel mousedown touchstart touchmove scroll'); -}) -// .run(function($rootScope, Idle, $log, Keepalive){ -// Idle.watch(); - -// $log.debug('app started.'); -// }); \ No newline at end of file + IdleProvider.idle(20*60); // 20 minutes idle + IdleProvider.timeout(30); // after 30 seconds idle, time the user out + KeepaliveProvider.interval(10); // 10 seconds keep-alive ping + IdleProvider.interrupt('keydown mousemove wheel mousedown touchstart touchmove scroll'); +}) \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js index bb34f4c..2382a2a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -15,6 +15,7 @@ console.log('error') deferred.reject(data); $rootScope.isVisibleLogin = true; + $scope.LoginEnableUI(); $rootScope.errorMessage = data; $("#messageModal").modal('show'); @@ -55,6 +56,29 @@ deferred.resolve(data); }).error(function (data, status, headers, config) { console.log('error') + $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); + deferred.reject(data); + $rootScope.errorMessage = data; + $("#messageModal").modal('show'); + + }); + return deferred.promise; + }, + + ManageUserLoginStatus: function (logindata) { + var deferred = $q.defer();//userId tagName + + $http.post('/API/api/ManageUserLoginStatus', JSON.stringify(logindata), { + headers: { + 'Content-Type': 'application/json' + } + }) + .success(function (data, status, headers, config) { + console.log('success') + deferred.resolve(data); + }).error(function (data, status, headers, config) { + console.log('error') deferred.reject(data); $rootScope.errorMessage = data; $("#messageModal").modal('show'); @@ -120,6 +144,7 @@ console.log('error') deferred.reject(data); $rootScope.isVisibleLogin = true; + $rootScope.LoginEnableUI(); $rootScope.errorMessage = data; $("#messageModal").modal('show'); diff --git a/400-SOURCECODE/AIAHTML5.Web/index.aspx b/400-SOURCECODE/AIAHTML5.Web/index.aspx index 7776fd4..0da1ad4 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.aspx +++ b/400-SOURCECODE/AIAHTML5.Web/index.aspx @@ -221,6 +221,9 @@
+ diff --git a/400-SOURCECODE/Admin/package-lock.json b/400-SOURCECODE/Admin/package-lock.json index beb88fa..22b1fe1 100644 --- a/400-SOURCECODE/Admin/package-lock.json +++ b/400-SOURCECODE/Admin/package-lock.json @@ -276,6 +276,16 @@ "tsickle": "^0.21.0" } }, + "@ng-idle/core": { + "version": "2.0.0-beta.9", + "resolved": "https://registry.npmjs.org/@ng-idle/core/-/core-2.0.0-beta.9.tgz", + "integrity": "sha1-+ZsIF0kc2lTAh9bNhs7SMQ//5qQ=" + }, + "@ng-idle/keepalive": { + "version": "2.0.0-beta.9", + "resolved": "https://registry.npmjs.org/@ng-idle/keepalive/-/keepalive-2.0.0-beta.9.tgz", + "integrity": "sha1-f3HkrIcG042pZl04JWDPv72IEh8=" + }, "@ng-select/ng-select": { "version": "2.20.5", "resolved": "https://registry.npmjs.org/@ng-select/ng-select/-/ng-select-2.20.5.tgz", @@ -485,6 +495,14 @@ "resolved": "https://registry.npmjs.org/angular2-json2csv/-/angular2-json2csv-1.1.2.tgz", "integrity": "sha1-ETRWynbEyZiLU44jAUHCwT4DxpI=" }, + "angular2-moment": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/angular2-moment/-/angular2-moment-1.9.0.tgz", + "integrity": "sha512-ybPjYizpKVWAI2Z4AqxAS6s3FMkF3+zRpfvxX1wIdSJUFjl83XxQ5f2yn7retX68NSYZZ/JTK9KGnvOzZfrIZw==", + "requires": { + "moment": "^2.19.3" + } + }, "angular4-slimscroll": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/angular4-slimscroll/-/angular4-slimscroll-1.0.5.tgz", @@ -7001,6 +7019,11 @@ "minimist": "0.0.8" } }, + "moment": { + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.28.0.tgz", + "integrity": "sha512-Z5KOjYmnHyd/ukynmFd/WwyXHd7L4J9vTI/nn5Ap9AVUgaAE15VvQ9MOGmJJygEUklupqIrFnor/tjTwRU+tQw==" + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", diff --git a/400-SOURCECODE/Admin/package.json b/400-SOURCECODE/Admin/package.json index cb8882d..1fb2806 100644 --- a/400-SOURCECODE/Admin/package.json +++ b/400-SOURCECODE/Admin/package.json @@ -23,9 +23,12 @@ "@angular/platform-browser": "^4.2.4", "@angular/platform-browser-dynamic": "^4.2.4", "@angular/router": "^4.2.4", + "@ng-idle/core": "^2.0.0-beta.9", + "@ng-idle/keepalive": "^2.0.0-beta.9", "@ng-select/ng-select": "^2.1.2", "@types/node": "^6.0.102", "angular2-json2csv": "^1.1.2", + "angular2-moment": "^1.9.0", "angular4-slimscroll": "^1.0.5", "classlist.js": "1.1.20150312", "core-js": "^2.5.3", diff --git a/400-SOURCECODE/Admin/src/app/app.component.html b/400-SOURCECODE/Admin/src/app/app.component.html index 5c51d35..478690f 100644 --- a/400-SOURCECODE/Admin/src/app/app.component.html +++ b/400-SOURCECODE/Admin/src/app/app.component.html @@ -106,7 +106,7 @@
diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts index b067eb2..ffc6877 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts @@ -58,6 +58,7 @@ export class UsersList implements OnInit, AfterViewChecked { UncheckedRecords: Array; buttonStatus: boolean; EditbuttonStatus: boolean; + logoutUserSession: boolean; //@ViewChild("profileModal") //profileModal: ModalComponent; //errorMessage: any; @@ -127,7 +128,6 @@ export class UsersList implements OnInit, AfterViewChecked { this._loadingService.ShowLoading("global-loading"); this.GetUserType(); this.GetAccountType(); - this._loadingService.HideLoading("global-loading"); this.recordCount = 0; this.pageNo = 1; this.pageLength = 10; @@ -168,8 +168,6 @@ export class UsersList implements OnInit, AfterViewChecked { testScript.setAttribute("type", "text/javascript"); document.body.appendChild(testScript); } - - this._loadingService.HideLoading("global-loading"); //this.GetUserList(); } @@ -234,6 +232,14 @@ export class UsersList implements OnInit, AfterViewChecked { else { this.buttonStatus = null; } + if (item['LoginStatus'] == true) { + this.logoutUserSession=true; + } + else{ + this.logoutUserSession = null; + } + + } public SetClickedRowManageRight(j: number, item: any) { @@ -275,7 +281,6 @@ export class UsersList implements OnInit, AfterViewChecked { var tempArr = evt.split(','); this.pageNo = parseInt(tempArr[0]); this.pageLength = parseInt(tempArr[1]); - this._loadingService.ShowLoading("global-loading"); var UserFilterControl = this.Users.value; this.userservice.GetUserList( @@ -292,6 +297,8 @@ export class UsersList implements OnInit, AfterViewChecked { } SearchRecords() { + this.EditbuttonStatus=undefined; + this.logoutUserSession=undefined; this.buttonStatus = null; this.selectedRow = -1; this.SearchUserList('1, ' + this.pageLength); @@ -309,12 +316,15 @@ export class UsersList implements OnInit, AfterViewChecked { } } CancelEditUser() { - this.SearchUserList('1, ' + this.pageLength); + this.SearchUserList(this.pageNo +','+ this.pageLength); this.Mode = 'Manage'; this.modalTitle = 'LIST USER'; this.topPos = '2000px'; this.divClass = 'col-sm-12'; this.selectedRow = -1; + this.EditbuttonStatus=undefined; + this.buttonStatus=undefined; + this.logoutUserSession=undefined; } EditUser() { if (this.EditbuttonStatus) { @@ -375,7 +385,23 @@ export class UsersList implements OnInit, AfterViewChecked { //this.managerightFrm.contains['UserId'].setValue(this.UserEntity.Id); } - + ForceLogoutUser(){ + if (this.logoutUserSession) { + this._loadingService.ShowLoading("global-loading"); + this.userservice.ManageUserLoginStatus({ + userId: this.selectedId, + tagName: 'logout' + }).subscribe(x => { + console.log(x); + this.EditbuttonStatus=undefined; + this.logoutUserSession=undefined; + this.buttonStatus = null; + this.selectedRow = -1; + this.SearchUserList(this.pageNo +','+ this.pageLength); + + },error => console.log(error)); + } + } public UpdateUser() { this.alerts = ''; diff --git a/400-SOURCECODE/Admin/src/assets/styles/bootstrap.css b/400-SOURCECODE/Admin/src/assets/styles/bootstrap.css index 7b06313..d552a44 100644 --- a/400-SOURCECODE/Admin/src/assets/styles/bootstrap.css +++ b/400-SOURCECODE/Admin/src/assets/styles/bootstrap.css @@ -1325,7 +1325,7 @@ pre code { width: 50%; } .col-lg-5 { - width: 41.66666667%; + width: 45.66666667%; } .col-lg-4 { width: 33.33333333%;