Commit 8653a6935ca17a10bf813e9f6f2a4a01dc059351

Authored by unknown
1 parent 398acc9d

Commit Changes

400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs
... ... @@ -28,29 +28,42 @@ namespace AIAHTML5.API.Controllers
28 28 public HttpResponseMessage Post([FromBody]JObject siteUrl)
29 29 {
30 30 HttpResponseMessage response = null;
31   -
32   - int siteId = AIAHTML5.API.Models.Users.ValidateLicenseSiteIP(siteUrl["siteIP"].ToString(), siteUrl["remoteIPAddress"].ToString(), siteUrl["accountNumber"].ToString(), Convert.ToByte(siteUrl["edition"].ToString()));
33   - if (siteId > 0)
  31 + if (siteUrl != null)
34 32 {
35   - dynamic uerinfo = AIAHTML5.API.Models.Users.ValidateSiteLogin(siteUrl["siteIP"].ToString(), siteUrl["accountNumber"].ToString(), siteUrl["urlReferer"].ToString(), siteUrl["edition"].ToString(), siteId);
36   - if (uerinfo != null)
37   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(uerinfo) };
  33 + if (!string.IsNullOrEmpty(siteUrl["siteIP"].ToString()) && !string.IsNullOrEmpty(siteUrl["remoteIPAddress"].ToString()) && !string.IsNullOrEmpty(siteUrl["accountNumber"].ToString()) && !string.IsNullOrEmpty(siteUrl["edition"].ToString()))
  34 +
  35 + {
  36 +
  37 + int siteId = AIAHTML5.API.Models.Users.ValidateLicenseSiteIP(siteUrl["siteIP"].ToString(), siteUrl["remoteIPAddress"].ToString(), siteUrl["accountNumber"].ToString(), Convert.ToByte(siteUrl["edition"].ToString()));
  38 + if (siteId > 0)
  39 + {
  40 + dynamic uerinfo = AIAHTML5.API.Models.Users.ValidateSiteLogin(siteUrl["siteIP"].ToString(), siteUrl["accountNumber"].ToString(), siteUrl["urlReferer"].ToString(), siteUrl["edition"].ToString(), siteId);
  41 + if (uerinfo != null)
  42 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(uerinfo) };
  43 + else
  44 + {
  45 + //ser user = new User();
  46 + //user.LoginFailureCauseId = AIAConstants.INVALID_CLIENT;
  47 + //dynamic userinfo = user;
  48 + //response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userInfo) };
  49 +
  50 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.INVALID_CLIENT) };
  51 + }
  52 + }
  53 +
38 54 else
39 55 {
40   - //ser user = new User();
41   - //user.LoginFailureCauseId = AIAConstants.INVALID_CLIENT;
42   - //dynamic userinfo = user;
43   - //response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userInfo) };
44   -
45   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.INVALID_CLIENT) };
  56 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MSG_NOT_AUTHORIZE_SITE_USER) };
  57 +
  58 + }
46 59 }
47 60 }
48 61 else
49 62 {
50   - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MSG_NOT_AUTHORIZE_SITE_USER) };
51   -
  63 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = null };
52 64  
53 65 }
  66 +
54 67 return response;
55 68 }
56 69  
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -135,7 +135,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
135 135  
136 136  
137 137 $rootScope.initializeAIA = function () {
138   - if (urlParams != null && urlParams != undefined) {
  138 + if (params != null && params != undefined) {
139 139  
140 140 $scope.ValidateClientSiteUrl();
141 141 }
... ... @@ -406,24 +406,28 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
406 406  
407 407 for (var i = 0; i < siteInfo.length; i++)
408 408 {
409   - if (isCalsCredantial) {
  409 + debugger;
  410 + if (isCalsCredantialForSIte == "True") {
410 411 var paramInfo = siteInfo[i].split('=');
411 412 if (paramInfo[0] == 'calsCredantial') {
412 413  
413 414 $rootScope.siteUrlInfo.calsCreds = paramInfo[1];
  415 + console.log("$rootScope.siteUrlInfo.calsCreds" + $rootScope.siteUrlInfo.calsCreds);
414 416 }
415 417 else if (paramInfo[0] == 'username') {
416 418  
417 419 $rootScope.siteUrlInfo.username = paramInfo[1];
  420 + console.log("$rootScope.siteUrlInfo.username" + $rootScope.siteUrlInfo.username);
418 421 }
419 422 else if (paramInfo[0] == 'password') {
420 423  
421 424 $rootScope.siteUrlInfo.password = paramInfo[1];
  425 + console.log("$rootScope.siteUrlInfo.password " + $rootScope.siteUrlInfo.password);
422 426 }
423 427  
424 428 $rootScope.userInfo.username = $rootScope.siteUrlInfo.username;
425 429 $rootScope.userInfo.password = $rootScope.siteUrlInfo.password;
426   -
  430 + console.log("$rootScope.userInfo.username" + $rootScope.userInfo.username + " $rootScope.userInfo.password" + $rootScope.userInfo.password);
427 431 $rootScope.AuthenticateUser($rootScope.userInfo);
428 432  
429 433 }
... ... @@ -432,30 +436,37 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
432 436 if (paramInfo[0] == 'siteIP') {
433 437  
434 438 $rootScope.siteUrlInfo.siteIP = paramInfo[1];
  439 + console.log("$rootScope.siteUrlInfo.siteIP="+ $rootScope.siteUrlInfo.siteIP);
435 440 }
436 441 else if (paramInfo[0] == 'accountNumber') {
437 442  
438 443 $rootScope.siteUrlInfo.accountNumber = paramInfo[1];
  444 + console.log("$rootScope.siteUrlInfo.accountNumber="+$rootScope.siteUrlInfo.accountNumber);
439 445 }
440 446 else if (paramInfo[0] == 'edition') {
441 447  
442 448 $rootScope.siteUrlInfo.siteIP = paramInfo[1];
  449 + console.log("$rootScope.siteUrlInfo.siteIP="+$rootScope.siteUrlInfo.siteIP);
443 450 }
444 451 else if (paramInfo[0] == 'urlReferer') {
445 452  
446 453 $rootScope.siteUrlInfo.siteIP = paramInfo[1];
  454 + console.log("$rootScope.siteUrlInfo.siteIP"+$rootScope.siteUrlInfo.siteIP);
447 455 }
448 456 else if (paramInfo[0] == 'remoteIPAddress') {
449 457  
450 458 $rootScope.siteUrlInfo.remoteIPAddress = paramInfo[1];
  459 + console.log("$rootScope.siteUrlInfo.remoteIPAddress"+$rootScope.siteUrlInfo.remoteIPAddress);
451 460 }
452   -
  461 +
453 462 AuthenticationService.validateClientSite($rootScope.siteUrlInfo)
454 463 .then(
455 464  
456 465 function (result) {
457 466 console.log(result);
458   -
  467 + if (result != null) {
  468 +
  469 +
459 470 console.log(result);
460 471 if (result == LoginConstants.INVALID_CLIENT) {
461 472 $rootScope.isVisibleLogin = true;
... ... @@ -537,7 +548,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
537 548 //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true
538 549 if (result.LicenseId == 0) {
539 550 $rootScope.haveRoleAdmin = true;
540   -
  551 +
541 552 $rootScope.userData = result;
542 553 $rootScope.userModules = result.Modules;
543 554  
... ... @@ -614,7 +625,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
614 625 $location.path('/');
615 626 }
616 627 }
617   -
  628 + }
618 629  
619 630  
620 631 }
... ... @@ -623,7 +634,7 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
623 634 }
624 635  
625 636 },
626   - function (error) { }
  637 +
627 638 function (error) {
628 639  
629 640 console.log(' Error in authentication = ' + error.statusText);
... ...
400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js
... ... @@ -2,7 +2,7 @@
2 2 return {
3 3 authenticateUser: function (userInfo) {
4 4 var deferred = $q.defer();
5   -
  5 +
6 6 $http.post('/API/api/Authenticate', JSON.stringify(userInfo), {
7 7 headers: {
8 8 'Content-Type': 'application/json'
... ... @@ -24,7 +24,7 @@
24 24  
25 25 validateClientSite: function (clientInfo) {
26 26 var deferred = $q.defer();
27   -
  27 + debugger;
28 28 $http.post('/API/api/Client', JSON.stringify(clientInfo), {
29 29 headers: {
30 30 'Content-Type': 'application/json'
... ...
400-SOURCECODE/AIAHTML5.Web/index.aspx.cs
... ... @@ -21,7 +21,7 @@ namespace ADAM.AIA
21 21  
22 22 protected void Page_Load(object sender, EventArgs e)
23 23 {
24   - urlParams = "XYZ";
  24 + //urlParams = "XYZ";
25 25  
26 26 if (Request.HttpMethod == "POST")
27 27 {
... ...