Commit d639c6d661fe56ac55dea42472623950fdb6f23f

Authored by unknown
1 parent 8653a693

Commit Changes

400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs
@@ -7,6 +7,7 @@ using System.Net.Http; @@ -7,6 +7,7 @@ using System.Net.Http;
7 using System.Web.Http; 7 using System.Web.Http;
8 using AIAHTML5.API.Models; 8 using AIAHTML5.API.Models;
9 using Newtonsoft.Json.Linq; 9 using Newtonsoft.Json.Linq;
  10 +using Newtonsoft.Json;
10 11
11 namespace AIAHTML5.API.Controllers 12 namespace AIAHTML5.API.Controllers
12 { 13 {
@@ -34,12 +35,12 @@ namespace AIAHTML5.API.Controllers @@ -34,12 +35,12 @@ namespace AIAHTML5.API.Controllers
34 35
35 { 36 {
36 37
37 - int siteId = AIAHTML5.API.Models.Users.ValidateLicenseSiteIP(siteUrl["siteIP"].ToString(), siteUrl["remoteIPAddress"].ToString(), siteUrl["accountNumber"].ToString(), Convert.ToByte(siteUrl["edition"].ToString())); 38 + 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 if (siteId > 0)
39 { 40 {
40 dynamic uerinfo = AIAHTML5.API.Models.Users.ValidateSiteLogin(siteUrl["siteIP"].ToString(), siteUrl["accountNumber"].ToString(), siteUrl["urlReferer"].ToString(), siteUrl["edition"].ToString(), siteId); 41 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 if (uerinfo != null)
42 - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(uerinfo) }; 43 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(uerinfo)) };
43 else 44 else
44 { 45 {
45 //ser user = new User(); 46 //ser user = new User();
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -404,249 +404,260 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A @@ -404,249 +404,260 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
404 404
405 var siteInfo = params.split('&'); 405 var siteInfo = params.split('&');
406 406
407 - for (var i = 0; i < siteInfo.length; i++)  
408 - {  
409 - debugger;  
410 - if (isCalsCredantialForSIte == "True") {  
411 - var paramInfo = siteInfo[i].split('=');  
412 - if (paramInfo[0] == 'calsCredantial') {  
413 -  
414 - $rootScope.siteUrlInfo.calsCreds = paramInfo[1];  
415 - console.log("$rootScope.siteUrlInfo.calsCreds" + $rootScope.siteUrlInfo.calsCreds);  
416 - }  
417 - else if (paramInfo[0] == 'username') { 407 + for (var i = 0; i < siteInfo.length; i++) {
  408 + debugger;
  409 + if (isCalsCredantialForSIte == "True") {
  410 + var paramInfo = siteInfo[i].split('=');
  411 + if (paramInfo[0] == 'calsCredantial') {
  412 +
  413 + $rootScope.siteUrlInfo.calsCreds = paramInfo[1];
  414 + console.log("$rootScope.siteUrlInfo.calsCreds" + $rootScope.siteUrlInfo.calsCreds);
  415 + }
  416 + else if (paramInfo[0] == 'username') {
418 417
419 - $rootScope.siteUrlInfo.username = paramInfo[1];  
420 - console.log("$rootScope.siteUrlInfo.username" + $rootScope.siteUrlInfo.username);  
421 - }  
422 - else if (paramInfo[0] == 'password') { 418 + $rootScope.siteUrlInfo.username = paramInfo[1];
  419 + console.log("$rootScope.siteUrlInfo.username" + $rootScope.siteUrlInfo.username);
  420 + }
  421 + else if (paramInfo[0] == 'password') {
423 422
424 - $rootScope.siteUrlInfo.password = paramInfo[1];  
425 - console.log("$rootScope.siteUrlInfo.password " + $rootScope.siteUrlInfo.password);  
426 - } 423 + $rootScope.siteUrlInfo.password = paramInfo[1];
  424 + console.log("$rootScope.siteUrlInfo.password " + $rootScope.siteUrlInfo.password);
  425 + }
427 426
428 - $rootScope.userInfo.username = $rootScope.siteUrlInfo.username;  
429 - $rootScope.userInfo.password = $rootScope.siteUrlInfo.password;  
430 - console.log("$rootScope.userInfo.username" + $rootScope.userInfo.username + " $rootScope.userInfo.password" + $rootScope.userInfo.password);  
431 - $rootScope.AuthenticateUser($rootScope.userInfo); 427 + $rootScope.userInfo.username = $rootScope.siteUrlInfo.username;
  428 + $rootScope.userInfo.password = $rootScope.siteUrlInfo.password;
  429 + console.log("$rootScope.userInfo.username" + $rootScope.userInfo.username + " $rootScope.userInfo.password" + $rootScope.userInfo.password);
  430 +
432 431
433 - }  
434 - else{  
435 - var paramInfo = siteInfo[i].split('=');  
436 - if (paramInfo[0] == 'siteIP') { 432 + }
  433 + else {
  434 + var paramInfo = siteInfo[i].split('=');
  435 + if (paramInfo[0] == 'siteIP') {
437 436
438 - $rootScope.siteUrlInfo.siteIP = paramInfo[1];  
439 - console.log("$rootScope.siteUrlInfo.siteIP="+ $rootScope.siteUrlInfo.siteIP);  
440 - }  
441 - else if (paramInfo[0] == 'accountNumber') { 437 + $rootScope.siteUrlInfo.siteIP = paramInfo[1];
  438 + console.log("$rootScope.siteUrlInfo.siteIP=" + $rootScope.siteUrlInfo.siteIP);
  439 + }
  440 + else if (paramInfo[0] == 'accountNumber') {
442 441
443 - $rootScope.siteUrlInfo.accountNumber = paramInfo[1];  
444 - console.log("$rootScope.siteUrlInfo.accountNumber="+$rootScope.siteUrlInfo.accountNumber);  
445 - }  
446 - else if (paramInfo[0] == 'edition') { 442 + $rootScope.siteUrlInfo.accountNumber = paramInfo[1];
  443 + console.log("$rootScope.siteUrlInfo.accountNumber=" + $rootScope.siteUrlInfo.accountNumber);
  444 + }
  445 + else if (paramInfo[0] == 'edition') {
447 446
448 - $rootScope.siteUrlInfo.siteIP = paramInfo[1];  
449 - console.log("$rootScope.siteUrlInfo.siteIP="+$rootScope.siteUrlInfo.siteIP);  
450 - }  
451 - else if (paramInfo[0] == 'urlReferer') { 447 + $rootScope.siteUrlInfo.edition = paramInfo[1];
  448 + console.log("$rootScope.siteUrlInfo.siteIP=" + $rootScope.siteUrlInfo.siteIP);
  449 + }
  450 + else if (paramInfo[0] == 'urlReferer') {
452 451
453 - $rootScope.siteUrlInfo.siteIP = paramInfo[1];  
454 - console.log("$rootScope.siteUrlInfo.siteIP"+$rootScope.siteUrlInfo.siteIP);  
455 - }  
456 - else if (paramInfo[0] == 'remoteIPAddress') { 452 + $rootScope.siteUrlInfo.urlReferer = paramInfo[1];
  453 + console.log("$rootScope.siteUrlInfo.siteIP" + $rootScope.siteUrlInfo.siteIP);
  454 + }
  455 + else if (paramInfo[0] == 'remoteIPAddress') {
457 456
458 - $rootScope.siteUrlInfo.remoteIPAddress = paramInfo[1];  
459 - console.log("$rootScope.siteUrlInfo.remoteIPAddress"+$rootScope.siteUrlInfo.remoteIPAddress);  
460 - }  
461 -  
462 - AuthenticationService.validateClientSite($rootScope.siteUrlInfo)  
463 - .then( 457 + $rootScope.siteUrlInfo.remoteIPAddress = paramInfo[1];
  458 + console.log("$rootScope.siteUrlInfo.remoteIPAddress" + $rootScope.siteUrlInfo.remoteIPAddress);
  459 + }
464 460
465 - function (result) {  
466 - console.log(result);  
467 - if (result != null) {  
468 461
469 -  
470 - console.log(result);  
471 - if (result == LoginConstants.INVALID_CLIENT) {  
472 - $rootScope.isVisibleLogin = true;  
473 - $rootScope.errorMessage = LoginConstants.INVALID_CLIENT;  
474 - $("#messageModal").modal('show');  
475 - }  
476 - else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) {  
477 - $rootScope.isVisibleLogin = true;  
478 - $rootScope.errorMessage = LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER;  
479 - $("#messageModal").modal('show');  
480 - } 462 + }
  463 + }
  464 + if (isCalsCredantialForSIte == "True") {
  465 + $rootScope.AuthenticateUser($rootScope.userInfo);
  466 + }
  467 + else {
481 468
482 -  
483 - else {  
484 469
485 - //code for modesty setting  
486 - if (result.LicenseInfo != null) {  
487 - if (result.Modesty) {  
488 - $rootScope.isModestyOn = true;  
489 - $rootScope.isModestyOff = false;  
490 - localStorage.setItem("globalModesty", "Y");  
491 - $rootScope.formsetting = {  
492 - ethnicity: null,  
493 - modesty: "Y"  
494 - }  
495 - $rootScope.UpdateAndCloseSetting($rootScope.formsetting)  
496 - }  
497 - else {  
498 - $rootScope.isModestyOn = false;  
499 - $rootScope.isModestyOff = true;  
500 - localStorage.setItem("globalModesty", "N");  
501 - $rootScope.formsetting = {  
502 - ethnicity: null,  
503 - modesty: "N"  
504 - }  
505 - $rootScope.UpdateAndCloseSetting($rootScope.formsetting)  
506 - }  
507 - }  
508 - else {  
509 - $rootScope.isModestyOn = true;  
510 - $rootScope.isModestyOff = false;  
511 - localStorage.setItem("globalModesty", "Y");  
512 - $rootScope.formsetting = {  
513 - ethnicity: null,  
514 - modesty: "Y"  
515 - }  
516 - $rootScope.UpdateAndCloseSetting($rootScope.formsetting)  
517 - }  
518 - //code for modesty setting 470 + console.log($rootScope.siteUrlInfo);
519 471
  472 + AuthenticationService.validateClientSite($rootScope.siteUrlInfo)
  473 + .then(
520 474
521 - if (typeof result.FirstName != undefined || result.FirstName != "" || result.FirstName != null) { 475 + function (result) {
  476 + debugger;
  477 + console.log(result);
  478 + if (result != null) {
522 479
523 - if ($("#messageModal").length > 0) {  
524 - $("#messageModal").modal('hide');  
525 - }  
526 - else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_ACCOUNT_NUMBER_NOT_NULL) {  
527 - $rootScope.isVisibleLogin = true;  
528 - $rootScope.errorMessage = LoginMessageConstants.E_ACCOUNT_NUMBER_NOT_NULL;  
529 - $("#messageModal").modal('show');  
530 - }  
531 - else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_ID_NOT_NULL) {  
532 - $rootScope.isVisibleLogin = true;  
533 - $rootScope.errorMessage = LoginMessageConstants.E_EDITION_ID_NOT_NULL;  
534 - $("#messageModal").modal('show');  
535 - }  
536 - else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_NOT_LINKED_WITH_SITE) {  
537 - $rootScope.isVisibleLogin = true;  
538 - $rootScope.errorMessage = LoginMessageConstants.E_EDITION_NOT_LINKED_WITH_SITE;  
539 - $("#messageModal").modal('show');  
540 - }  
541 - else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.LICENSE_INACTIVE) {  
542 - $rootScope.isVisibleLogin = true;  
543 - $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;  
544 - $("#messageModal").modal('show');  
545 - }  
546 - else {  
547 480
548 - //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true  
549 - if (result.LicenseId == 0) {  
550 - $rootScope.haveRoleAdmin = true; 481 + console.log(result);
  482 + if (result == LoginConstants.INVALID_CLIENT) {
  483 + $rootScope.isVisibleLogin = true;
  484 + $rootScope.errorMessage = LoginConstants.INVALID_CLIENT;
  485 + $("#messageModal").modal('show');
  486 + }
  487 + else if (result == LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER) {
  488 + $rootScope.isVisibleLogin = true;
  489 + $rootScope.errorMessage = LoginConstants.MSG_NOT_AUTHORIZE_SITE_USER;
  490 + $("#messageModal").modal('show');
  491 + }
  492 +
  493 + else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_ACCOUNT_NUMBER_NOT_NULL) {
  494 + $rootScope.isVisibleLogin = true;
  495 + $rootScope.errorMessage = LoginMessageConstants.E_ACCOUNT_NUMBER_NOT_NULL;
  496 + $("#messageModal").modal('show');
  497 + }
  498 + else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_ID_NOT_NULL) {
  499 + $rootScope.isVisibleLogin = true;
  500 + $rootScope.errorMessage = LoginMessageConstants.E_EDITION_ID_NOT_NULL;
  501 + $("#messageModal").modal('show');
  502 + }
  503 + else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_EDITION_NOT_LINKED_WITH_SITE) {
  504 + $rootScope.isVisibleLogin = true;
  505 + $rootScope.errorMessage = LoginMessageConstants.E_EDITION_NOT_LINKED_WITH_SITE;
  506 + $("#messageModal").modal('show');
  507 + }
  508 + else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.LICENSE_INACTIVE) {
  509 + $rootScope.isVisibleLogin = true;
  510 + $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
  511 + $("#messageModal").modal('show');
  512 + }
  513 +
551 514
552 - $rootScope.userData = result;  
553 - $rootScope.userModules = result.Modules; 515 + else {
  516 + if (typeof result.FirstName != undefined || result.FirstName != "" || result.FirstName != null) {
  517 + //code for modesty setting
  518 + if (result.LicenseInfo != null) {
  519 + if (result.Modesty) {
  520 + $rootScope.isModestyOn = true;
  521 + $rootScope.isModestyOff = false;
  522 + localStorage.setItem("globalModesty", "Y");
  523 + $rootScope.formsetting = {
  524 + ethnicity: null,
  525 + modesty: "Y"
  526 + }
  527 + $rootScope.UpdateAndCloseSetting($rootScope.formsetting)
  528 + }
  529 + else {
  530 + $rootScope.isModestyOn = false;
  531 + $rootScope.isModestyOff = true;
  532 + localStorage.setItem("globalModesty", "N");
  533 + $rootScope.formsetting = {
  534 + ethnicity: null,
  535 + modesty: "N"
  536 + }
  537 + $rootScope.UpdateAndCloseSetting($rootScope.formsetting)
  538 + }
  539 + }
  540 + else {
  541 + $rootScope.isModestyOn = true;
  542 + $rootScope.isModestyOff = false;
  543 + localStorage.setItem("globalModesty", "Y");
  544 + $rootScope.formsetting = {
  545 + ethnicity: null,
  546 + modesty: "Y"
  547 + }
  548 + $rootScope.UpdateAndCloseSetting($rootScope.formsetting)
  549 + }
  550 + //code for modesty setting
  551 +
554 552
555 - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {  
556 - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));  
557 - } 553 + if ($("#messageModal").length > 0) {
  554 + $("#messageModal").modal('hide');
  555 + }
  556 +
  557 + else {
558 558
559 - if (isCommingSoonModel == true) { 559 + //LicenseId would be zero for admin that is why we set the haveRoleAdmin = true
  560 + if (result.LicenseId == 0) {
  561 + $rootScope.haveRoleAdmin = true;
560 562
561 - ShowAssignedModulesPopup(result.Modules); 563 + $rootScope.userData = result;
  564 + $rootScope.userModules = result.Modules;
562 565
563 - //if (userInfo.rememberChk) { 566 + if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
  567 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  568 + }
564 569
565 - // $scope.saveRemeberMeDetails(result, userInfo);  
566 - //} 570 + if (isCommingSoonModel == true) {
567 571
568 - sessionStorage.setItem("loginSession", "true");  
569 - localStorage.setItem('isCommingSoonModel', false); 572 + ShowAssignedModulesPopup(result.Modules);
570 573
571 - $rootScope.isVisibleLogin = false;  
572 - } 574 + //if (userInfo.rememberChk) {
573 575
  576 + // $scope.saveRemeberMeDetails(result, userInfo);
  577 + //}
574 578
575 - $location.path('/'); 579 + sessionStorage.setItem("loginSession", "true");
  580 + localStorage.setItem('isCommingSoonModel', false);
576 581
577 - }  
578 - else {  
579 - if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) {  
580 - //0.  
581 - $rootScope.userData = result;  
582 - $rootScope.userModules = result.Modules; 582 + $rootScope.isVisibleLogin = false;
  583 + }
583 584
584 - //1. set haveRoleAdmin = false because LicenseInfo is not null  
585 - $rootScope.haveRoleAdmin = false;  
586 585
587 - //2.  
588 - if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") { 586 + $location.path('/');
589 587
590 - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));  
591 - } 588 + }
  589 + else {
  590 + if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) {
  591 + //0.
  592 + $rootScope.userData = result;
  593 + $rootScope.userModules = result.Modules;
592 594
593 - // 3.ShowAssignedModulesPopup  
594 - //isCommingSoonModel =true only when user comes first time on application and login  
595 - if (isCommingSoonModel == true) { 595 + //1. set haveRoleAdmin = false because LicenseInfo is not null
  596 + $rootScope.haveRoleAdmin = false;
596 597
597 - ShowAssignedModulesPopup(result.Modules);  
598 - } 598 + //2.
  599 + if ($scope.currentUserDetails == null || $scope.currentUserDetails == undefined || $scope.currentUserDetails == "") {
599 600
600 - //4.  
601 - //if ($scope.rememberChk) { 601 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  602 + }
602 603
603 - // $scope.saveRemeberMeDetails(result, userInfo);  
604 - //} 604 + // 3.ShowAssignedModulesPopup
  605 + //isCommingSoonModel =true only when user comes first time on application and login
  606 + if (isCommingSoonModel == true) {
605 607
606 - //5.  
607 - sessionStorage.setItem("loginSession", "true");  
608 - $rootScope.isVisibleLogin = false; 608 + ShowAssignedModulesPopup(result.Modules);
  609 + }
609 610
610 - //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  
611 - localStorage.setItem('isCommingSoonModel', false); 611 + //4.
  612 + //if ($scope.rememberChk) {
612 613
613 - $location.path('/'); 614 + // $scope.saveRemeberMeDetails(result, userInfo);
  615 + //}
614 616
615 - }  
616 - else {  
617 - if ($('#dvTerms').length > 0) {  
618 - $('#dvTerms').html(result.TermsAndConditionsText);  
619 - }  
620 - $rootScope.isVisibleLogin = true;  
621 - $('#dvTermCondition').fadeIn();  
622 - $rootScope.userData = result;  
623 - $rootScope.haveRoleAdmin = false;  
624 - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));  
625 - $location.path('/');  
626 - }  
627 - }  
628 - } 617 + //5.
  618 + sessionStorage.setItem("loginSession", "true");
  619 + $rootScope.isVisibleLogin = false;
629 620
  621 + //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
  622 + localStorage.setItem('isCommingSoonModel', false);
630 623
631 - }  
632 - } 624 + $location.path('/');
633 625
634 - }  
635 -  
636 - },  
637 -  
638 - function (error) { 626 + }
  627 + else {
  628 + if ($('#dvTerms').length > 0) {
  629 + $('#dvTerms').html(result.TermsAndConditionsText);
  630 + }
  631 + $rootScope.isVisibleLogin = true;
  632 + $('#dvTermCondition').fadeIn();
  633 + $rootScope.userData = result;
  634 + $rootScope.haveRoleAdmin = false;
  635 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  636 + $location.path('/');
  637 + }
  638 + }
  639 + }
639 640
640 - console.log(' Error in authentication = ' + error.statusText);  
641 - // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);  
642 - $rootScope.isVisibleLogin = true;  
643 - $rootScope.errorMessage = error;  
644 - $("#messageModal").modal('show');  
645 641
646 - }  
647 - )  
648 - }  
649 - } 642 + }
  643 + }
  644 +
  645 + }
  646 +
  647 + },
  648 +
  649 + function (error) {
  650 +
  651 + console.log(' Error in authentication = ' + error.statusText);
  652 + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
  653 + $rootScope.isVisibleLogin = true;
  654 + $rootScope.errorMessage = error;
  655 + $("#messageModal").modal('show');
  656 +
  657 + }
  658 + )
  659 +
  660 + }
650 //$rootScope.siteUrlInfo.siteIP = siteInfo[0]; 661 //$rootScope.siteUrlInfo.siteIP = siteInfo[0];
651 //$rootScope.siteUrlInfo.remoteIPAddress = siteInfo[1]; 662 //$rootScope.siteUrlInfo.remoteIPAddress = siteInfo[1];
652 //$rootScope.siteUrlInfo.accountNumber = siteInfo[2]; 663 //$rootScope.siteUrlInfo.accountNumber = siteInfo[2];