Skip to content

Commit

Permalink
Merge branch 'main' into empty_media_request
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamco authored Sep 19, 2024
2 parents e9018ca + f9fb26a commit 1a1b001
Show file tree
Hide file tree
Showing 73 changed files with 2,085 additions and 1,495 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -3195,6 +3195,15 @@
"contributions": [
"code"
]
},
{
"login": "XopcT",
"name": "Vladimir Verbitsky",
"avatar_url": "https://avatars.githubusercontent.com/u/8039133?v=4",
"profile": "https://github.com/XopcT",
"contributions": [
"code"
]
}
],
"skipCi": true,
Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore.Cms.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
// "Username": "",
// "Password": ""
//},
//"OrchardCore_Email_Azure": {
//"OrchardCore_Email_AzureCommunicationServices": {
// "DefaultSender": "",
// "ConnectionString": ""
//}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public async Task<AuditTrailEventQueryResult> QueryAsync(int page, int pageSize,
}
}

var localNow = await _localClock.LocalNowAsync;
var localNow = await _localClock.GetLocalNowAsync();
var startOfWeek = CultureInfo.CurrentUICulture.DateTimeFormat.FirstDayOfWeek;

options.AuditTrailDates =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public override async Task<IDisplayResult> EditAsync(ISite site, AzureEmailSetti
model.IsEnabled = settings.IsEnabled;
model.DefaultSender = settings.DefaultSender;
model.HasConnectionString = !string.IsNullOrWhiteSpace(settings.ConnectionString);
}).Location("Content:5#Azure")
}).Location("Content:5#Azure Communication Services")
.OnGroup(SettingsGroupId);
}

Expand Down
6 changes: 3 additions & 3 deletions src/OrchardCore.Modules/OrchardCore.Email.Azure/Manifest.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using OrchardCore.Modules.Manifest;

[assembly: Module(
Name = "Azure Email Provider",
Name = "Azure Communication Services Email",
Author = ManifestConstants.OrchardCoreTeam,
Website = ManifestConstants.OrchardCoreWebsite,
Version = ManifestConstants.OrchardCoreVersion,
Description = "Provides an email service provider leveraging Azure Communication Services (ACS).",
Description = "Provides email service providers leveraging Azure Communication Services (ACS).",
Dependencies =
[
"OrchardCore.Email"
"OrchardCore.Email",
],
Category = "Messaging"
)]
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ public AzureEmailProvider(
{
}

public override LocalizedString DisplayName => S["Azure Communication Service"];
public override LocalizedString DisplayName
=> S["Azure Communication Services"];
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public abstract class AzureEmailProviderBase : IEmailProvider
private readonly IEmailAddressValidator _emailAddressValidator;
private readonly ILogger _logger;

private EmailClient _emailClient;

protected readonly IStringLocalizer S;

public AzureEmailProviderBase(
Expand Down Expand Up @@ -132,8 +134,9 @@ public virtual async Task<EmailResult> SendAsync(MailMessage message)

try
{
var client = new EmailClient(_providerOptions.ConnectionString);
var emailResult = await client.SendAsync(WaitUntil.Completed, emailMessage);
_emailClient ??= new EmailClient(_providerOptions.ConnectionString);

var emailResult = await _emailClient.SendAsync(WaitUntil.Completed, emailMessage);

if (emailResult.HasValue)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ public DefaultAzureEmailProvider(
{
}

public override LocalizedString DisplayName => S["Default Azure Communication Service"];
public override LocalizedString DisplayName
=> S["Default Azure Communication Services"];
}
3 changes: 3 additions & 0 deletions src/OrchardCore.Modules/OrchardCore.Email.Azure/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public void ConfigureServices(IServiceCollection services)

services.Configure<DefaultAzureEmailOptions>(options =>
{
_shellConfiguration.GetSection("OrchardCore_Email_AzureCommunicationServices").Bind(options);
// The 'OrchardCore_Email_Azure' key can be removed in version 3.
_shellConfiguration.GetSection("OrchardCore_Email_Azure").Bind(options);
options.IsEnabled = options.ConfigurationExists();
Expand Down
3 changes: 2 additions & 1 deletion src/OrchardCore.Modules/OrchardCore.Facebook/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
Description = "Authenticates users from Meta.",
Dependencies =
[
FacebookConstants.Features.Core
FacebookConstants.Features.Core,
"OrchardCore.Users.ExternalAuthentication",
]
)]

Expand Down
6 changes: 5 additions & 1 deletion src/OrchardCore.Modules/OrchardCore.GitHub/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@
Id = GitHubConstants.Features.GitHubAuthentication,
Name = "GitHub Authentication",
Category = "GitHub",
Description = "Authenticates users with their GitHub Account."
Description = "Authenticates users with their GitHub Account.",
Dependencies =
[
"OrchardCore.Users.ExternalAuthentication",
]
)]
6 changes: 5 additions & 1 deletion src/OrchardCore.Modules/OrchardCore.Google/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
Id = GoogleConstants.Features.GoogleAuthentication,
Name = "Google Authentication",
Category = "Google",
Description = "Authenticates users with their Google Account."
Description = "Authenticates users with their Google Account.",
Dependencies =
[
"OrchardCore.Users.ExternalAuthentication",
]
)]

[assembly: Feature(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async ValueTask<FluidValue> ProcessAsync(FluidValue input, FilterArgument

if (stringValue == "now" || stringValue == "today")
{
value = await _localClock.LocalNowAsync;
value = await _localClock.GetLocalNowAsync();
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async ValueTask<FluidValue> ProcessAsync(FluidValue input, FilterArgument

if (stringValue == "now" || stringValue == "today")
{
value = await _localClock.LocalNowAsync;
value = await _localClock.GetLocalNowAsync();
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@
Id = MicrosoftAuthenticationConstants.Features.MicrosoftAccount,
Name = "Microsoft Account Authentication",
Category = "Microsoft Authentication",
Description = "Authenticates users with their Microsoft Account."
Description = "Authenticates users with their Microsoft Account.",
Dependencies =
[
"OrchardCore.Users.ExternalAuthentication",
]
)]

[assembly: Feature(
Id = MicrosoftAuthenticationConstants.Features.AAD,
Name = "Microsoft Entra ID (Azure Active Directory) Authentication",
Category = "Microsoft Authentication",
Description = "Authenticates users with their Microsoft Entra ID Account."
Description = "Authenticates users with their Microsoft Entra ID Account.",
Dependencies =
[
"OrchardCore.Users.ExternalAuthentication",
]
)]
1 change: 1 addition & 0 deletions src/OrchardCore.Modules/OrchardCore.OpenId/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Dependencies =
[
OpenIdConstants.Features.Core,
"OrchardCore.Users.ExternalAuthentication",
]
)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public override IDisplayResult Edit(ISite site, AzureSmsSettings settings, Build
model.IsEnabled = settings.IsEnabled;
model.PhoneNumber = settings.PhoneNumber;
model.HasConnectionString = !string.IsNullOrEmpty(settings.ConnectionString);
}).Location("Content:5#Azure Communication")
}).Location("Content:5#Azure Communication Services")
.RenderWhen(() => _authorizationService.AuthorizeAsync(_httpContextAccessor.HttpContext?.User, SmsPermissions.ManageSmsSettings))
.OnGroup(SettingsGroupId);
}
Expand Down
2 changes: 1 addition & 1 deletion src/OrchardCore.Modules/OrchardCore.Sms.Azure/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
)]

[assembly: Feature(
Name = "Azure Communication SMS",
Name = "Azure Communication Services SMS",
Id = "OrchardCore.Sms.Azure",
Description = "Enables the ability to send SMS messages through Azure Communication Services (ACS).",
Dependencies =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ public AzureSmsProvider(
}

public override LocalizedString Name
=> S["Azure Communication"];
=> S["Azure Communication Services"];
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ public DefaultAzureSmsProvider(
}

public override LocalizedString Name
=> S["Default Azure Communication"];
=> S["Default Azure Communication Services"];
}
6 changes: 5 additions & 1 deletion src/OrchardCore.Modules/OrchardCore.Twitter/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@
Name = "Sign in with X (Twitter)",
Category = "X (Twitter)",
Description = "Authenticates users with their X (Twitter) Account.",
Dependencies = [TwitterConstants.Features.Twitter]
Dependencies =
[
TwitterConstants.Features.Twitter,
"OrchardCore.Users.ExternalAuthentication",
]
)]
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using OrchardCore.Users.Models;
using OrchardCore.Workflows.Services;

Expand Down Expand Up @@ -36,4 +37,24 @@ protected IActionResult RedirectToLocal(string returnUrl)

return Redirect("~/");
}

protected void CopyTempDataErrorsToModelState()
{
foreach (var errorMessage in TempData.Where(x => x.Key.StartsWith("error")).Select(x => x.Value.ToString()))
{
ModelState.AddModelError(string.Empty, errorMessage);
}
}

protected bool AddUserEnabledError(IUser user, IStringLocalizer S)
{
if (user is not User localUser || !localUser.IsEnabled)
{
ModelState.AddModelError(string.Empty, S["The specified user is not allowed to sign in."]);

return true;
}

return false;
}
}
Loading

0 comments on commit 1a1b001

Please sign in to comment.