Commit 952f23fdb45cfbf60169f438dd26c75ad073bccd

Authored by Nikita Kulshreshtha
1 parent f78c1907

For development purpose we have introduced default autentication TRUE.

we set this in web.config and handled in code accordingly.
On Live, we will set it false.
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="true"/>
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",
4   -function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants) {
  3 +AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants","UserModules",
  4 +function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules) {
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("Username or Password is missing.");
102   - $rootScope.isVisibleLogin = true;
  102 +
103 103 }
104 104 else {
105 105  
... ... @@ -107,6 +107,14 @@ 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 = true;
  113 + // $rootScope.userData = result;
  114 + $rootScope.isVisibleLogin = false;
  115 + }
  116 + else
  117 + {
110 118 if (result == LoginConstants.USER_NOT_FOUND) {
111 119 $rootScope.isVisibleLogin = true;
112 120 alert(LoginConstants.USER_NOT_FOUND);
... ... @@ -126,6 +134,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
126 134 localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
127 135 }
128 136 }
  137 + }
129 138 },
130 139 function (error) {
131 140 console.log(' Error in authentication = ' + error.statusText);
... ...
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... ... @@ -287,6 +287,76 @@ AIA.constant(&quot;LoginConstants&quot;, {
287 287  
288 288 })
289 289  
  290 +AIA.constant("UserModules", [
  291 + {
  292 + "name": "Dissectible Anatomy",
  293 + "slug": "da-view-list"
  294 + },
  295 + {
  296 + "name": "Atlas Anatomy",
  297 + "slug": "aa-view-list"
  298 + },
  299 + {
  300 + "name": "3D Anatomy",
  301 + "slug": "3d-anatomy-list"
  302 + },
  303 + {
  304 + "name": "Clinical Illustrations",
  305 + "slug": "clinical-illustrations"
  306 + },
  307 + {
  308 + "name": "Clinical Animations",
  309 + "slug": "clinical-animations"
  310 + },
  311 + {
  312 + "name": "Encyclopedia",
  313 + "slug": "Link/encyclopedia"
  314 + },
  315 + {
  316 + "name": "Curriculum Builder",
  317 + "slug": "curriculum-builder"
  318 + },
  319 + {
  320 + "name": "Anatomy Tests",
  321 + "slug": "anatomy-test"
  322 + },
  323 + {
  324 + "name": "IP 10",
  325 + "slug": "Link/IP-10"
  326 + },
  327 + {
  328 + "name": "Lab Exercises",
  329 + "slug": "lab-exercises"
  330 + },
  331 + {
  332 + "name": "In-Depth Reports",
  333 + "slug": "Link/indepth-reports"
  334 + },
  335 + {
  336 + "name": "Complementary and Alternative Medicine",
  337 + "slug": "Link/complementary-and-alternate-medicine"
  338 + },
  339 + {
  340 + "name": "A.D.A.M Images",
  341 + "slug": "ADAM-images"
  342 + },
  343 + {
  344 + "name": "Body Guide",
  345 + "slug": "Link/bodyguide"
  346 + },
  347 + {
  348 + "name": "Symptom Navigator",
  349 + "slug": "Link/symptom-navigator"
  350 + },
  351 + {
  352 + "name": "The Wellness Tools",
  353 + "slug": "Link/wellness-tools"
  354 + },
  355 + {
  356 + "name": "A.D.A.M OnDemand",
  357 + "slug": "ADAM-on-demand"
  358 + }
  359 +]);
290 360  
291 361 AIA.config(function ($routeProvider, pages, $locationProvider) {
292 362  
... ...