diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index 74bd9d8..cab1cf8 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -7,6 +7,7 @@ using System.Net; using System.Net.Http; using System.Web.Http; using log4net; +using AIAHTML5.API.Constants; namespace AIAHTML5.API.Controllers { @@ -31,10 +32,17 @@ namespace AIAHTML5.API.Controllers ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); logger.Debug("inside POST"); - dynamic userDetails = AIAHTML5.API.Models.Users.AuthenticateUser(credentials); - - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(userDetails)) }; + dynamic authenticationRepsonse = AIAHTML5.API.Models.Users.AuthenticateUser(credentials); + if (Convert.ToString(authenticationRepsonse) != AIAConstants.USER_NOT_FOUND && Convert.ToString(authenticationRepsonse) != AIAConstants.ERROR_IN_FECTHING_DETAILS) + { + string userDetails = Newtonsoft.Json.JsonConvert.SerializeObject(authenticationRepsonse); + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(userDetails) }; + } + else + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) }; + } } // PUT api/authenticate/5 diff --git a/400-SOURCECODE/AIAHTML5.API/Web.config b/400-SOURCECODE/AIAHTML5.API/Web.config index 42fb673..de82813 100644 --- a/400-SOURCECODE/AIAHTML5.API/Web.config +++ b/400-SOURCECODE/AIAHTML5.API/Web.config @@ -40,7 +40,7 @@ - localhost:27017 + 192.168.90.157:27017 AIA diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll index 6656fb1..1981e43 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config index 42fb673..de82813 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config @@ -40,7 +40,7 @@ - localhost:27017 + 192.168.90.157:27017 AIA diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb index df9f8a1..593beaa 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index ae09850..45bdb0b 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -1,7 +1,7 @@ 'use strict'; -AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService","AuthenticationService", -function ($rootScope, Modules, $log, $location, $timeout, DataService,AuthenticationService) { +AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService","AuthenticationService","LoginConstants", +function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants) { //$scope.pageToOpen = { // name: 'MainMenu' @@ -86,21 +86,38 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService,Authentica $rootScope.userModules ; $rootScope.AuthenticateUser = function (userInfo) { + if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { - AuthenticationService.authenticateUser(userInfo) - .then( + alert("Please enter correct information"); - function (result) { - - $rootScope.userData = result; - $rootScope.userModules = result.modules; - $rootScope.isVisibleLogin = false; - }, - function (error) { - // handle errors here - console.log(' $rootScope.BodyLayerData= ' + error.statusText); - }); - + } + else { + + AuthenticationService.authenticateUser(userInfo) + .then( + + function (result) { + if (result == LoginConstants.USER_NOT_FOUND) { + + alert(result); + } + else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { + alert(result); + } + else { + if (result.loginId != undefined || result.loginId != "" || result.loginId != null) + + $rootScope.userData = result; + $rootScope.userModules = result.modules; + $rootScope.isVisibleLogin = false; + } + }, + function (error) { + console.log(' Error in authentication = ' + error.statusText); + alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + }); + } + } diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js index 63ac5df..eb87a6f 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js @@ -279,6 +279,12 @@ AIA.constant('MedicalSpecialties', ['Allergy & Immunology', 'Anesthesiology', 'C AIA.constant('ImageTypes', ['Illustration', 'Cadaver Photograph', 'Radiograph']); +//login constant. +AIA.constant("LoginConstants", { + "USER_NOT_FOUND": "User not found.", + "ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.", + +}) AIA.config(function ($routeProvider, pages, $locationProvider) { diff --git a/400-SOURCECODE/AIAHTML5.Web/content/images/common/logo-large.png b/400-SOURCECODE/AIAHTML5.Web/content/images/common/logo-large.png new file mode 100644 index 0000000..4430baa --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.Web/content/images/common/logo-large.png diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index 9519a82..2ab3271 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -160,7 +160,7 @@ - + A.D.A.M. Interactive Anatomy