From 8653a6935ca17a10bf813e9f6f2a4a01dc059351 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 29 Aug 2018 18:18:13 +0530 Subject: [PATCH] Commit Changes --- 400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs | 41 +++++++++++++++++++++++++++-------------- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 27 +++++++++++++++++++-------- 400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js | 4 ++-- 400-SOURCECODE/AIAHTML5.Web/index.aspx.cs | 2 +- 4 files changed, 49 insertions(+), 25 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs index b36b232..80ba259 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs @@ -28,29 +28,42 @@ namespace AIAHTML5.API.Controllers public HttpResponseMessage Post([FromBody]JObject siteUrl) { HttpResponseMessage response = null; - - int siteId = AIAHTML5.API.Models.Users.ValidateLicenseSiteIP(siteUrl["siteIP"].ToString(), siteUrl["remoteIPAddress"].ToString(), siteUrl["accountNumber"].ToString(), Convert.ToByte(siteUrl["edition"].ToString())); - if (siteId > 0) + if (siteUrl != null) { - 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) }; + if (!string.IsNullOrEmpty(siteUrl["siteIP"].ToString()) && !string.IsNullOrEmpty(siteUrl["remoteIPAddress"].ToString()) && !string.IsNullOrEmpty(siteUrl["accountNumber"].ToString()) && !string.IsNullOrEmpty(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) }; + else + { + //ser user = new User(); + //user.LoginFailureCauseId = AIAConstants.INVALID_CLIENT; + //dynamic userinfo = user; + //response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userInfo) }; + + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.INVALID_CLIENT) }; + } + } + else { - //ser user = new User(); - //user.LoginFailureCauseId = AIAConstants.INVALID_CLIENT; - //dynamic userinfo = user; - //response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userInfo) }; - - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.INVALID_CLIENT) }; + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MSG_NOT_AUTHORIZE_SITE_USER) }; + + } } } else { - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MSG_NOT_AUTHORIZE_SITE_USER) }; - + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = null }; } + return response; } diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 064652f..f01fff8 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -135,7 +135,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $rootScope.initializeAIA = function () { - if (urlParams != null && urlParams != undefined) { + if (params != null && params != undefined) { $scope.ValidateClientSiteUrl(); } @@ -406,24 +406,28 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A for (var i = 0; i < siteInfo.length; i++) { - if (isCalsCredantial) { + 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.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); } @@ -432,30 +436,37 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A if (paramInfo[0] == 'siteIP') { $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.siteIP = 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.remoteIPAddress = paramInfo[1]; + console.log("$rootScope.siteUrlInfo.remoteIPAddress"+$rootScope.siteUrlInfo.remoteIPAddress); } - + AuthenticationService.validateClientSite($rootScope.siteUrlInfo) .then( function (result) { console.log(result); - + if (result != null) { + + console.log(result); if (result == LoginConstants.INVALID_CLIENT) { $rootScope.isVisibleLogin = true; @@ -537,7 +548,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true if (result.LicenseId == 0) { $rootScope.haveRoleAdmin = true; - + $rootScope.userData = result; $rootScope.userModules = result.Modules; @@ -614,7 +625,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A $location.path('/'); } } - + } } @@ -623,7 +634,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A } }, - function (error) { } + function (error) { console.log(' Error in authentication = ' + error.statusText); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js index f827bb4..121bd72 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -2,7 +2,7 @@ return { authenticateUser: function (userInfo) { var deferred = $q.defer(); - + $http.post('/API/api/Authenticate', JSON.stringify(userInfo), { headers: { 'Content-Type': 'application/json' @@ -24,7 +24,7 @@ validateClientSite: function (clientInfo) { var deferred = $q.defer(); - + debugger; $http.post('/API/api/Client', JSON.stringify(clientInfo), { headers: { 'Content-Type': 'application/json' diff --git a/400-SOURCECODE/AIAHTML5.Web/index.aspx.cs b/400-SOURCECODE/AIAHTML5.Web/index.aspx.cs index 3fa4e5f..1b5d23e 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.aspx.cs +++ b/400-SOURCECODE/AIAHTML5.Web/index.aspx.cs @@ -21,7 +21,7 @@ namespace ADAM.AIA protected void Page_Load(object sender, EventArgs e) { - urlParams = "XYZ"; + //urlParams = "XYZ"; if (Request.HttpMethod == "POST") { -- libgit2 0.21.4