From 801042e3d3a7c46b8be08c1224e6899741deb520 Mon Sep 17 00:00:00 2001 From: Utkarsh Singh Date: Wed, 6 Sep 2017 15:24:40 +0530 Subject: [PATCH] committing code files related to unblock user functionality implementation --- 400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs | 2 +- 400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs | 12 ++++++------ 400-SOURCECODE/AIAHTML5.API/Models/Users.cs | 7 +++---- 400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js | 8 +++++--- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs index 24ede3d..c3b537a 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/ResetPasswordController.cs @@ -42,7 +42,7 @@ namespace AIAHTML5.API.Controllers int result = 0; if (!String.IsNullOrEmpty(userInfo["newPassword"].ToString())) { - result = AIAHTML5.API.Models.Users.UpdatePassword(userInfo); + result = AIAHTML5.API.Models.Users.UpdatePassword(userInfo, userData.LoginId, userData.EmailId); if (result > 0) response = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.PASSWORD_UPDATE_SUCCESS) }; else diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index 234b351..ed6822b 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -54,7 +54,7 @@ namespace AIAHTML5.API.Models } catch (SqlException ex) { - logger.Fatal("Exception in GetSQLData for command text =" + commandText + ", Exception= " + ex.Message + ", STACKTRACE= "+ ex.StackTrace); + logger.Fatal("Exception in GetSQLData for command text =" + commandText + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); } return ds; } @@ -556,7 +556,7 @@ namespace AIAHTML5.API.Models return objUser; } - public static int UpdateUserPassword(dynamic userInfo) + public static int UpdateUserPassword(dynamic userInfo, string loginId, string emailId) { int result = 0; conn = new SqlConnection(dbConnectionString); @@ -565,8 +565,8 @@ namespace AIAHTML5.API.Models conn.Open(); cmd.CommandText = "UpdateUserPassword"; cmd.CommandType = CommandType.StoredProcedure; - cmd.Parameters.AddWithValue("@sLoginId", userInfo["loginId"].ToString()); - cmd.Parameters.AddWithValue("@sEmailId", userInfo["emailId"].ToString()); + cmd.Parameters.AddWithValue("@sLoginId", loginId); + cmd.Parameters.AddWithValue("@sEmailId", emailId); cmd.Parameters.AddWithValue("@sNewPassword", userInfo["newPassword"].ToString()); result = cmd.ExecuteNonQuery(); conn.Close(); @@ -850,7 +850,7 @@ namespace AIAHTML5.API.Models } catch (SqlException ex) { - logger.Fatal("Exception in InsertIncorrectLoginAttempts for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= "+ ex.StackTrace); + logger.Fatal("Exception in InsertIncorrectLoginAttempts for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); } return result; } @@ -936,7 +936,7 @@ namespace AIAHTML5.API.Models catch (SqlException ex) { conn.Close(); - logger.Fatal("Exception in DeleteIncorrectLoginAttempts for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= "+ ex.StackTrace); + logger.Fatal("Exception in DeleteIncorrectLoginAttempts for UserId= " + userId + ", Exception= " + ex.Message + ", STACKTRACE= " + ex.StackTrace); } return result; } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index 7f60c7b..d907086 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -63,7 +63,6 @@ namespace AIAHTML5.API.Models logger.Fatal("Exception in AuthenticateUser for loginId =" + credentials["username"].ToString() + " and password= " + credentials["password"].ToString() + "Exception= " + e.Message + ", STACKTRACE: " + e.StackTrace); string errorMessage = AIAConstants.ERROR_IN_FECTHING_DETAILS; - string error = "Message: " + e.Message + ", STACKTRACE: " + e.StackTrace; userDetails = errorMessage; } return userDetails; @@ -131,7 +130,7 @@ namespace AIAHTML5.API.Models } - internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo) + internal static dynamic UpdatePassword(Newtonsoft.Json.Linq.JObject userInfo, string sLoginId, string sEmailId) { ILog logger = log4net.LogManager.GetLogger((System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)); //var client = new MongoClient(); @@ -144,7 +143,7 @@ namespace AIAHTML5.API.Models //var result = collection.UpdateOne(filter, update); - int result = DBModel.UpdateUserPassword(userInfo); + int result = DBModel.UpdateUserPassword(userInfo, sLoginId, sEmailId); if (result > 0) return result; @@ -158,7 +157,7 @@ namespace AIAHTML5.API.Models } } - internal static dynamic UpdateLicenseTerm(string accNumber) + internal static dynamic UpdateLicenseTerm(string accNumber) { int result = DBModel.UpdateLicenseTermStatus(accNumber); diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index e681eb1..72e262a 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -511,7 +511,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic } else { $rootScope.errorMessage = LoginMessageConstants.USER_ALREADY_UNBLOCKED; - $("#messageModal").modal('show'); + //$("#messageModal").modal('show'); //$('#messageModal.btn-primary').click(function () { // document.location = '/'; //}); @@ -3749,11 +3749,13 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic }); } $rootScope.getLocalStorageValue = function (localStorageParam) { + + if ((localStorage.getItem('loggedInUserDetails') == null) && ($rootScope.isVisibleLogin == false)) { - - $rootScope.LogoutUser(); + if ($location.url().indexOf('?') == -1) + $rootScope.LogoutUser(); } -- libgit2 0.21.4