Commit 6c7473be99ed89639dc2ccf80fdca04b2af88ddb

Authored by Amrita Vishnoi
2 parents 1a6a967e 35878cd6

Merge branch 'LoginIssues' into Develop

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", "LoginConstants",  
4 -function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants) { 3 +AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants","LoginMessageConstants",
  4 +function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, LoginMessageConstants) {
5 5
6 //$scope.pageToOpen = { 6 //$scope.pageToOpen = {
7 // name: 'MainMenu' 7 // name: 'MainMenu'
@@ -98,7 +98,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -98,7 +98,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
98 $rootScope.AuthenticateUser = function (userInfo) { 98 $rootScope.AuthenticateUser = function (userInfo) {
99 if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { 99 if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) {
100 100
101 - alert("Username or Password is missing."); 101 + alert(LoginMessageConstants.USER_CREDENTIALS_MISSING);
102 $rootScope.isVisibleLogin = true; 102 $rootScope.isVisibleLogin = true;
103 } 103 }
104 else { 104 else {
@@ -190,10 +190,10 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -190,10 +190,10 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
190 alert(LoginConstants.USER_NOT_FOUND); 190 alert(LoginConstants.USER_NOT_FOUND);
191 } 191 }
192 else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { 192 else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) {
193 - alert("An error occured."); 193 + alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
194 } 194 }
195 else if (result == LoginConstants.MAIL_NOT_SENT) { 195 else if (result == LoginConstants.MAIL_NOT_SENT) {
196 - alert("Due to some issue, email not sent."); 196 + alert(LoginMessageConstants.MAIL_NOT_SENT);
197 } 197 }
198 else { 198 else {
199 if (result.loginId != undefined || result.loginId != "" || result.loginId != null) { 199 if (result.loginId != undefined || result.loginId != "" || result.loginId != null) {
@@ -207,9 +207,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -207,9 +207,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
207 $('.forgot-sm1').modal('hide'); 207 $('.forgot-sm1').modal('hide');
208 } 208 }
209 if (isMailForPassword) 209 if (isMailForPassword)
210 - message = "Please check you email and reset your password."; 210 + message = LoginMessageConstants.RESET_PASSWORD;
211 else 211 else
212 - message = "Please check you email, sent UserId in your email."; 212 + message = LoginMessageConstants.USERID_SENT_IN_EMAIL
213 alert(message); 213 alert(message);
214 214
215 215
@@ -223,11 +223,11 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -223,11 +223,11 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
223 }); 223 });
224 } 224 }
225 else { 225 else {
226 - alert("Please enter correct email id"); 226 + alert(LoginMessageConstants.INCORRECT_EMAIL_ID);
227 } 227 }
228 } 228 }
229 else { 229 else {
230 - alert("Please enter your email id"); 230 + alert(LoginMessageConstants.BLANK_EMAIL_ID);
231 } 231 }
232 }; 232 };
233 233
@@ -259,14 +259,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -259,14 +259,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
259 .then( 259 .then(
260 function (result) { 260 function (result) {
261 if (result == LoginConstants.USER_NOT_FOUND) { 261 if (result == LoginConstants.USER_NOT_FOUND) {
262 - alert(LoginConstants.USER_NOT_FOUND); 262 + alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);
263 } 263 }
264 else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) { 264 else if (result == LoginConstants.ERROR_IN_FECTHING_DETAILS) {
265 - alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); 265 + alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
266 } 266 }
267 else { 267 else {
268 if ((result.IsAcknowledged == true) && (result.IsModifiedCountAvailable == true)) { 268 if ((result.IsAcknowledged == true) && (result.IsModifiedCountAvailable == true)) {
269 - alert('Your password has been reset.'); 269 + alert(LoginMessageConstants.PASSWORD_RESET_MESSAGE);
270 $rootScope.isVisibleLogin = true; 270 $rootScope.isVisibleLogin = true;
271 $rootScope.isVisibleResetPass = false; 271 $rootScope.isVisibleResetPass = false;
272 $location.url("/") ; 272 $location.url("/") ;
@@ -275,11 +275,11 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -275,11 +275,11 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
275 }, 275 },
276 function (error) { 276 function (error) {
277 console.log(' Error in authentication = ' + error.statusText); 277 console.log(' Error in authentication = ' + error.statusText);
278 - alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); 278 + alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
279 }); 279 });
280 } 280 }
281 else { 281 else {
282 - $rootScope.errorMesaage = "Your new password and confirm password not matched!"; 282 + $rootScope.errorMesaage = LoginMessageConstants.NEW_AND_OLD_PASSWORD_DONOT_MATCH;
283 } 283 }
284 } 284 }
285 285
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
@@ -281,12 +281,25 @@ AIA.constant('ImageTypes', ['Illustration', 'Cadaver Photograph', 'Radiograph']) @@ -281,12 +281,25 @@ AIA.constant('ImageTypes', ['Illustration', 'Cadaver Photograph', 'Radiograph'])
281 281
282 //login constant. 282 //login constant.
283 AIA.constant("LoginConstants", { 283 AIA.constant("LoginConstants", {
284 - "USER_NOT_FOUND": "UserId or Password is incorrect.", 284 + "USER_NOT_FOUND": "User not found.",
285 "ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.", 285 "ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.",
286 - "MAIL_NOT_SENT": "We are facing some issue in sending email. Please try after sometime." 286 + "MAIL_NOT_SENT": "Mail not sent."
287 287
288 }) 288 })
289 289
  290 +AIA.constant("LoginMessageConstants", {
  291 + "USER_OR_PASSWORD_INCORRECT": "UserId or Password is incorrect.",
  292 + "RESET_PASSWORD": "Please check you email and reset your password.",
  293 + "USERID_SENT_IN_EMAIL": "Please check you email, sent UserId in your email.",
  294 + "ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.",
  295 + "MAIL_NOT_SENT": "We are facing some issue in sending email. Please try after sometime.",
  296 + "INCORRECT_EMAIL_ID": "Please enter correct email id",
  297 + "BLANK_EMAIL_ID": "Please enter your email id",
  298 + "PASSWORD_RESET_MESSAGE": "Your password has been reset.",
  299 + "NEW_AND_OLD_PASSWORD_DONOT_MATCH": "Your new password and confirm password not matched!",
  300 + "USER_CREDENTIALS_MISSING":"Please Enter your credentials"
  301 +
  302 +})
290 303
291 AIA.config(function ($routeProvider, pages, $locationProvider) { 304 AIA.config(function ($routeProvider, pages, $locationProvider) {
292 305