File tree Expand file tree Collapse file tree 3 files changed +51
-1
lines changed
DigitalLearningSolutions.Data/DataServices
DigitalLearningSolutions.Web Expand file tree Collapse file tree 3 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 66 public interface ILoginDataService
77 {
88 void UpdateLastAccessedForUsersTable ( int Id ) ;
9+
10+ void UpdateLastAccessedForDelegatesAccountsTable ( int Id ) ;
11+
12+ void UpdateLastAccessedForAdminAccountsTable ( int Id ) ;
913 }
1014
1115 public class LoginDataService : ILoginDataService
@@ -29,5 +33,31 @@ public void UpdateLastAccessedForUsersTable(int Id)
2933 }
3034 ) ;
3135 }
36+
37+ public void UpdateLastAccessedForDelegatesAccountsTable ( int Id )
38+ {
39+ connection . Execute (
40+ @"UPDATE DelegateAccounts SET
41+ LastAccessed = GetUtcDate()
42+ WHERE ID = @Id" ,
43+ new
44+ {
45+ Id
46+ }
47+ ) ;
48+ }
49+
50+ public void UpdateLastAccessedForAdminAccountsTable ( int Id )
51+ {
52+ connection . Execute (
53+ @"UPDATE AdminAccounts SET
54+ LastAccessed = GetUtcDate()
55+ WHERE ID = @Id" ,
56+ new
57+ {
58+ Id
59+ }
60+ ) ;
61+ }
3262 }
3363}
Original file line number Diff line number Diff line change @@ -226,11 +226,17 @@ int centreIdToLogInto
226226 IsPersistent = rememberMe ,
227227 IssuedUtc = clockUtility . UtcNow ,
228228 } ;
229+ var centreAccountSet = userEntity ? . GetCentreAccountSet ( centreIdToLogInto ) ;
229230
230- var adminAccount = userEntity ! . GetCentreAccountSet ( centreIdToLogInto ) ? . AdminAccount ;
231+ if ( centreAccountSet ? . DelegateAccount ? . Id != null )
232+ {
233+ loginService . UpdateLastAccessedForDelegatesAccountsTable ( centreAccountSet . DelegateAccount . Id ) ;
234+ }
231235
236+ var adminAccount = centreAccountSet ? . AdminAccount ;
232237 if ( adminAccount ? . Active == true )
233238 {
239+ loginService . UpdateLastAccessedForAdminAccountsTable ( adminAccount . Id ) ;
234240 sessionService . StartAdminSession ( adminAccount . Id ) ;
235241 }
236242
Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ List<int> idsOfCentresWithUnverifiedEmails
3232
3333 void UpdateLastAccessedForUsersTable ( int Id ) ;
3434
35+ void UpdateLastAccessedForDelegatesAccountsTable ( int Id ) ;
36+
37+ void UpdateLastAccessedForAdminAccountsTable ( int Id ) ;
38+
3539 Task < string > HandleLoginResult (
3640 LoginResult loginResult ,
3741 TicketReceivedContext context ,
@@ -59,6 +63,16 @@ public void UpdateLastAccessedForUsersTable(int Id)
5963 loginDataService . UpdateLastAccessedForUsersTable ( Id ) ;
6064 }
6165
66+ public void UpdateLastAccessedForDelegatesAccountsTable ( int Id )
67+ {
68+ loginDataService . UpdateLastAccessedForDelegatesAccountsTable ( Id ) ;
69+ }
70+
71+ public void UpdateLastAccessedForAdminAccountsTable ( int Id )
72+ {
73+ loginDataService . UpdateLastAccessedForAdminAccountsTable ( Id ) ;
74+ }
75+
6276 public LoginResult AttemptLogin ( string username , string password )
6377 {
6478 var userEntity = userService . GetUserByUsername ( username ) ;
You can’t perform that action at this time.
0 commit comments