Commit 725f1d75e9af88896b593928434371cd20f41d95

Authored by Nikita Kulshreshtha
2 parents 9281c1cf 952f23fd

switched off authentiaction for development merge

400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... ... @@ -31,17 +31,26 @@ namespace AIAHTML5.API.Controllers
31 31 {
32 32 ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType));
33 33 logger.Debug("inside POST");
34   -
35   - dynamic authenticationRepsonse = AIAHTML5.API.Models.Users.AuthenticateUser(credentials);
36   - if (Convert.ToString(authenticationRepsonse) != AIAConstants.USER_NOT_FOUND && Convert.ToString(authenticationRepsonse) != AIAConstants.ERROR_IN_FECTHING_DETAILS)
37   - {
38   - string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(authenticationRepsonse);
39   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userDetails) };
  34 +
  35 + bool isUserAuthenticatedByDefault = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["isUserAuthenticated"]);
  36 + if (isUserAuthenticatedByDefault) {
  37 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("true") };
  38 +
40 39 }
41 40 else
42 41 {
43   - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) };
44 42  
  43 + dynamic authenticationRepsonse = AIAHTML5.API.Models.Users.AuthenticateUser(credentials);
  44 + if (Convert.ToString(authenticationRepsonse) != AIAConstants.USER_NOT_FOUND && Convert.ToString(authenticationRepsonse) != AIAConstants.ERROR_IN_FECTHING_DETAILS)
  45 + {
  46 + string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(authenticationRepsonse);
  47 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userDetails) };
  48 + }
  49 + else
  50 + {
  51 + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) };
  52 +
  53 + }
45 54 }
46 55 }
47 56  
... ...
400-SOURCECODE/AIAHTML5.API/Web.config
... ... @@ -39,6 +39,7 @@
39 39 <add key="EnableSSL" value="false" />
40 40 <add key="Site_Url" value ="//52.2.38.120"/>
41 41 <add key ="HostAddress" value="10.100.12.13" />
  42 + <add key="isUserAuthenticated" value="false"/>
42 43 </appSettings>
43 44 <system.web>
44 45 <compilation debug="true" targetFramework="4.5" />
... ...
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
No preview for this file type
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config
... ... @@ -39,6 +39,7 @@
39 39 <add key="EnableSSL" value="false" />
40 40 <add key="Site_Url" value ="//52.2.38.120"/>
41 41 <add key ="HostAddress" value="10.100.12.13" />
  42 + <add key="isUserAuthenticated" value="true"/>
42 43 </appSettings>
43 44 <system.web>
44 45 <compilation debug="true" targetFramework="4.5" />
... ...
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
1 1 'use strict';
2 2  
3   -AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants","LoginMessageConstants",
4   -function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, LoginMessageConstants) {
  3 +AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants","UserModules","LoginMessageConstants",
  4 +function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants) {
5 5  
6 6 //$scope.pageToOpen = {
7 7 // name: 'MainMenu'
... ... @@ -99,7 +99,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
99 99 if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) {
100 100  
101 101 alert(LoginMessageConstants.USER_CREDENTIALS_MISSING);
102   - $rootScope.isVisibleLogin = true;
  102 +
103 103 }
104 104 else {
105 105  
... ... @@ -107,6 +107,12 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
107 107 .then(
108 108  
109 109 function (result) {
  110 + if (result == 'true') {
  111 + $rootScope.userModules = UserModules;
  112 + $rootScope.isVisibleLogin = false;
  113 + }
  114 + else
  115 + {
110 116 if (result == LoginConstants.USER_NOT_FOUND) {
111 117 $rootScope.isVisibleLogin = true;
112 118 alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);
... ... @@ -126,6 +132,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
126 132 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
127 133 }
128 134 }
  135 + }
129 136 },
130 137 function (error) {
131 138 console.log(' Error in authentication = ' + error.statusText);
... ...
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... ... @@ -300,6 +300,76 @@ AIA.constant(&quot;LoginMessageConstants&quot;, {
300 300 "USER_CREDENTIALS_MISSING":"Please Enter your credentials"
301 301  
302 302 })
  303 +AIA.constant("UserModules", [
  304 + {
  305 + "name": "Dissectible Anatomy",
  306 + "slug": "da-view-list"
  307 + },
  308 + {
  309 + "name": "Atlas Anatomy",
  310 + "slug": "aa-view-list"
  311 + },
  312 + {
  313 + "name": "3D Anatomy",
  314 + "slug": "3d-anatomy-list"
  315 + },
  316 + {
  317 + "name": "Clinical Illustrations",
  318 + "slug": "clinical-illustrations"
  319 + },
  320 + {
  321 + "name": "Clinical Animations",
  322 + "slug": "clinical-animations"
  323 + },
  324 + {
  325 + "name": "Encyclopedia",
  326 + "slug": "Link/encyclopedia"
  327 + },
  328 + {
  329 + "name": "Curriculum Builder",
  330 + "slug": "curriculum-builder"
  331 + },
  332 + {
  333 + "name": "Anatomy Tests",
  334 + "slug": "anatomy-test"
  335 + },
  336 + {
  337 + "name": "IP 10",
  338 + "slug": "Link/IP-10"
  339 + },
  340 + {
  341 + "name": "Lab Exercises",
  342 + "slug": "lab-exercises"
  343 + },
  344 + {
  345 + "name": "In-Depth Reports",
  346 + "slug": "Link/indepth-reports"
  347 + },
  348 + {
  349 + "name": "Complementary and Alternative Medicine",
  350 + "slug": "Link/complementary-and-alternate-medicine"
  351 + },
  352 + {
  353 + "name": "A.D.A.M Images",
  354 + "slug": "ADAM-images"
  355 + },
  356 + {
  357 + "name": "Body Guide",
  358 + "slug": "Link/bodyguide"
  359 + },
  360 + {
  361 + "name": "Symptom Navigator",
  362 + "slug": "Link/symptom-navigator"
  363 + },
  364 + {
  365 + "name": "The Wellness Tools",
  366 + "slug": "Link/wellness-tools"
  367 + },
  368 + {
  369 + "name": "A.D.A.M OnDemand",
  370 + "slug": "ADAM-on-demand"
  371 + }
  372 +]);
303 373  
304 374 AIA.config(function ($routeProvider, pages, $locationProvider) {
305 375  
... ...