Skip to content

Commit

Permalink
Fix assigning TrnVerificationLevel for new users (#772)
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad authored Dec 5, 2023
1 parent 8420233 commit 85510db
Show file tree
Hide file tree
Showing 4 changed files with 1,048 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ public async Task<User> CreateUserWithTrnLookup(AuthenticationState authenticati
&& !string.IsNullOrEmpty(authenticationState.DqtFirstName)
&& !string.IsNullOrEmpty(authenticationState.DqtLastName);

TrnVerificationLevel? trnVerificationLevel = authenticationState.Trn is null ? null :
authenticationState.TryGetOAuthState(out var oAuthState) && oAuthState.TrnMatchPolicy == TrnMatchPolicy.Strict ? TrnVerificationLevel.Medium :
TrnVerificationLevel.Low;

var user = new User()
{
CompletedTrnLookup = _clock.UtcNow,
Expand All @@ -108,7 +112,7 @@ public async Task<User> CreateUserWithTrnLookup(AuthenticationState authenticati
LastSignedIn = _clock.UtcNow,
RegisteredWithClientId = authenticationState.OAuthState?.ClientId,
TrnLookupStatus = authenticationState.TrnLookupStatus,
TrnVerificationLevel = TrnVerificationLevel.Low,
TrnVerificationLevel = trnVerificationLevel,
NationalInsuranceNumber = authenticationState.NationalInsuranceNumber,
};

Expand Down
Loading

0 comments on commit 85510db

Please sign in to comment.