diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs index 80ba259..fbaa49a 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs @@ -7,6 +7,7 @@ using System.Net.Http; using System.Web.Http; using AIAHTML5.API.Models; using Newtonsoft.Json.Linq; +using Newtonsoft.Json; namespace AIAHTML5.API.Controllers { @@ -34,12 +35,12 @@ namespace AIAHTML5.API.Controllers { - int siteId = AIAHTML5.API.Models.Users.ValidateLicenseSiteIP(siteUrl["siteIP"].ToString(), siteUrl["remoteIPAddress"].ToString(), siteUrl["accountNumber"].ToString(), Convert.ToByte(siteUrl["edition"].ToString())); + int siteId = AIAHTML5.API.Models.Users.ValidateLicenseSiteIP(siteUrl["siteIP"].ToString(), siteUrl["remoteIPAddress"].ToString(), siteUrl["accountNumber"].ToString(), Convert.ToByte(siteUrl["edition"].ToString())); if (siteId > 0) { dynamic uerinfo = AIAHTML5.API.Models.Users.ValidateSiteLogin(siteUrl["siteIP"].ToString(), siteUrl["accountNumber"].ToString(), siteUrl["urlReferer"].ToString(), siteUrl["edition"].ToString(), siteId); if (uerinfo != null) - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(uerinfo) }; + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(uerinfo)) }; else { //ser user = new User(); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index f01fff8..a95ce72 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -404,249 +404,260 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A var siteInfo = params.split('&'); - for (var i = 0; i < siteInfo.length; i++) - { - debugger; - if (isCalsCredantialForSIte == "True") { - var paramInfo = siteInfo[i].split('='); - if (paramInfo[0] == 'calsCredantial') { - - $rootScope.siteUrlInfo.calsCreds = paramInfo[1]; - console.log("$rootScope.siteUrlInfo.calsCreds" + $rootScope.siteUrlInfo.calsCreds); - } - else if (paramInfo[0] == 'username') { + for (var i = 0; i < siteInfo.length; i++) { + debugger; + if (isCalsCredantialForSIte == "True") { + var paramInfo = siteInfo[i].split('='); + if (paramInfo[0] == 'calsCredantial') { + + $rootScope.siteUrlInfo.calsCreds = paramInfo[1]; + console.log("$rootScope.siteUrlInfo.calsCreds" + $rootScope.siteUrlInfo.calsCreds); + } + else if (paramInfo[0] == 'username') { - $rootScope.siteUrlInfo.username = paramInfo[1]; - console.log("$rootScope.siteUrlInfo.username" + $rootScope.siteUrlInfo.username); - } - else if (paramInfo[0] == 'password') { + $rootScope.siteUrlInfo.username = paramInfo[1]; + console.log("$rootScope.siteUrlInfo.username" + $rootScope.siteUrlInfo.username); + } + else if (paramInfo[0] == 'password') { - $rootScope.siteUrlInfo.password = paramInfo[1]; - console.log("$rootScope.siteUrlInfo.password " + $rootScope.siteUrlInfo.password); - } + $rootScope.siteUrlInfo.password = paramInfo[1]; + console.log("$rootScope.siteUrlInfo.password " + $rootScope.siteUrlInfo.password); + } - $rootScope.userInfo.username = $rootScope.siteUrlInfo.username; - $rootScope.userInfo.password = $rootScope.siteUrlInfo.password; - console.log("$rootScope.userInfo.username" + $rootScope.userInfo.username + " $rootScope.userInfo.password" + $rootScope.userInfo.password); - $rootScope.AuthenticateUser($rootScope.userInfo); + $rootScope.userInfo.username = $rootScope.siteUrlInfo.username; + $rootScope.userInfo.password = $rootScope.siteUrlInfo.password; + console.log("$rootScope.userInfo.username" + $rootScope.userInfo.username + " $rootScope.userInfo.password" + $rootScope.userInfo.password); + - } - else{ - var paramInfo = siteInfo[i].split('='); - if (paramInfo[0] == 'siteIP') { + } + else { + var paramInfo = siteInfo[i].split('='); + if (paramInfo[0] == 'siteIP') { - $rootScope.siteUrlInfo.siteIP = paramInfo[1]; - console.log("$rootScope.siteUrlInfo.siteIP="+ $rootScope.siteUrlInfo.siteIP); - } - else if (paramInfo[0] == 'accountNumber') { + $rootScope.siteUrlInfo.siteIP = paramInfo[1]; + console.log("$rootScope.siteUrlInfo.siteIP=" + $rootScope.siteUrlInfo.siteIP); + } + else if (paramInfo[0] == 'accountNumber') { - $rootScope.siteUrlInfo.accountNumber = paramInfo[1]; - console.log("$rootScope.siteUrlInfo.accountNumber="+$rootScope.siteUrlInfo.accountNumber); - } - else if (paramInfo[0] == 'edition') { + $rootScope.siteUrlInfo.accountNumber = paramInfo[1]; + console.log("$rootScope.siteUrlInfo.accountNumber=" + $rootScope.siteUrlInfo.accountNumber); + } + else if (paramInfo[0] == 'edition') { - $rootScope.siteUrlInfo.siteIP = paramInfo[1]; - console.log("$rootScope.siteUrlInfo.siteIP="+$rootScope.siteUrlInfo.siteIP); - } - else if (paramInfo[0] == 'urlReferer') { + $rootScope.siteUrlInfo.edition = paramInfo[1]; + console.log("$rootScope.siteUrlInfo.siteIP=" + $rootScope.siteUrlInfo.siteIP); + } + else if (paramInfo[0] == 'urlReferer') { - $rootScope.siteUrlInfo.siteIP = paramInfo[1]; - console.log("$rootScope.siteUrlInfo.siteIP"+$rootScope.siteUrlInfo.siteIP); - } - else if (paramInfo[0] == 'remoteIPAddress') { + $rootScope.siteUrlInfo.urlReferer = paramInfo[1]; + console.log("$rootScope.siteUrlInfo.siteIP" + $rootScope.siteUrlInfo.siteIP); + } + else if (paramInfo[0] == 'remoteIPAddress') { - $rootScope.siteUrlInfo.remoteIPAddress = paramInfo[1]; - console.log("$rootScope.siteUrlInfo.remoteIPAddress"+$rootScope.siteUrlInfo.remoteIPAddress); - } - - AuthenticationService.validateClientSite($rootScope.siteUrlInfo) - .then( + $rootScope.siteUrlInfo.remoteIPAddress = paramInfo[1]; + console.log("$rootScope.siteUrlInfo.remoteIPAddress" + $rootScope.siteUrlInfo.remoteIPAddress); + } - function (result) { - console.log(result); - if (result != null) { - - console.log(result); - if (result == LoginConstants.INVALID_CLIENT) { - $rootScope.isVisibleLogin = true; - $rootScope.errorMessage = LoginConstants.INVALID_CLIENT; - $("#messageModal").modal('show'); - } - else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) { - $rootScope.isVisibleLogin = true; - $rootScope.errorMessage = LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER; - $("#messageModal").modal('show'); - } + } + } + if (isCalsCredantialForSIte == "True") { + $rootScope.AuthenticateUser($rootScope.userInfo); + } + else { - - else { - //code for modesty setting - if (result.LicenseInfo != null) { - if (result.Modesty) { - $rootScope.isModestyOn = true; - $rootScope.isModestyOff = false; - localStorage.setItem("globalModesty", "Y"); - $rootScope.formsetting = { - ethnicity: null, - modesty: "Y" - } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) - } - else { - $rootScope.isModestyOn = false; - $rootScope.isModestyOff = true; - localStorage.setItem("globalModesty", "N"); - $rootScope.formsetting = { - ethnicity: null, - modesty: "N" - } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) - } - } - else { - $rootScope.isModestyOn = true; - $rootScope.isModestyOff = false; - localStorage.setItem("globalModesty", "Y"); - $rootScope.formsetting = { - ethnicity: null, - modesty: "Y" - } - $rootScope.UpdateAndCloseSetting($rootScope.formsetting) - } - //code for modesty setting + console.log($rootScope.siteUrlInfo); + AuthenticationService.validateClientSite($rootScope.siteUrlInfo) + .then( - if (typeof result.FirstName != undefined || result.FirstName != "" || result.FirstName != null) { + function (result) { + debugger; + console.log(result); + if (result != null) { - if ($("#messageModal").length > 0) { - $("#messageModal").modal('hide'); - } - else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_ACCOUNT_NUMBER_NOT_NULL) { - $rootScope.isVisibleLogin = true; - $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.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.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.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; - $("#messageModal").modal('show'); - } - else { - //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true - if (result.LicenseId == 0) { - $rootScope.haveRoleAdmin = true; + console.log(result); + if (result == LoginConstants.INVALID_CLIENT) { + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = LoginConstants.INVALID_CLIENT; + $("#messageModal").modal('show'); + } + else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) { + $rootScope.isVisibleLogin = true; + $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.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.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.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.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; + $("#messageModal").modal('show'); + } + - $rootScope.userData = result; - $rootScope.userModules = result.Modules; + else { + if (typeof result.FirstName != undefined || result.FirstName != "" || result.FirstName != null) { + //code for modesty setting + if (result.LicenseInfo != null) { + if (result.Modesty) { + $rootScope.isModestyOn = true; + $rootScope.isModestyOff = false; + localStorage.setItem("globalModesty", "Y"); + $rootScope.formsetting = { + ethnicity: null, + modesty: "Y" + } + $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + } + else { + $rootScope.isModestyOn = false; + $rootScope.isModestyOff = true; + localStorage.setItem("globalModesty", "N"); + $rootScope.formsetting = { + ethnicity: null, + modesty: "N" + } + $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + } + } + else { + $rootScope.isModestyOn = true; + $rootScope.isModestyOff = false; + localStorage.setItem("globalModesty", "Y"); + $rootScope.formsetting = { + ethnicity: null, + modesty: "Y" + } + $rootScope.UpdateAndCloseSetting($rootScope.formsetting) + } + //code for modesty setting + - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); - } + if ($("#messageModal").length > 0) { + $("#messageModal").modal('hide'); + } + + else { - if (isCommingSoonModel == true) { + //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true + if (result.LicenseId == 0) { + $rootScope.haveRoleAdmin = true; - ShowAssignedModulesPopup(result.Modules); + $rootScope.userData = result; + $rootScope.userModules = result.Modules; - //if (userInfo.rememberChk) { + if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); + } - // $scope.saveRemeberMeDetails(result, userInfo); - //} + if (isCommingSoonModel == true) { - sessionStorage.setItem("loginSession", "true"); - localStorage.setItem('isCommingSoonModel', false); + ShowAssignedModulesPopup(result.Modules); - $rootScope.isVisibleLogin = false; - } + //if (userInfo.rememberChk) { + // $scope.saveRemeberMeDetails(result, userInfo); + //} - $location.path('/'); + sessionStorage.setItem("loginSession", "true"); + localStorage.setItem('isCommingSoonModel', false); - } - else { - if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) { - //0. - $rootScope.userData = result; - $rootScope.userModules = result.Modules; + $rootScope.isVisibleLogin = false; + } - //1. set haveRoleAdmin = false because LicenseInfo is not null - $rootScope.haveRoleAdmin = false; - //2. - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { + $location.path('/'); - localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); - } + } + else { + if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) { + //0. + $rootScope.userData = result; + $rootScope.userModules = result.Modules; - // 3.ShowAssignedModulesPopup - //isCommingSoonModel =true only when user comes first time on application and login - if (isCommingSoonModel == true) { + //1. set haveRoleAdmin = false because LicenseInfo is not null + $rootScope.haveRoleAdmin = false; - ShowAssignedModulesPopup(result.Modules); - } + //2. + if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { - //4. - //if ($scope.rememberChk) { + localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); + } - // $scope.saveRemeberMeDetails(result, userInfo); - //} + // 3.ShowAssignedModulesPopup + //isCommingSoonModel =true only when user comes first time on application and login + if (isCommingSoonModel == true) { - //5. - sessionStorage.setItem("loginSession", "true"); - $rootScope.isVisibleLogin = false; + ShowAssignedModulesPopup(result.Modules); + } - //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); + //4. + //if ($scope.rememberChk) { - $location.path('/'); + // $scope.saveRemeberMeDetails(result, userInfo); + //} - } - 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('/'); - } - } - } + //5. + sessionStorage.setItem("loginSession", "true"); + $rootScope.isVisibleLogin = false; + //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); - } - } + $location.path('/'); - } - - }, - - function (error) { + } + 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('/'); + } + } + } - 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'); + + } + ) + + } //$rootScope.siteUrlInfo.siteIP = siteInfo[0]; //$rootScope.siteUrlInfo.remoteIPAddress = siteInfo[1]; //$rootScope.siteUrlInfo.accountNumber = siteInfo[2];