Commit b3511541df8086fa32a87edf815a46401c4d1acd
1 parent
158a5368
handled cases for login
Showing
9 changed files
with
52 additions
and
21 deletions
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
@@ -7,6 +7,7 @@ using System.Net; | @@ -7,6 +7,7 @@ using System.Net; | ||
7 | using System.Net.Http; | 7 | using System.Net.Http; |
8 | using System.Web.Http; | 8 | using System.Web.Http; |
9 | using log4net; | 9 | using log4net; |
10 | +using AIAHTML5.API.Constants; | ||
10 | 11 | ||
11 | namespace AIAHTML5.API.Controllers | 12 | namespace AIAHTML5.API.Controllers |
12 | { | 13 | { |
@@ -31,10 +32,17 @@ namespace AIAHTML5.API.Controllers | @@ -31,10 +32,17 @@ namespace AIAHTML5.API.Controllers | ||
31 | ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); | 32 | ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); |
32 | logger.Debug("inside POST"); | 33 | logger.Debug("inside POST"); |
33 | 34 | ||
34 | - dynamic userDetails = AIAHTML5.API.Models.Users.AuthenticateUser(credentials); | ||
35 | - | ||
36 | - return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(userDetails)) }; | 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) }; | ||
40 | + } | ||
41 | + else | ||
42 | + { | ||
43 | + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(authenticationRepsonse) }; | ||
37 | 44 | ||
45 | + } | ||
38 | } | 46 | } |
39 | 47 | ||
40 | // PUT api/authenticate/5 | 48 | // PUT api/authenticate/5 |
400-SOURCECODE/AIAHTML5.API/Web.config
@@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
40 | <applicationSettings> | 40 | <applicationSettings> |
41 | <AIAHTML5.API.Properties.Settings> | 41 | <AIAHTML5.API.Properties.Settings> |
42 | <setting name="AIAConnectionString" serializeAs="String"> | 42 | <setting name="AIAConnectionString" serializeAs="String"> |
43 | - <value>localhost:27017</value> | 43 | + <value>192.168.90.157:27017</value> |
44 | </setting> | 44 | </setting> |
45 | <setting name="database" serializeAs="String"> | 45 | <setting name="database" serializeAs="String"> |
46 | <value>AIA</value> | 46 | <value>AIA</value> |
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll
No preview for this file type
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.dll.config
@@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
40 | <applicationSettings> | 40 | <applicationSettings> |
41 | <AIAHTML5.API.Properties.Settings> | 41 | <AIAHTML5.API.Properties.Settings> |
42 | <setting name="AIAConnectionString" serializeAs="String"> | 42 | <setting name="AIAConnectionString" serializeAs="String"> |
43 | - <value>localhost:27017</value> | 43 | + <value>192.168.90.157:27017</value> |
44 | </setting> | 44 | </setting> |
45 | <setting name="database" serializeAs="String"> | 45 | <setting name="database" serializeAs="String"> |
46 | <value>AIA</value> | 46 | <value>AIA</value> |
400-SOURCECODE/AIAHTML5.API/bin/AIAHTML5.API.pdb
No preview for this file type
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | -AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService","AuthenticationService", | ||
4 | -function ($rootScope, Modules, $log, $location, $timeout, DataService,AuthenticationService) { | 3 | +AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService","AuthenticationService","LoginConstants", |
4 | +function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants) { | ||
5 | 5 | ||
6 | //$scope.pageToOpen = { | 6 | //$scope.pageToOpen = { |
7 | // name: 'MainMenu' | 7 | // name: 'MainMenu' |
@@ -86,21 +86,38 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService,Authentica | @@ -86,21 +86,38 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService,Authentica | ||
86 | $rootScope.userModules ; | 86 | $rootScope.userModules ; |
87 | 87 | ||
88 | $rootScope.AuthenticateUser = function (userInfo) { | 88 | $rootScope.AuthenticateUser = function (userInfo) { |
89 | + if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { | ||
89 | 90 | ||
90 | - AuthenticationService.authenticateUser(userInfo) | ||
91 | - .then( | 91 | + alert("Please enter correct information"); |
92 | 92 | ||
93 | - function (result) { | ||
94 | - | ||
95 | - $rootScope.userData = result; | ||
96 | - $rootScope.userModules = result.modules; | ||
97 | - $rootScope.isVisibleLogin = false; | ||
98 | - }, | ||
99 | - function (error) { | ||
100 | - // handle errors here | ||
101 | - console.log(' $rootScope.BodyLayerData= ' + error.statusText); | ||
102 | - }); | ||
103 | - | 93 | + } |
94 | + else { | ||
95 | + | ||
96 | + AuthenticationService.authenticateUser(userInfo) | ||
97 | + .then( | ||
98 | + | ||
99 | + function (result) { | ||
100 | + if (result == LoginConstants.USER_NOT_FOUND) { | ||
101 | + | ||
102 | + alert(result); | ||
103 | + } | ||
104 | + else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { | ||
105 | + alert(result); | ||
106 | + } | ||
107 | + else { | ||
108 | + if (result.loginId != undefined || result.loginId != "" || result.loginId != null) | ||
109 | + | ||
110 | + $rootScope.userData = result; | ||
111 | + $rootScope.userModules = result.modules; | ||
112 | + $rootScope.isVisibleLogin = false; | ||
113 | + } | ||
114 | + }, | ||
115 | + function (error) { | ||
116 | + console.log(' Error in authentication = ' + error.statusText); | ||
117 | + alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); | ||
118 | + }); | ||
119 | + } | ||
120 | + | ||
104 | } | 121 | } |
105 | 122 | ||
106 | 123 |
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
@@ -279,6 +279,12 @@ AIA.constant('MedicalSpecialties', ['Allergy & Immunology', 'Anesthesiology', 'C | @@ -279,6 +279,12 @@ AIA.constant('MedicalSpecialties', ['Allergy & Immunology', 'Anesthesiology', 'C | ||
279 | 279 | ||
280 | AIA.constant('ImageTypes', ['Illustration', 'Cadaver Photograph', 'Radiograph']); | 280 | AIA.constant('ImageTypes', ['Illustration', 'Cadaver Photograph', 'Radiograph']); |
281 | 281 | ||
282 | +//login constant. | ||
283 | +AIA.constant("LoginConstants", { | ||
284 | + "USER_NOT_FOUND": "User not found.", | ||
285 | + "ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.", | ||
286 | + | ||
287 | +}) | ||
282 | 288 | ||
283 | 289 | ||
284 | AIA.config(function ($routeProvider, pages, $locationProvider) { | 290 | AIA.config(function ($routeProvider, pages, $locationProvider) { |
400-SOURCECODE/AIAHTML5.Web/content/images/common/logo-large.png
0 → 100644
16.4 KB
400-SOURCECODE/AIAHTML5.Web/index.html
@@ -160,7 +160,7 @@ | @@ -160,7 +160,7 @@ | ||
160 | <div class="container-fluid loginBg"> | 160 | <div class="container-fluid loginBg"> |
161 | <div class="row"> | 161 | <div class="row"> |
162 | <div class="col-xs-12 text-center"> | 162 | <div class="col-xs-12 text-center"> |
163 | - <a href="index.html" class="loginLogo"><img src="img/logo-large.png" class="img-responsive" alt=""></a> | 163 | + <a href="index.html" class="loginLogo"><img src="content/images/common/logo-large.png" class="img-responsive" alt=""></a> |
164 | <div class="headerBand row"> | 164 | <div class="headerBand row"> |
165 | <div class="col-xs-12"> | 165 | <div class="col-xs-12"> |
166 | <h1>A.D.A.M. Interactive Anatomy</h1> | 166 | <h1>A.D.A.M. Interactive Anatomy</h1> |