Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
confirmationToken = UrlEncoder.Default.Encode(confirmationToken);
String uri = $"{this.ServiceOptions.PublicOrigin}/Account/EmailConfirmation/Confirm?userName={newIdentityUser.UserName}&confirmationToken={confirmationToken}";

TokenResponse token = await this.GetToken(cancellationToken);
TokenResponse token = await this.GetToken();
SendEmailRequest emailRequest = this.BuildEmailConfirmationRequest(newIdentityUser, uri);
sendEmailResult = await this.MessagingServiceClient.SendEmail(token.AccessToken, emailRequest, cancellationToken);
if (sendEmailResult.IsFailed)
Expand Down Expand Up @@ -368,7 +368,7 @@
resetToken = UrlEncoder.Default.Encode(resetToken);
String uri = $"{this.ServiceOptions.PublicOrigin}/Account/ForgotPassword/Confirm?userName={user.UserName}&resetToken={resetToken}&clientId={command.ClientId}";

TokenResponse token = await this.GetToken(cancellationToken);
TokenResponse token = await this.GetToken();
SendEmailRequest emailRequest = this.BuildPasswordResetEmailRequest(user, uri);

Result result = await this.MessagingServiceClient.SendEmail(token.AccessToken, emailRequest, cancellationToken);
Expand All @@ -387,7 +387,7 @@
await this.UserManager.AddPasswordAsync(i, generatedPasswordResult.Data);

// Send Email
TokenResponse token = await this.GetToken(cancellationToken);
TokenResponse token = await this.GetToken();
SendEmailRequest emailRequest = this.BuildWelcomeEmail(i.Email, generatedPasswordResult.Data);
Result result = await this.MessagingServiceClient.SendEmail(token.AccessToken, emailRequest, cancellationToken);
if (result.IsFailed)
Expand Down Expand Up @@ -497,7 +497,7 @@
return roles.ToList();
}

private async Task<TokenResponse> GetToken(CancellationToken cancellationToken){
private async Task<TokenResponse> GetToken(){
// Get a token to talk to the estate service
String clientId = this.ServiceOptions.ClientId;
String clientSecret = this.ServiceOptions.ClientSecret;
Expand Down Expand Up @@ -527,7 +527,7 @@

public static class PasswordGenerator
{
public static Result<string> GenerateRandomPassword(PasswordOptions? opts = null)

Check warning on line 530 in SecurityService.BusinessLogic/RequestHandlers/UserRequestHandler.cs

View workflow job for this annotation

GitHub Actions / Build and Unit Test Pull Requests - Firefox UI

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 530 in SecurityService.BusinessLogic/RequestHandlers/UserRequestHandler.cs

View workflow job for this annotation

GitHub Actions / Build and Unit Test Pull Requests - Non UI

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
{
opts ??= DefaultOptions();

Expand Down
6 changes: 4 additions & 2 deletions SecurityService.UnitTests/ModelFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ public void ModelFactory_ConvertFrom_ListUserDetails_ListIsEmpty_NullReturned()

List<DataTransferObjects.Responses.UserDetails> userDetailsDtoList = modelFactory.ConvertFrom(userDetailsModelList);

userDetailsDtoList.ShouldBeNull();
userDetailsDtoList.ShouldNotBeNull();
userDetailsDtoList.ShouldBeEmpty();
}

[Fact]
Expand All @@ -435,7 +436,8 @@ public void ModelFactory_ConvertFrom_ListUserDetails_ListIsNull_NullReturned()

List<DataTransferObjects.Responses.UserDetails> userDetailsDtoList = modelFactory.ConvertFrom(userDetailsModelList);

userDetailsDtoList.ShouldBeNull();
userDetailsDtoList.ShouldNotBeNull();
userDetailsDtoList.ShouldBeEmpty();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ public class AccessDeniedModel : PageModel
{
public void OnGet()
{
// No special processing required
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public async Task<IActionResult> OnPost()
else
{
// user might have clicked on a malicious link - should be logged
throw new Exception("invalid return URL");
throw new ArgumentException("invalid return URL");
}
}

Expand Down
2 changes: 1 addition & 1 deletion SecurityService/Factories/ModelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public List<UserDetails> ConvertFrom(List<Models.UserDetails> model)
{
if (model == null || model.Any() == false)
{
return null;
return new List<UserDetails>();
}

List<UserDetails> userDetailsList = new List<UserDetails>();
Expand Down
Loading