diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index cab1cf8..dea6361 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -31,17 +31,26 @@ namespace AIAHTML5.API.Controllers { ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); logger.Debug("inside POST"); - - 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) }; + + bool isUserAuthenticatedByDefault = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["isUserAuthenticated"]); + if (isUserAuthenticatedByDefault) { + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent("true") }; + } else { - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) }; + 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) }; + + } } } diff --git a/400-SOURCECODE/AIAHTML5.API/Web.config b/400-SOURCECODE/AIAHTML5.API/Web.config index d8ba05f..6cc6c46 100644 --- a/400-SOURCECODE/AIAHTML5.API/Web.config +++ b/400-SOURCECODE/AIAHTML5.API/Web.config @@ -39,6 +39,7 @@ + diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll index 523099c..9f00f1c 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 d8ba05f..f592e55 100644 --- a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config +++ b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config @@ -39,6 +39,7 @@ + diff --git a/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb b/400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb index 1d24d40..6729410 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 011ffcb..1f725f7 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", "LoginConstants","LoginMessageConstants", -function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, LoginMessageConstants) { +AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants","UserModules","LoginMessageConstants", +function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants) { //$scope.pageToOpen = { // name: 'MainMenu' @@ -70,7 +70,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.shapestyleFillBorderColor = "black"; $rootScope.shapestyleborderWidth = 2; $rootScope.shapestyleborderStyles = "solid"; - + $rootScope.errorMassage = ''; $rootScope.userInfo = { username: null, @@ -98,8 +98,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.AuthenticateUser = function (userInfo) { if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { - alert(LoginMessageConstants.USER_CREDENTIALS_MISSING); - $rootScope.isVisibleLogin = true; + // alert(LoginMessageConstants.USER_CREDENTIALS_MISSING); + $rootScope.errorMassage = LoginMessageConstants.USER_CREDENTIALS_MISSING; + $("#messageModal").modal('show'); } else { @@ -107,14 +108,24 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic .then( function (result) { + if (result == 'true') { + $rootScope.userModules = UserModules; + $rootScope.isVisibleLogin = false; + } + else + { if (result == LoginConstants.USER_NOT_FOUND) { $rootScope.isVisibleLogin = true; - alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); + // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); + $rootScope.errorMassage = LoginMessageConstants.USER_OR_PASSWORD_INCORRECT; + $("#messageModal").modal('show'); } else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { - alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + //alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); $rootScope.isVisibleLogin = true; + $rootScope.errorMassage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS; + $("#messageModal").modal('show'); } else { if (result.loginId != undefined || result.loginId != "" || result.loginId != null) { @@ -126,11 +137,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic localStorage.setItem('loggedInUserDetails', JSON.stringify(result)); } } + } }, function (error) { console.log(' Error in authentication = ' + error.statusText); - alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); $rootScope.isVisibleLogin = true; + $rootScope.errorMassage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS; + $("#messageModal").modal('show'); }); } @@ -187,13 +201,19 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic AuthenticationService.SendMailToUser(userInfo) .then(function (result) { if (result == LoginConstants.USER_NOT_FOUND) { - alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); + // alert(LoginMessageConstants.INCORRECT_EMAIL_ID); + $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID; + $("#messageModal").modal('show'); } else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { - alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.errorMassage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS; + $("#messageModal").modal('show'); } else if (result == LoginConstants.MAIL_NOT_SENT) { - alert(LoginMessageConstants.MAIL_NOT_SENT); + // alert(LoginMessageConstants.MAIL_NOT_SENT); + $rootScope.errorMassage = LoginMessageConstants.MAIL_NOT_SENT; + $("#messageModal").modal('show'); } else { if (result.loginId != undefined || result.loginId != "" || result.loginId != null) { @@ -210,8 +230,10 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic message = LoginMessageConstants.RESET_PASSWORD; else message = LoginMessageConstants.USERID_SENT_IN_EMAIL - alert(message); - + //alert(message); + $rootScope.errorMassage = message; + $("#messageModal").modal('show'); + } } @@ -219,15 +241,22 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic }, function (error) { console.log(' Error in authentication = ' + error.statusText); - alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + // alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.errorMassage = LoginConstants.ERROR_IN_FECTHING_DETAILS; + $("#messageModal").modal('show'); }); } else { - alert(LoginMessageConstants.INCORRECT_EMAIL_ID); + // alert(LoginMessageConstants.INCORRECT_EMAIL_ID); + $rootScope.errorMassage = LoginMessageConstants.INCORRECT_EMAIL_ID; + $("#messageModal").modal('show'); } } else { - alert(LoginMessageConstants.BLANK_EMAIL_ID); + //alert(LoginMessageConstants.BLANK_EMAIL_ID); + $rootScope.errorMassage = LoginMessageConstants.BLANK_EMAIL_ID; + $("#messageModal").modal('show'); + } }; @@ -259,14 +288,22 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic .then( function (result) { if (result == LoginConstants.USER_NOT_FOUND) { - alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); + // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT); + $rootScope.errorMassage = LoginMessageConstants.USER_OR_PASSWORD_INCORRECT; + $("#messageModal").modal('show'); + } else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { - alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.errorMassage = LoginConstants.ERROR_IN_FECTHING_DETAILS; + $("#messageModal").modal('show'); + } else { if ((result.IsAcknowledged == true) && (result.IsModifiedCountAvailable == true)) { - alert(LoginMessageConstants.PASSWORD_RESET_MESSAGE); + // alert(LoginMessageConstants.PASSWORD_RESET_MESSAGE); + $rootScope.errorMassage = LoginMessageConstants.PASSWORD_RESET_MESSAGE; + $("#messageModal").modal('show'); $rootScope.isVisibleLogin = true; $rootScope.isVisibleResetPass = false; $location.url("/") ; @@ -275,11 +312,15 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic }, function (error) { console.log(' Error in authentication = ' + error.statusText); - alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); + $rootScope.errorMassage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS; + $("#messageModal").modal('show'); + }); } else { $rootScope.errorMesaage = LoginMessageConstants.NEW_AND_OLD_PASSWORD_DONOT_MATCH; + $("#messageModal").modal('show'); } } diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js index 467be8a..496a699 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js @@ -293,13 +293,86 @@ AIA.constant("LoginMessageConstants", { "USERID_SENT_IN_EMAIL": "Please check you email, sent UserId in your email.", "ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.", "MAIL_NOT_SENT": "We are facing some issue in sending email. Please try after sometime.", - "INCORRECT_EMAIL_ID": "Please enter correct email id", - "BLANK_EMAIL_ID": "Please enter your email id", + "INCORRECT_EMAIL_ID": "Please enter correct email id.", + "BLANK_EMAIL_ID": "Please enter your email id.", "PASSWORD_RESET_MESSAGE": "Your password has been reset.", "NEW_AND_OLD_PASSWORD_DONOT_MATCH": "Your new password and confirm password not matched!", - "USER_CREDENTIALS_MISSING":"Please Enter your credentials" + "USER_CREDENTIALS_MISSING": "Please Enter your credentials.", + "USER_NOT_FOUND": "User not found.", + //"ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.", + //"MAIL_NOT_SENT": "Mail not sent." }) +AIA.constant("UserModules", [ + { + "name": "Dissectible Anatomy", + "slug": "da-view-list" + }, + { + "name": "Atlas Anatomy", + "slug": "aa-view-list" + }, + { + "name": "3D Anatomy", + "slug": "3d-anatomy-list" + }, + { + "name": "Clinical Illustrations", + "slug": "clinical-illustrations" + }, + { + "name": "Clinical Animations", + "slug": "clinical-animations" + }, + { + "name": "Encyclopedia", + "slug": "Link/encyclopedia" + }, + { + "name": "Curriculum Builder", + "slug": "curriculum-builder" + }, + { + "name": "Anatomy Tests", + "slug": "anatomy-test" + }, + { + "name": "IP 10", + "slug": "Link/IP-10" + }, + { + "name": "Lab Exercises", + "slug": "lab-exercises" + }, + { + "name": "In-Depth Reports", + "slug": "Link/indepth-reports" + }, + { + "name": "Complementary and Alternative Medicine", + "slug": "Link/complementary-and-alternate-medicine" + }, + { + "name": "A.D.A.M Images", + "slug": "ADAM-images" + }, + { + "name": "Body Guide", + "slug": "Link/bodyguide" + }, + { + "name": "Symptom Navigator", + "slug": "Link/symptom-navigator" + }, + { + "name": "The Wellness Tools", + "slug": "Link/wellness-tools" + }, + { + "name": "A.D.A.M OnDemand", + "slug": "ADAM-on-demand" + } +]); AIA.config(function ($routeProvider, pages, $locationProvider) { diff --git a/400-SOURCECODE/AIAHTML5.Web/index.html b/400-SOURCECODE/AIAHTML5.Web/index.html index 5f4b719..891151c 100644 --- a/400-SOURCECODE/AIAHTML5.Web/index.html +++ b/400-SOURCECODE/AIAHTML5.Web/index.html @@ -1144,129 +1144,20 @@ - +