diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 786ed1b..e3a3f1a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -2926,9 +2926,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l grayCanvasContext.putImageData($rootScope.grayImageDataList[parseInt(i)], 0, 0); } } - $scope.message = AIAConstants.NO_BODY_SYSTEM_AVAILABLE; - $("#daMessageModal").modal('show'); - + $scope.message = AIAConstants.NO_BODY_SYSTEM_AVAILABLE; $("#daMessageModal").modal('show'); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 84a75c1..e0d13b4 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -1,7 +1,7 @@ 'use strict'; -AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", -function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants) { +AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", "AIAConstants", +function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants,AIAConstants) { //$scope.pageToOpen = { // name: 'MainMenu' @@ -111,117 +111,138 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $("body.modal-open").css("padding-right", "0px"); } - $rootScope.initializeAIA = function () { - $rootScope.isLoading = false; - - var url = $location.url(); + $rootScope.promptUserForCookies= function() + { + $rootScope.errorMessage = AIAConstants.COOKIES_MESSAGE; + $("#messageModal").modal('show'); + + } + + + $rootScope.initializeAIA = function () { + + if (navigator.cookieEnabled) { - if (url.indexOf('?unb:') != -1) { + $rootScope.isLoading = false; - $rootScope.isVisibleLogin = true; - $rootScope.UnblockUser(); - } - else if (url.indexOf('?em:') != -1) { + var url = $location.url(); + + //unblock user + if (url.indexOf('?unb:') != -1) { - $rootScope.isVisibleLogin = false; - $rootScope.isVisibleResetPass = true; + $rootScope.isVisibleLogin = true; + $rootScope.UnblockUser(); + } + else if (url.indexOf('?em:') != -1) { + + $rootScope.isVisibleLogin = false; + $rootScope.isVisibleResetPass = true; + } + else { + $rootScope.isVisibleLogin = true; + $rootScope.isVisibleResetPass = false; + getUserDetails(); + } } + else { + $rootScope.isVisibleLogin = true; - $rootScope.isVisibleResetPass = false; - getUserDetails(); + + $rootScope.promptUserForCookies(); } } - $rootScope.AuthenticateUser = function (userInfo) { - $rootScope.errorMessage = ""; - if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { + $rootScope.AuthenticateUser = function (userInfo) + { + if (navigator.cookieEnabled) { - // alert(LoginMessageConstants.USER_CREDENTIALS_MISSING); - $rootScope.errorMessage = LoginMessageConstants.USER_CREDENTIALS_MISSING; - $("#messageModal").modal('show'); - } - else { + $rootScope.errorMessage = ""; + if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { - AuthenticationService.authenticateUser(userInfo) - .then( + // alert(LoginMessageConstants.USER_CREDENTIALS_MISSING); + $rootScope.errorMessage = LoginMessageConstants.USER_CREDENTIALS_MISSING; + $("#messageModal").modal('show'); + } + else { - function (result) { - if (result == LoginConstants.USER_NOT_FOUND) { - $rootScope.isVisibleLogin = true; - // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); - $rootScope.errorMessage = LoginMessageConstants.INVALID_USER; - $("#messageModal").modal('show'); - } - else { - if (typeof result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) { + AuthenticationService.authenticateUser(userInfo) + .then( - if ($("#messageModal").length > 0) { - $("#messageModal").modal('hide'); - } - if (result.LoginFailureCauseId!=undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) { - $rootScope.isVisibleLogin = true; - $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.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.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.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.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.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.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.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.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.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; - $("#messageModal").modal('show'); - } - else { - - //if (result.UserType == UserTypeConstants.SUPER_ADMIN && result.IsActive) { //(!result.IsSubscriptionExpired) && - if (result.LicenseId == 0 && result.IsActive) { + function (result) { + if (result == LoginConstants.USER_NOT_FOUND) { + $rootScope.isVisibleLogin = true; + // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); + $rootScope.errorMessage = LoginMessageConstants.INVALID_USER; + $("#messageModal").modal('show'); + } + else { + if (typeof result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) { + + if ($("#messageModal").length > 0) { + $("#messageModal").modal('hide'); + } + if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) { + $rootScope.isVisibleLogin = true; + $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.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.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.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.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.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.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.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.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.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; + $("#messageModal").modal('show'); + } + else { + + //if (result.UserType == UserTypeConstants.SUPER_ADMIN && result.IsActive) { //(!result.IsSubscriptionExpired) && + if (result.LicenseId == 0 && result.IsActive) { $rootScope.userData = result; $rootScope.userModules = result.Modules; $rootScope.isVisibleLogin = false; @@ -233,42 +254,49 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } else { if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) { - $rootScope.userData = result; - $rootScope.userModules = result.Modules; - $rootScope.isVisibleLogin = false; - $rootScope.haveRoleAdmin = false; - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); - ShowAssignedModulesPopup(result.Modules); - $location.path('/'); + $rootScope.userData = result; + $rootScope.userModules = result.Modules; + $rootScope.isVisibleLogin = false; + $rootScope.haveRoleAdmin = false; + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); + ShowAssignedModulesPopup(result.Modules); + $location.path('/'); + } + else { + if ($('#dvTerms').length > 0) { + $('#dvTerms').html(result.TermsAndConditionsText); } - else { - if ($('#dvTerms').length > 0) { - $('#dvTerms').html(result.TermsAndConditionsText); - } - $rootScope.isVisibleLogin = true; - $('#dvTermCondition').fadeIn(); - $rootScope.userData = result; - $rootScope.haveRoleAdmin = false; - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); - $location.path('/'); - } + $rootScope.isVisibleLogin = true; + $('#dvTermCondition').fadeIn(); + $rootScope.userData = result; + $rootScope.haveRoleAdmin = false; + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); + $location.path('/'); } - } - + } + } - }), - - function (error) { - console.log(' Error in authentication = ' + error.statusText); - // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); - $rootScope.isVisibleLogin = true; - $rootScope.errorMessage = error; - $("#messageModal").modal('show'); - } + } + }), + + function (error) { + console.log(' Error in authentication = ' + error.statusText); + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = error; + $("#messageModal").modal('show'); + } + } } + + else + { + $rootScope.promptUserForCookies(); + } + } function ShowAssignedModulesPopup(userModules) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js index 6ee86b4..b269a85 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js @@ -491,10 +491,13 @@ AIA.constant("UserModules", [ "slug": "Link/aod" } ]); -AIA.constant("AIAConstants", { +AIA.constant("AIAConstants", { "NO_BODY_SYSTEM_AVAILABLE": "Selected body system is not available on this layer.", + "COOKIES_MESSAGE": "You need to enable your browser's cookies to run this application.", }) + + AIA.config(function ($routeProvider, pages, $locationProvider) { $locationProvider.html5Mode(true);