Skip to content

Commit 6f4b124

Browse files
committed
TD-6391: Modified the calls to update elfh Hub DB UserTbl records during authentication
1 parent 1eeac28 commit 6f4b124

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

LearningHub.Nhs.UserApi.Services/ElfhUserService.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,21 +231,22 @@ public async Task RecordSuccessfulSigninAsync(int id, CancellationToken token =
231231
{
232232
var user = await this.elfhUserRepository.GetByIdAsync(id);
233233

234-
user.LoginTimes++;
235-
user.PasswordLifeCounter = 0;
236-
user.SecurityLifeCounter = 0;
234+
if (user.PasswordLifeCounter != 0 || user.SecurityLifeCounter != 0)
235+
{
236+
user.PasswordLifeCounter = 0;
237+
user.SecurityLifeCounter = 0;
237238

238-
await this.elfhUserRepository.UpdateAsync(id, user);
239+
await this.elfhUserRepository.UpdateAsync(id, user);
239240

240-
await this.InvalidateElfhUserCacheAsync(user.Id, user.UserName, token);
241+
await this.InvalidateElfhUserCacheAsync(user.Id, user.UserName, token);
242+
}
241243
}
242244

243245
/// <inheritdoc/>
244246
public async Task RecordUnsuccessfulSigninAsync(int id, CancellationToken token = default)
245247
{
246248
var user = await this.elfhUserRepository.GetByIdAsync(id);
247249

248-
user.LoginTimes++;
249250
user.PasswordLifeCounter++;
250251

251252
await this.elfhUserRepository.UpdateAsync(id, user);

0 commit comments

Comments
 (0)