Commit bb0d93c9f1b03a7012ebacb4af25b6f0f82baa31

Authored by Utkarsh Singh
1 parent c982ce6d

Committing updated code to insert URL accessed to login in application

400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
... ... @@ -36,6 +36,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
36 36 dynamic authenticationRepsonse;
37 37 DateTime blockTime;
38 38 bool isUserBlocked;
  39 + string requestURL = credentials["currentURL"].ToString();
39 40  
40 41 try
41 42 {
... ... @@ -64,7 +65,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
64 65 logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id);
65 66 }
66 67 //05.
67   - GetModulesBasedOnUserType(userInfo);
  68 + GetModulesBasedOnUserType(userInfo, requestURL);
68 69  
69 70 // authenticationRepsonse = JsonConvert.SerializeObject(userInfo);
70 71 }
... ... @@ -92,7 +93,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
92 93 }
93 94  
94 95 //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads
95   - GetModulesBasedOnUserType(userInfo);
  96 + GetModulesBasedOnUserType(userInfo, requestURL);
96 97  
97 98 }
98 99 else
... ... @@ -180,7 +181,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
180 181  
181 182 }
182 183  
183   - private static void GetModulesBasedOnUserType(User userInfo)
  184 + private static void GetModulesBasedOnUserType(User userInfo, string requestURL)
184 185 {
185 186 //based on old .net code(AIA flex), we get modules based on licenseId if licenseid>0.
186 187 //we verified in database that only superadmin has no licenseid so getting all modules for supeadmin
... ... @@ -189,14 +190,14 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
189 190 userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList();
190 191  
191 192 //Insert user login detail
192   - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id);
  193 + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id, requestURL);
193 194 }
194 195 else
195 196 {
196 197 CheckLicenseStatus(userInfo);
197 198  
198 199 if(!userInfo.IsSubscriptionExpired){
199   - GetModulesBasedOnLicense(userInfo,false);
  200 + GetModulesBasedOnLicense(userInfo, false, requestURL);
200 201 }
201 202 }
202 203 }
... ... @@ -242,7 +243,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
242 243 }
243 244 }
244 245  
245   - private static void GetModulesBasedOnLicense(User userInfo, bool isLicenseExpired)
  246 + private static void GetModulesBasedOnLicense(User userInfo, bool isLicenseExpired, string requestURL)
246 247 {
247 248  
248 249 //05.6.1
... ... @@ -262,7 +263,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers
262 263 userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId);
263 264  
264 265 //Insert user login detail
265   - AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id);
  266 + AIAHTML5.API.Models.Users.insertLoginDetails(userInfo.Id, requestURL);
266 267 }
267 268 }
268 269 else
... ...
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
... ... @@ -534,9 +534,9 @@ namespace AIAHTML5.API.Models
534 534 return arrTermsAndConditions;
535 535 }
536 536  
537   - internal int InsertLoginDetails(int userId)
  537 + internal int InsertLoginDetails(int userId, string requestURL)
538 538 {
539   - logger.Debug(" inside InsertLoginDetails for UserId= " + userId);
  539 + logger.Debug(" inside InsertLoginDetails for UserId= " + userId + ", URL: " + requestURL);
540 540  
541 541 int result = 0;
542 542 try
... ... @@ -548,6 +548,7 @@ namespace AIAHTML5.API.Models
548 548 cmd.CommandText = DBConstants.INSERT_LOGIN_DETAIL;
549 549 cmd.CommandType = CommandType.StoredProcedure;
550 550 cmd.Parameters.AddWithValue("@iUserId", userId);
  551 + cmd.Parameters.AddWithValue("@CallFromURL", requestURL);
551 552 result = cmd.ExecuteNonQuery();
552 553 }
553 554 catch (SqlException ex)
... ...
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... ... @@ -134,15 +134,15 @@ namespace AIAHTML5.API.Models
134 134  
135 135 }
136 136  
137   - internal static int insertLoginDetails(int userId)
  137 + internal static int insertLoginDetails(int userId, string requestURL)
138 138 {
139   - logger.Debug("inside insertLoginDetails for UserId =" + userId);
  139 + logger.Debug("inside insertLoginDetails for UserId =" + userId + " & URL: " + requestURL);
140 140  
141 141 int result = 0;
142 142  
143 143 DBModel objModel = new DBModel();
144 144  
145   - result = objModel.InsertLoginDetails(userId);
  145 + result = objModel.InsertLoginDetails(userId, requestURL);
146 146  
147 147 return result;
148 148 }
... ...
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -84,7 +84,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
84 84 confirmPassword: null,
85 85 userMessage: null,
86 86 unblockUser: false,
87   - isMailForForgotPassword:false
  87 + isMailForForgotPassword: false,
  88 + currentURL: null
88 89 };
89 90 $rootScope.userLicenseInfo = {
90 91 userLicenseId: 0,
... ... @@ -145,6 +146,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
145 146 $("#messageModal").modal('show');
146 147 }
147 148 else {
  149 + userInfo.currentURL = document.URL;
148 150  
149 151 AuthenticationService.authenticateUser(userInfo)
150 152 .then(
... ...