Commit 56f6bcaa6985064b5d45f1e79bc4e2e97aec6bfb

Authored by Nikita Kulshreshtha
1 parent b7068939

added more code

400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs
... ... @@ -46,6 +46,8 @@ namespace AIAHTML5.API.Constants
46 46 public const string SAVED_LAB_EXERCISE_NOT_FOUND = "Saved Lab Exercise not found.";
47 47 public const string VALIDATED_CLIENT = "Valid Client.";
48 48 public const string INVALID_CLIENT = "InValid Client.";
  49 + public const string MSG_NOT_AUTHORIZE_SITE_USER = "User is not authorized.";
  50 +
49 51  
50 52 public const string STATUS_OK = "ok";
51 53 public const string STATUS_NOT_OK = "notok";
... ...
400-SOURCECODE/AIAHTML5.API/Controllers/ClientController.cs
... ... @@ -36,7 +36,20 @@ namespace AIAHTML5.API.Controllers
36 36 if (uerinfo != null)
37 37 response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(uerinfo) };
38 38 else
  39 + {
  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 +
39 45 response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.INVALID_CLIENT) };
  46 + }
  47 + }
  48 + else
  49 + {
  50 + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.MSG_NOT_AUTHORIZE_SITE_USER) };
  51 +
  52 +
40 53 }
41 54 return response;
42 55 }
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -99,7 +99,10 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
99 99 status: null,
100 100 accountNumber: null,
101 101 edition: null,
102   - urlReferer:null
  102 + urlReferer: null,
  103 + calsCreds: null,
  104 + userId: null,
  105 + password:null
103 106 }
104 107 $rootScope.userData;
105 108 $rootScope.userModules;
... ... @@ -398,23 +401,78 @@ function ($rootScope, $scope, Modules, $log, $location, $timeout, DataService, A
398 401  
399 402  
400 403 $scope.ValidateClientSiteUrl = function () {
401   - // urlParams = strIPAddress + "&" + strAccountNumber + "&" + strEdition + "&" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : "");
402 404  
403   - var siteInfo = urlParams.split('&');
404   - $rootScope.siteUrlInfo.siteIP = siteInfo[0];
405   - $rootScope.siteUrlInfo.remoteIPAddress = siteInfo[1];
406   - $rootScope.siteUrlInfo.accountNumber = siteInfo[2];
407   - $rootScope.siteUrlInfo.edition = siteInfo[3];
408   - $rootScope.siteUrlInfo.urlReferer = siteInfo[4];
  405 + var siteInfo = params.split('&');
409 406  
410   - AuthenticationService.validateClientSite($rootScope.siteUrlInfo)
411   - .then(
  407 + for (var i = 0; i < siteInfo.length; i++)
  408 + {
  409 + if (isCalsCredantial) {
  410 + var paramInfo = siteInfo[i].split('=');
  411 + if (paramInfo[0] == 'calsCredantial') {
  412 +
  413 + $rootScope.siteUrlInfo.calsCreds = paramInfo[1];
  414 + }
  415 + else if (paramInfo[0] == 'username') {
  416 +
  417 + $rootScope.siteUrlInfo.username = paramInfo[1];
  418 + }
  419 + else if (paramInfo[0] == 'password') {
  420 +
  421 + $rootScope.siteUrlInfo.password = paramInfo[1];
  422 + }
  423 +
  424 + $rootScope.userInfo.username = $rootScope.siteUrlInfo.username;
  425 + $rootScope.userInfo.password = $rootScope.siteUrlInfo.password;
  426 +
  427 + $rootScope.AuthenticateUser($rootScope.userInfo);
  428 +
  429 + }
  430 + else{
  431 + var paramInfo = siteInfo[i].split('=');
  432 + if (paramInfo[0] == 'siteIP') {
  433 +
  434 + $rootScope.siteUrlInfo.siteIP = paramInfo[1];
  435 + }
  436 + else if (paramInfo[0] == 'accountNumber') {
  437 +
  438 + $rootScope.siteUrlInfo.accountNumber = paramInfo[1];
  439 + }
  440 + else if (paramInfo[0] == 'edition') {
  441 +
  442 + $rootScope.siteUrlInfo.siteIP = paramInfo[1];
  443 + }
  444 + else if (paramInfo[0] == 'urlReferer') {
  445 +
  446 + $rootScope.siteUrlInfo.siteIP = paramInfo[1];
  447 + }
  448 + else if (paramInfo[0] == 'remoteIPAddress') {
  449 +
  450 + $rootScope.siteUrlInfo.remoteIPAddress = paramInfo[1];
  451 + }
  452 +
  453 + AuthenticationService.validateClientSite($rootScope.siteUrlInfo)
  454 + .then(
  455 +
  456 + function (result) {
  457 + console.log(result);
  458 + if (result == LoginConstants.USER_NOT_FOUND) {
  459 + $rootScope.isVisibleLogin = true;
  460 + // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);
  461 + $rootScope.errorMessage = LoginMessageConstants.INVALID_USER;
  462 + $("#messageModal").modal('show');
  463 + }
  464 + },
  465 + function (error) { }
  466 + )
  467 + }
  468 + }
  469 + //$rootScope.siteUrlInfo.siteIP = siteInfo[0];
  470 + //$rootScope.siteUrlInfo.remoteIPAddress = siteInfo[1];
  471 + //$rootScope.siteUrlInfo.accountNumber = siteInfo[2];
  472 + //$rootScope.siteUrlInfo.edition = siteInfo[3];
  473 + //$rootScope.siteUrlInfo.urlReferer = siteInfo[4];
412 474  
413   - function (result) {
414 475  
415   - },
416   - function (error) { }
417   - )
418 476 }
419 477  
420 478  
... ...
400-SOURCECODE/AIAHTML5.Web/index.aspx
... ... @@ -165,7 +165,7 @@
165 165  
166 166 <script>
167 167 var params = "<%=urlParams%>"; alert(params);
168   - var isCalsCredantialForSIte ="<%=isCalsCredantial%>";
  168 + var isCalsCredantialForSIte ="<%=isCalsCredantial%>";
169 169 </script>
170 170  
171 171 </head>
... ...
400-SOURCECODE/AIAHTML5.Web/index.aspx.cs
... ... @@ -18,6 +18,7 @@ namespace ADAM.AIA
18 18 public string urlParams = "?";
19 19 public string test = "";
20 20 public bool isCalsCredantial = false;
  21 +
21 22 protected void Page_Load(object sender, EventArgs e)
22 23 {
23 24 urlParams = "XYZ";
... ... @@ -28,9 +29,9 @@ namespace ADAM.AIA
28 29 {
29 30 isCalsCredantial = true;
30 31  
31   - //urlParams = "?calsCredantial=" + Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString();
  32 + urlParams = "calsCredantial=" + Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString();
32 33 //calsCredantialusername&password
33   - urlParams = Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString();
  34 + // urlParams = Request.Form["calsCredantial"].ToString() + "&username=" + Request.Form["calsUsername"].ToString() + "&password=" + Request.Form["calsPassword"].ToString();
34 35  
35 36 }
36 37 }
... ... @@ -99,11 +100,11 @@ namespace ADAM.AIA
99 100  
100 101 }
101 102 //urlParams = "?siteIP=" + strIPAddress + "&status=" + intSiteId + "&accountNumber=" + strAccountNumber + "&edition=" + strEdition + "&urlReferer=" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : "");
102   - //urlParams = "siteIP=" + strIPAddress + "&accountNumber=" + strAccountNumber + "&edition=" + strEdition + "&urlReferer=" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : "");
  103 + urlParams = "siteIP=" + strIPAddress + "&accountNumber=" + strAccountNumber + "&edition=" + strEdition + "&urlReferer=" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : "") + "&remoteIPAddress=" + remoteIPAddress;
103 104  
104 105 //For the ease of splitting desgined urlParms in the pattern of
105 106 //urlParams = siteIP&accountNumber&remoteIPAddress&edition&urlReferer; without mentioning the variableName
106   - urlParams = strIPAddress + "&" + remoteIPAddress+"&"+ strAccountNumber + "&" + strEdition + "&" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : "");
  107 + // urlParams = strIPAddress + "&" + remoteIPAddress+"&"+ strAccountNumber + "&" + strEdition + "&" + (strSiteReferer != "" && strSiteReferer != null ? strSiteReferer : "");
107 108  
108 109  
109 110 }
... ...