Showing
6 changed files
150-DOCUMENTATION/002-DBScripts/ALTER_TABLE_LOGIN_DETAIL.sql
0 → 100644
150-DOCUMENTATION/002-DBScripts/AlterInsertLoginDetail.sql
0 → 100644
1 | +-- ============================================= | ||
2 | +-- Author: <Author,,Name> | ||
3 | +-- Create date: <Create Date,,> | ||
4 | +-- Description: <Description,,> | ||
5 | +-- ============================================= | ||
6 | +ALTER PROCEDURE InsertLoginDetail | ||
7 | + -- Add the parameters for the stored procedure here | ||
8 | + @iUserId INT, | ||
9 | + @CallFromURL NVARCHAR(250) = NULL | ||
10 | +AS | ||
11 | +BEGIN | ||
12 | + -- SET NOCOUNT ON added to prevent extra result sets from | ||
13 | + -- interfering with SELECT statements. | ||
14 | + SET NOCOUNT OFF; | ||
15 | + | ||
16 | + -- Insert statements for procedure here | ||
17 | + INSERT INTO LoginDetail (UserId, LoginTime, CallFrom) VALUES (@iUserId, GETDATE(), @CallFromURL) | ||
18 | +END | ||
0 | \ No newline at end of file | 19 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs
@@ -36,6 +36,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers | @@ -36,6 +36,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers | ||
36 | dynamic authenticationRepsonse; | 36 | dynamic authenticationRepsonse; |
37 | DateTime blockTime; | 37 | DateTime blockTime; |
38 | bool isUserBlocked; | 38 | bool isUserBlocked; |
39 | + string requestURL = credentials["currentURL"].ToString(); | ||
39 | 40 | ||
40 | try | 41 | try |
41 | { | 42 | { |
@@ -64,7 +65,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers | @@ -64,7 +65,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers | ||
64 | logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id); | 65 | logger.Fatal("Unable to delete past wrong login attempts for userId= " + userInfo.Id); |
65 | } | 66 | } |
66 | //05. | 67 | //05. |
67 | - GetModulesBasedOnUserType(userInfo); | 68 | + GetModulesBasedOnUserType(userInfo, requestURL); |
68 | 69 | ||
69 | // authenticationRepsonse = JsonConvert.SerializeObject(userInfo); | 70 | // authenticationRepsonse = JsonConvert.SerializeObject(userInfo); |
70 | } | 71 | } |
@@ -92,7 +93,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers | @@ -92,7 +93,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers | ||
92 | } | 93 | } |
93 | 94 | ||
94 | //05. Now get the module list- for ADMIN (superadmin/ general admin) by default all module loads | 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 | else | 99 | else |
@@ -180,7 +181,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers | @@ -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 | //based on old .net code(AIA flex), we get modules based on licenseId if licenseid>0. | 186 | //based on old .net code(AIA flex), we get modules based on licenseId if licenseid>0. |
186 | //we verified in database that only superadmin has no licenseid so getting all modules for supeadmin | 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,14 +190,14 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers | ||
189 | userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList(); | 190 | userInfo.Modules = AIAHTML5.API.Models.Users.getAllModulesList(); |
190 | 191 | ||
191 | //Insert user login detail | 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 | else | 195 | else |
195 | { | 196 | { |
196 | CheckLicenseStatus(userInfo); | 197 | CheckLicenseStatus(userInfo); |
197 | 198 | ||
198 | if(!userInfo.IsSubscriptionExpired){ | 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,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 | //05.6.1 | 249 | //05.6.1 |
@@ -262,7 +263,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers | @@ -262,7 +263,7 @@ using System.Data.SqlClient;namespace AIAHTML5.API.Controllers | ||
262 | userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); | 263 | userInfo.Modules = AIAHTML5.API.Models.Users.getModuleListByLicenseId(userInfo.LicenseId); |
263 | 264 | ||
264 | //Insert user login detail | 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 | else | 269 | else |
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
@@ -534,9 +534,9 @@ namespace AIAHTML5.API.Models | @@ -534,9 +534,9 @@ namespace AIAHTML5.API.Models | ||
534 | return arrTermsAndConditions; | 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 | int result = 0; | 541 | int result = 0; |
542 | try | 542 | try |
@@ -548,6 +548,7 @@ namespace AIAHTML5.API.Models | @@ -548,6 +548,7 @@ namespace AIAHTML5.API.Models | ||
548 | cmd.CommandText = DBConstants.INSERT_LOGIN_DETAIL; | 548 | cmd.CommandText = DBConstants.INSERT_LOGIN_DETAIL; |
549 | cmd.CommandType = CommandType.StoredProcedure; | 549 | cmd.CommandType = CommandType.StoredProcedure; |
550 | cmd.Parameters.AddWithValue("@iUserId", userId); | 550 | cmd.Parameters.AddWithValue("@iUserId", userId); |
551 | + cmd.Parameters.AddWithValue("@CallFromURL", requestURL); | ||
551 | result = cmd.ExecuteNonQuery(); | 552 | result = cmd.ExecuteNonQuery(); |
552 | } | 553 | } |
553 | catch (SqlException ex) | 554 | catch (SqlException ex) |
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
@@ -134,15 +134,15 @@ namespace AIAHTML5.API.Models | @@ -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 | int result = 0; | 141 | int result = 0; |
142 | 142 | ||
143 | DBModel objModel = new DBModel(); | 143 | DBModel objModel = new DBModel(); |
144 | 144 | ||
145 | - result = objModel.InsertLoginDetails(userId); | 145 | + result = objModel.InsertLoginDetails(userId, requestURL); |
146 | 146 | ||
147 | return result; | 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,7 +84,8 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | ||
84 | confirmPassword: null, | 84 | confirmPassword: null, |
85 | userMessage: null, | 85 | userMessage: null, |
86 | unblockUser: false, | 86 | unblockUser: false, |
87 | - isMailForForgotPassword:false | 87 | + isMailForForgotPassword: false, |
88 | + currentURL: null | ||
88 | }; | 89 | }; |
89 | $rootScope.userLicenseInfo = { | 90 | $rootScope.userLicenseInfo = { |
90 | userLicenseId: 0, | 91 | userLicenseId: 0, |
@@ -145,6 +146,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | @@ -145,6 +146,7 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | ||
145 | $("#messageModal").modal('show'); | 146 | $("#messageModal").modal('show'); |
146 | } | 147 | } |
147 | else { | 148 | else { |
149 | + userInfo.currentURL = document.URL; | ||
148 | 150 | ||
149 | AuthenticationService.authenticateUser(userInfo) | 151 | AuthenticationService.authenticateUser(userInfo) |
150 | .then( | 152 | .then( |