restored templates
Some checks failed
Dotnet build and test / log-the-inputs (push) Failing after 2s
Dotnet build and test / build (push) Failing after 2s

This commit is contained in:
Paul Schneider
2025-08-25 14:18:26 +01:00
parent 7ac48c3bbf
commit 1f4b3980c7
4 changed files with 62 additions and 24 deletions

View File

@ -28,6 +28,7 @@ using System.Security.Cryptography;
using System.Text.Unicode; using System.Text.Unicode;
using System.Text; using System.Text;
using Yavsc.Server.Helpers; using Yavsc.Server.Helpers;
using System.Reflection;
namespace Yavsc.Controllers namespace Yavsc.Controllers
{ {
@ -45,6 +46,7 @@ namespace Yavsc.Controllers
readonly TwilioSettings _twilioSettings; readonly TwilioSettings _twilioSettings;
readonly IStringLocalizer _localizer; readonly IStringLocalizer _localizer;
private readonly IStringLocalizer _localizer2;
// TwilioSettings _twilioSettings; // TwilioSettings _twilioSettings;
@ -66,7 +68,7 @@ namespace Yavsc.Controllers
ITrueEmailSender emailSender, ITrueEmailSender emailSender,
IOptions<SiteSettings> siteSettings, IOptions<SiteSettings> siteSettings,
ILoggerFactory loggerFactory, IOptions<TwilioSettings> twilioSettings, ILoggerFactory loggerFactory, IOptions<TwilioSettings> twilioSettings,
IStringLocalizer<Yavsc.YavscLocalization> localizer, IStringLocalizerFactory localizerFactory,
ApplicationDbContext dbContext) ApplicationDbContext dbContext)
{ {
_interaction = interaction; _interaction = interaction;
@ -81,8 +83,13 @@ namespace Yavsc.Controllers
_siteSettings = siteSettings.Value; _siteSettings = siteSettings.Value;
_twilioSettings = twilioSettings.Value; _twilioSettings = twilioSettings.Value;
_logger = loggerFactory.CreateLogger<AccountController>(); _logger = loggerFactory.CreateLogger<AccountController>();
_localizer = localizer;
_dbContext = dbContext; _dbContext = dbContext;
var type = typeof(Yavsc.YavscLocalization);
var assemblyName = new AssemblyName(type.GetTypeInfo().Assembly.FullName);
_localizer = localizerFactory.Create(type);
_localizer2 = localizerFactory.Create("SharedResource", assemblyName.Name);
} }

View File

@ -406,33 +406,42 @@ public static class HostingExtensions
var context = serviceScope.ServiceProvider.GetRequiredService<ConfigurationDbContext>(); var context = serviceScope.ServiceProvider.GetRequiredService<ConfigurationDbContext>();
context.Database.Migrate(); try
if (!context.Clients.Any())
{ {
foreach (var client in Config.Clients)
{
context.Clients.Add(client.ToEntity());
}
context.SaveChanges();
}
if (!context.IdentityResources.Any())
{
foreach (var resource in Config.IdentityResources)
{
context.IdentityResources.Add(resource.ToEntity());
}
context.SaveChanges();
}
if (!context.ApiScopes.Any()) context.Database.Migrate();
{
foreach (var resource in Config.ApiScopes) if (!context.Clients.Any())
{ {
context.ApiScopes.Add(resource.ToEntity()); foreach (var client in Config.Clients)
{
context.Clients.Add(client.ToEntity());
}
context.SaveChanges();
} }
context.SaveChanges();
if (!context.IdentityResources.Any())
{
foreach (var resource in Config.IdentityResources)
{
context.IdentityResources.Add(resource.ToEntity());
}
context.SaveChanges();
}
if (!context.ApiScopes.Any())
{
foreach (var resource in Config.ApiScopes)
{
context.ApiScopes.Add(resource.ToEntity());
}
context.SaveChanges();
}
}
catch (InvalidOperationException ex)
{
app.Properties["DegradedDBContext"] = ex.Message;
} }
} }
} }

View File

@ -0,0 +1,10 @@
@{
ViewData["Title"] = "Account creation success";
}
<h1>@ViewData["Title"]</h1>
Your account has successfully been created.
<a asp-action="Index" asp-controller="Home">Return to home</a>

View File

@ -0,0 +1,12 @@
@model Yavsc.Abstract.Manage.EmailSentViewModel
@{
ViewData["Title"] = "S'il vous plait, veuillez confirmer votre adresse e-mail";
}
<h2>@ViewData["Title"].</h2>
<div>
<p>
Un message vient d'être envoyé à l'adresse e-mail ( @Model.EMail , id:@Model.MessageId ).
</p>
</div>