From 10b2f6289d8f78c19ac61f0f75182a39a21a203f Mon Sep 17 00:00:00 2001 From: nikita Date: Fri, 29 Sep 2017 14:50:38 +0530 Subject: [PATCH] updated code --- 400-SOURCECODE/.vs/config/applicationhost.config | 4 ++-- 400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs | 7 ++++--- 400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs | 4 ++-- 400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs | 4 ++-- 400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs | 4 ++-- 400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs | 4 ++-- 400-SOURCECODE/AIAHTML5.API/Controllers/UnblockUserController.cs | 4 ++-- 400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs | 5 +++-- 400-SOURCECODE/AIAHTML5.API/Models/Users.cs | 4 ++-- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 46 +++++++++++----------------------------------- 400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js | 4 ++-- 400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js | 24 ++++++++++++++++++++++-- 12 files changed, 56 insertions(+), 58 deletions(-) diff --git a/400-SOURCECODE/.vs/config/applicationhost.config b/400-SOURCECODE/.vs/config/applicationhost.config index 6e2b323..f3d199c 100644 --- a/400-SOURCECODE/.vs/config/applicationhost.config +++ b/400-SOURCECODE/.vs/config/applicationhost.config @@ -162,7 +162,7 @@ - + @@ -170,7 +170,7 @@ - + diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs index cb89a0d..ae8779e 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs @@ -11,9 +11,10 @@ namespace AIAHTML5.API.Constants public const string USER_NOT_FOUND = "User not found."; public const string MAIL_NOT_SENT = "Mail not sent."; public const string MAIL_SENT = "Mail sent."; - public const string EXCEPTION_IN_AIAHTML5 = "We are facing some issue. Please try to login after sometime."; - public const string EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT = "Exception Occured in AIAHTML5"; - public const string SQL_CONNECTION_ERROR = "We are unable to connect with database. Kindly, contact customer support"; + public const string EXCEPTION_OCCURED = "We are facing some issue. Please try to login after sometime."; + public const string EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT = "Exception Occuredin AIAHTML5."; + public const string SQL_CONNECTION_ERROR = "We are unable to connect with database. Please contact customer support."; + public const string SQL_CONNECTION_ERROR_MAIL_SUBJECT = "SQL Connection error in AIAHTML5."; public const string KEY_ID = "id"; public const string KEY_TITLE = "title"; public const string KEY_NAME = "name"; diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index b02d514..10d65b9 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -158,7 +158,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers logger.Fatal("SqlException occured for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); ArrayList supportMailList = UserUtility.GetSupportMailList(); - string mailSubject = AIAConstants.SQL_CONNECTION_ERROR; + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT; string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); @@ -174,7 +174,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(credentials, supportMailList, "", mailSubject, mailBody); - return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) }; + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; } diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs index e9c0a80..d8a456f 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ForgotUserController.cs @@ -82,7 +82,7 @@ namespace AIAHTML5.API.Controllers logger.Fatal("SqlException occured for emailId =" + userInfo["emailId"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); ArrayList supportMailList = UserUtility.GetSupportMailList(); - string mailSubject = AIAConstants.SQL_CONNECTION_ERROR; + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT; string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody); @@ -96,7 +96,7 @@ namespace AIAHTML5.API.Controllers string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT; string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody); - return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) }; + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; } } diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs index dc1b038..809c870 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/LicenseTermConditionController.cs @@ -65,7 +65,7 @@ namespace AIAHTML5.API.Controllers logger.Fatal("SqlException occured for licenseeAccountNumber =" + userLicenseInfo["licenseeAccountNumber"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); ArrayList supportMailList = UserUtility.GetSupportMailList(); - string mailSubject = AIAConstants.SQL_CONNECTION_ERROR; + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT; string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(userLicenseInfo, supportMailList, "", mailSubject, mailBody); @@ -79,7 +79,7 @@ namespace AIAHTML5.API.Controllers string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT; string mailBody = "MESSAGE: " + ex.Message + ", STACKTRACE: " + ex.StackTrace; UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody); - response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) }; + response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; return response; } diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs index 36004e3..84d86c2 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs @@ -66,7 +66,7 @@ namespace AIAHTML5.API.Controllers logger.Fatal("SqlException occured for loginId =" + userInfo["emailId"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); ArrayList supportMailList = UserUtility.GetSupportMailList(); - string mailSubject = AIAConstants.SQL_CONNECTION_ERROR; + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT; string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody); @@ -80,7 +80,7 @@ namespace AIAHTML5.API.Controllers string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT; string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody); - response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) }; + response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; return response; } diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/UnblockUserController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/UnblockUserController.cs index 2fb3659..0129a50 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/UnblockUserController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/UnblockUserController.cs @@ -62,7 +62,7 @@ namespace AIAHTML5.API.Controllers logger.Fatal("SqlException occured for emailId =" + emailId + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); ArrayList supportMailList = UserUtility.GetSupportMailList(); - string mailSubject = AIAConstants.SQL_CONNECTION_ERROR; + string mailSubject = AIAConstants.SQL_CONNECTION_ERROR_MAIL_SUBJECT; string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody); @@ -77,7 +77,7 @@ namespace AIAHTML5.API.Controllers string mailSubject = AIAConstants.EXCEPTION_IN_AIAHTML5_MAIL_SUBJECT; string mailBody = "MESSAGE: " + e.Message + ", STACKTRACE: " + e.StackTrace; UserUtility.SendEmail(userInfo, supportMailList, "", mailSubject, mailBody); - response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_IN_AIAHTML5) }; + response = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.EXCEPTION_OCCURED) }; return response; } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index b60fa43..2ef57e3 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -198,7 +198,7 @@ namespace AIAHTML5.API.Models adapter.Fill(ds); - if (ds.Tables.Count > 0) + if (ds!=null && ds.Tables.Count > 0) { DataTable dt = ds.Tables[0]; @@ -749,7 +749,7 @@ namespace AIAHTML5.API.Models { logger.Debug(" inside GetUserBlockedStatusByUserId for UserId= " + userId); - BlockedUser blockedUser = new BlockedUser(); + BlockedUser blockedUser = null; DataTable dt = null; conn = new SqlConnection(dbConnectionString); @@ -765,6 +765,7 @@ namespace AIAHTML5.API.Models if (dt!= null && dt.Rows.Count > 0) { + blockedUser = new BlockedUser(); foreach (DataRow dr in dt.Rows) { blockedUser.Id = Convert.ToInt32(dr["Id"]); diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index fc5ed6c..2cae71c 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -199,7 +199,7 @@ namespace AIAHTML5.API.Models DBModel objModel = new DBModel(); - + result = objModel.DeleteIncorrectLoginAttempts(userId); return result; } @@ -211,7 +211,7 @@ namespace AIAHTML5.API.Models DBModel objModel = new DBModel(); - + incorrectLoginAttemptCount = objModel.GetIncorrectLoginAttempts(userId); return incorrectLoginAttemptCount; } diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index f227a0f..81f9b51 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -134,6 +134,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } $rootScope.AuthenticateUser = function (userInfo) { + $rootScope.errorMessage = ""; if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { // alert(LoginMessageConstants.USER_CREDENTIALS_MISSING); @@ -152,17 +153,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.errorMessage = LoginMessageConstants.INVALID_USER; $("#messageModal").modal('show'); } - else if (result == LoginConstants.EXCEPTION_IN_AIAHTML5) { - //alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); - $rootScope.isVisibleLogin = true; - $rootScope.errorMessage = LoginMessageConstants.EXCEPTION_IN_AIAHTML5; - $("#messageModal").modal('show'); - } - else if (result == LoginConstants.SQL_CONNECTION_ERROR) { - $rootScope.isVisibleLogin = true; - $rootScope.errorMessage = LoginConstants.SQL_CONNECTION_ERROR; - $("#messageModal").modal('show'); - } else { if (typeof result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) { @@ -222,7 +212,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } else if (result.LicenseInfo != null && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) { $rootScope.isVisibleLogin = true; - $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; + $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE; $("#messageModal").modal('show'); } else { @@ -271,7 +261,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic console.log(' Error in authentication = ' + error.statusText); // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); $rootScope.isVisibleLogin = true; - $rootScope.errorMessage = LoginMessageConstants.ERROR_IN_FECTHING_DETAILS; + $rootScope.errorMessage = LoginConstant.EXCEPTION_OCCURED; $("#messageModal").modal('show'); } } @@ -311,19 +301,14 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $("#messageModal").css("z-index", 111112); localStorage.removeItem("loggedInUserDetails"); } - else if (result == LoginConstants.SQL_CONNECTION_ERROR) { - console.log(result); - $rootScope.isVisibleLogin = true; - $('#dvTermCondition').fadeIn(); - $rootScope.errorMessage = LoginConstants.SQL_CONNECTION_ERROR_MESSAGE; - $("#messageModal").modal('show'); - $("#messageModal").css("z-index", 111112); - localStorage.removeItem("loggedInUserDetails"); - } + }, function (error) { console.log(' Error in Term and Condition acceptance status update = ' + error);//.statusText $rootScope.isVisibleLogin = true; + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = LoginConstant.EXCEPTION_OCCURED; + $("#messageModal").modal('show'); $('#dvTermCondition').fadeIn(); }); } @@ -404,16 +389,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $rootScope.errorMessage = LoginMessageConstants.INCORRECT_EMAIL_ID; $("#messageModal").modal('show'); } - else if (result == LoginConstants.EXCEPTION_IN_AIAHTML5) { - // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); - $rootScope.errorMessage = LoginMessageConstants.EXCEPTION_IN_AIAHTML5; - $("#messageModal").modal('show'); - } - else if (result == LoginConstants.SQL_CONNECTION_ERROR) { - $rootScope.errorMessage = LoginConstants.SQL_CONNECTION_ERROR; - $("#messageModal").modal('show'); - } - else if (result == LoginConstants.MAIL_NOT_SENT) { + else if (result == LoginConstants.MAIL_NOT_SENT) { // alert(LoginMessageConstants.MAIL_NOT_SENT); $rootScope.errorMessage = LoginMessageConstants.MAIL_NOT_SENT; $("#messageModal").modal('show'); @@ -449,7 +425,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic function (error) { console.log(' Error in authentication = ' + error.statusText); // alert(LoginConstants.ERROR_IN_FECTHING_DETAILS); - $rootScope.errorMessage = LoginConstants.EXCEPTION_IN_AIAHTML5; + $rootScope.errorMessage = LoginConstants.EXCEPTION_OCCURED; $("#messageModal").modal('show'); }); } @@ -497,7 +473,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic $("#messageModal").modal('show'); } - else if (result == LoginConstants.EXCEPTION_IN_AIAHTML5) { + else if (result == LoginConstants.EXCEPTION_OCCURED) { // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS); $rootScope.errorMessage = LoginConstants.ERROR_IN_FECTHING_DETAILS; $("#messageModal").modal('show'); @@ -573,7 +549,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic }, function (error) { console.log(' Error in authentication = ' + error.statusText); - $rootScope.errorMessage = LoginMessageConstants.EXCEPTION_IN_AIAHTML5; + $rootScope.errorMessage = LoginMessageConstants.EXCEPTION_OCCURED; $("#messageModal").modal('show'); } ); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js index 8408e89..db98d31 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js @@ -306,8 +306,8 @@ AIA.constant("LoginConstants", { "ERROR_IN_FECTHING_DETAILS": "Error in fecthing details.", "MAIL_NOT_SENT": "Mail not sent.", "MAIL_SENT": "Mail sent.", - "SQL_CONNECTION_ERROR ": "We are unable to connect with database. Please contact customer support", - "EXCEPTION_IN_AIAHTML5": "We are facing some issue. Please try to login after sometime.", + "SQL_CONNECTION_ERROR": "We are unable to connect with database. Please contact customer support", + "EXCEPTION_OCCURED": "We are facing some issue. Please try to login after sometime.", "E_NO_ERROR": "0", "E_USER_NOT_EXIST": "1", "E_PASSWORD_NOT_MATCH": "2", diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js index 9ba8f23..21530dd 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -1,4 +1,4 @@ -AIA.factory('AuthenticationService', function ($http, $q) { +AIA.factory('AuthenticationService', function ($http, $q, $rootScope, LoginConstants) { return { authenticateUser: function (userInfo) { var deferred = $q.defer(); @@ -13,7 +13,11 @@ deferred.resolve(data); }).error(function (data, status, headers, config) { console.log('error') - deferred.reject(status); + deferred.reject(data); + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = data; + $("#messageModal").modal('show'); + }); return deferred.promise; }, @@ -32,6 +36,10 @@ }).error(function (data, status, headers, config) { console.log('error') deferred.reject(status); + + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = data; + $("#messageModal").modal('show'); }); return deferred.promise; }, @@ -50,6 +58,10 @@ }).error(function (data, status, headers, config) { console.log('error') deferred.reject(status); + + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = data; + $("#messageModal").modal('show'); }); return deferred.promise; }, @@ -68,6 +80,10 @@ }).error(function (data, status, headers, config) { console.log('error') deferred.reject(status); + + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = data; + $("#messageModal").modal('show'); }); return deferred.promise; }, @@ -86,6 +102,10 @@ }).error(function (data, status, headers, config) { console.log('error') deferred.reject(status); + + $rootScope.isVisibleLogin = true; + $rootScope.errorMessage = data; + $("#messageModal").modal('show'); }); return deferred.promise; } -- libgit2 0.21.4