refactoring the Register

This commit is contained in:
Paul Schneider 2026-02-22 23:39:56 +00:00
commit f1dd648970
43 changed files with 4610 additions and 86 deletions

View file

@ -5,8 +5,9 @@
<Nullable>enable</Nullable>
<Description> A shared model for a little client/server app, dealing about establishing some contract, between some human client and provider.
</Description>
<RootNamespace>Yavsc.Abstract</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>
</Project>
</Project>

View file

@ -11,7 +11,7 @@ namespace Yavsc.ViewModels.Account
[StringLength(Constants.MaxUserNameLength)]
[RegularExpression(Constants.UserNameRegExp)]
[DataType(DataType.Text)]
[Display(Name = "UserName", Description = "User name")]
[Display(Name = "UserName", Description = "User name")]
public string UserName { get; set; }
[Required()]

View file

@ -3,7 +3,7 @@ namespace Yavsc.Interfaces
public interface IComment<TReceiverId>
{
string Content { get; set; }
string Article { get; set; }
TReceiverId ReceiverId { get; set; }
}
}

View file

@ -5,5 +5,5 @@ public class CommentPost : IComment<long>
{
public long ReceiverId { get; set; }
public long? ParentId { get; set; }
public string Content { get; set; }
public string Article { get; set; }
}

View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<!--
route name for the api controller used to tag the 'BlogPost' entity
-->
<data name="UserName"><value>Nom d'utilisateur</value></data>
</root>

View file

@ -4,9 +4,10 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>1c73094f-959f-4211-b1a1-6a69b236c283</UserSecretsId>
<RootNamespace>Yavsc.Api</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<ProjectReference Include="../Server/Server.csproj" />
</ItemGroup>
</Project>
</Project>

View file

@ -65,7 +65,7 @@ namespace Yavsc.Controllers
string uid = User.GetUserId();
Comment c = new Comment{
ReceiverId = post.ReceiverId,
Content = post.Content,
Article = post.Article,
ParentId = post.ParentId,
AuthorId = uid,
UserModified = uid

3
src/Org/AssemblyInfo.cs Normal file
View file

@ -0,0 +1,3 @@
using Microsoft.Extensions.Localization;
[assembly: RootNamespace("Yavsc")]

View file

@ -23,7 +23,8 @@ using IdentityServer8.Events;
using IdentityServer8.Extensions;
using IdentityModel;
using Yavsc.Server.Helpers;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.AspNetCore.Mvc.Localization;
using System.Diagnostics;
namespace Yavsc.Controllers
{
@ -41,10 +42,11 @@ namespace Yavsc.Controllers
readonly TwilioSettings _twilioSettings;
readonly IStringLocalizer _localizer;
private readonly IStringLocalizer _sharedLocalizer;
// TwilioSettings _twilioSettings;
// TwilioSettings _twilioSettings;
readonly ApplicationDbContext _dbContext;
readonly ApplicationDbContext _dbContext;
private readonly IIdentityServerInteractionService _interaction;
private readonly IClientStore _clientStore;
private readonly IAuthenticationSchemeProvider _schemeProvider;
@ -63,7 +65,9 @@ namespace Yavsc.Controllers
IOptions<SiteSettings> siteSettings,
ILoggerFactory loggerFactory, IOptions<TwilioSettings> twilioSettings,
IStringLocalizerFactory localizerFactory,
ApplicationDbContext dbContext)
IHtmlLocalizerFactory htmlLocalizerFactory,
ApplicationDbContext dbContext
)
{
_interaction = interaction;
_clientStore = clientStore;
@ -80,6 +84,13 @@ namespace Yavsc.Controllers
_dbContext = dbContext;
_localizer = localizerFactory.Create(typeof(AccountController));
_sharedLocalizer = localizerFactory.Create(typeof(Startup));
foreach (String name in new String[]{
"ConfirmYourAccountBody",
"ConfirmYourAccountTitle"
})
Debug.Assert(!_localizer[name].ResourceNotFound);
}
@ -566,10 +577,20 @@ namespace Yavsc.Controllers
// TODO user.DiskQuota = Startup.SiteSetup.UserFiles.Quota;
// For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=532713
// Send an email with this link
Uri authority = new Uri(Config.Authority);
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code }, protocol: "https", host: Config.Authority);
var callbackUrl = Url.Action("ConfirmEmail", "Account",
new { userId = user.Id, code },
protocol: authority.Scheme,
host: authority.Host+":"+authority.Port);
await _emailSender.SendEmailAsync(model.UserName, model.Email, _localizer["ConfirmYourAccountTitle"],
string.Format(_localizer["ConfirmYourAccountBody"], _siteSettings.Title, callbackUrl, _siteSettings.Slogan, _siteSettings.Audience));
string.Format(_localizer["ConfirmYourAccountBody"],
_siteSettings.Title,
callbackUrl,
_siteSettings.Slogan,
_siteSettings.Audience));
// No, wait for more than a login pass submission:
// do not await _signInManager.SignInAsync(user, isPersistent: false);

View file

@ -20,7 +20,7 @@ namespace Yavsc.Controllers
private SiteSettings siteSettings;
public HomeController(ILogger<HomeController> logger,
IHtmlLocalizer<Startup> localizer,
IHtmlLocalizer<HomeController> localizer,
ApplicationDbContext context,
IOptions<SiteSettings> settingsOptions)
{

View file

@ -264,7 +264,7 @@ public static class HostingExtensions
options.ClaimsIdentity.UserNameClaimType = JwtClaimTypes.Name;
options.ClaimsIdentity.RoleClaimType = Constants.RoleClaimType;
});
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
var migrationsAssembly = typeof(Program).GetTypeInfo().Assembly.GetName().Name;
var connectionString = builder.Configuration.GetConnectionString(Constants.YavscConnectionStringName);
var identityServerBuilder = builder.Services.AddIdentityServer(options =>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,59 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Yavsc.Migrations
{
/// <inheritdoc />
public partial class article : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Content",
table: "Comment",
newName: "Article");
migrationBuilder.RenameColumn(
name: "Content",
table: "BlogSpot",
newName: "Article");
migrationBuilder.CreateIndex(
name: "IX_MusicalPreference_TendencyId",
table: "MusicalPreference",
column: "TendencyId");
migrationBuilder.AddForeignKey(
name: "FK_MusicalPreference_MusicalTendency_TendencyId",
table: "MusicalPreference",
column: "TendencyId",
principalTable: "MusicalTendency",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_MusicalPreference_MusicalTendency_TendencyId",
table: "MusicalPreference");
migrationBuilder.DropIndex(
name: "IX_MusicalPreference_TendencyId",
table: "MusicalPreference");
migrationBuilder.RenameColumn(
name: "Article",
table: "Comment",
newName: "Content");
migrationBuilder.RenameColumn(
name: "Article",
table: "BlogSpot",
newName: "Content");
}
}
}

View file

@ -1315,13 +1315,13 @@ namespace Yavsc.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("AuthorId")
.HasColumnType("text");
b.Property<string>("Content")
b.Property<string>("Article")
.HasMaxLength(56224)
.HasColumnType("character varying(56224)");
b.Property<string>("AuthorId")
.HasColumnType("text");
b.Property<DateTime>("DateCreated")
.HasColumnType("timestamp with time zone");
@ -1373,11 +1373,11 @@ namespace Yavsc.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("AuthorId")
b.Property<string>("Article")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Content")
b.Property<string>("AuthorId")
.IsRequired()
.HasColumnType("text");
@ -2279,6 +2279,8 @@ namespace Yavsc.Migrations
b.HasIndex("GeneralSettingsUserId");
b.HasIndex("TendencyId");
b.ToTable("MusicalPreference");
});
@ -3839,6 +3841,14 @@ namespace Yavsc.Migrations
b.HasOne("Yavsc.Models.Musical.Profiles.GeneralSettings", null)
.WithMany("SoundColor")
.HasForeignKey("GeneralSettingsUserId");
b.HasOne("Yavsc.Models.Musical.MusicalTendency", "MusicalTendency")
.WithMany()
.HasForeignKey("TendencyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MusicalTendency");
});
modelBuilder.Entity("Yavsc.Models.Musical.Profiles.Instrumentation", b =>

View file

@ -5,6 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<PackageLicenseExpression>WTFPL</PackageLicenseExpression>
<UserSecretsId>76e56fc2-1619-40d8-8393-365258b7a21d</UserSecretsId>
<RootNamespace>Yavsc</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="popper.js">

View file

@ -77,16 +77,6 @@ Thanks.
<value>Please, confirm your e-mail</value>
</data>
<data name="ConfirmYourAccountBody">
<value>Ypu've successfully created an account {0},
but you still need to confirm your email.
Without this confirmation, you won't be able to login.
Please, follow this link to confirm your account : &lt;{1}&gt;.
--
{0} - {2} &lt;{3}&gt;</value>
</data>
<data name="Reset Password"><value>Ré-initialiser votre mot de passe</value></data>
<data name="Reset password confirmation"><value>Confirmation de ré-initialisation du mot de passe</value></data>
</root>

View file

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<!--
route name for the api controller used to tag the 'BlogPost' entity
-->
<data name="UserName"><value>Nom d'utilisateur</value></data>
</root>

View file

@ -1,10 +1,12 @@
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using Yavsc.Server.Helpers;
using Yavsc.Settings;
namespace Yavsc;
public class Startup
{
public static void Configure(

View file

@ -7,10 +7,10 @@
<table >
<thead>
<th>
@SR["Public info"]
@Localizer["Public info"]
</th>
<th>
@SR["AdminOnly"]
@Localizer["AdminOnly"]
</th>
</thead>
@ -23,7 +23,7 @@
<td>
<dl>
<dt>
@SR["UserName"]
@Localizer["UserName"]
</dt>
<dd>
@Html.DisplayFor(m=>user.UserName)
@ -31,7 +31,7 @@
</dl>
<dl>
<dt>
@SR["FullName"]
@Localizer["FullName"]
</dt>
<dd>
@Html.DisplayFor(m=>user.FullName)
@ -39,7 +39,7 @@
</dl>
<dl>
<dt>
@SR["PostalAddress"]
@Localizer["PostalAddress"]
</dt>
<dd>
@Html.DisplayFor(m=>user.PostalAddress)
@ -47,7 +47,7 @@
</dl>
<dl>
<dt>
@SR["Email"]
@Localizer["Email"]
</dt>
<dd>
@Html.DisplayFor(m=>user.Email)

View file

@ -79,7 +79,7 @@
</div>
</div>
</form>
@await Component.InvokeAsync("Directory","")
@await Component.InvokeAsync(name: "Directory",arguments: new {subdir="."})
<div >
@{ await Html.RenderPartialAsync("_PostFilesPartial"); }
</div>

View file

@ -53,9 +53,6 @@
<img class="blogphoto" alt="" src="@Model.Photo" title="Photo associée au post">
<h2 title="Titre du post" class="blogtitle" id="titleview" >@Model.Title</h2>
<hr>
<form asp-action="Edit">
<div class="form-horizontal">
@ -115,10 +112,6 @@
<hr />
<div id="prev">
<asciidoc>@Model.Article</asciidoc>
</div>
<div >
@{ await Html.RenderPartialAsync("_PostFilesPartial"); }
</div>

View file

@ -1,10 +1,10 @@
@model Client
@{
ViewData["Title"] = @SR["Create"];
ViewData["Title"] = @Localizer["Create"];
}
<h2>@SR["Create"]</h2>
<h2>@Localizer["Create"]</h2>
<form asp-action="Create">
<div class="form-horizontal">
@ -78,6 +78,6 @@
</form>
<div>
<a asp-action="Index">@SR["Back to List"]</a>
<a asp-action="Index">@Localizer["Back to List"]</a>
</div>

View file

@ -1,12 +1,12 @@
@model Client
@{
ViewData["Title"] = @SR["Delete"];
ViewData["Title"] = @Localizer["Delete"];
}
<h2>@SR["Delete"]</h2>
<h2>@Localizer["Delete"]</h2>
<h3>@SR["AreYourSureYouWantToDeleteThis"]</h3>
<h3>@Localizer["AreYourSureYouWantToDeleteThis"]</h3>
<div>
<h4>Client</h4>
<hr />
@ -64,7 +64,7 @@
<form asp-action="Delete">
<div class="form-actions no-color">
<input type="submit" value="Delete" class="btn btn-default" /> |
<a asp-action="Index">@SR["Back to List"]</a>
<a asp-action="Index">@Localizer["Back to List"]</a>
</div>
</form>
</div>

View file

@ -1,10 +1,10 @@
@model Client
@{
ViewData["Title"] = @SR["Details"];
ViewData["Title"] = @Localizer["Details"];
}
<h2>@SR["Details"]</h2>
<h2>@Localizer["Details"]</h2>
<div>
<h4>Client</h4>
@ -63,6 +63,6 @@
</dl>
</div>
<p>
<a asp-action="Edit" asp-route-id="@Model.Id">@SR["Edit"]</a> |
<a asp-action="Index">@SR["Back to List"]</a>
<a asp-action="Edit" asp-route-id="@Model.Id">@Localizer["Edit"]</a> |
<a asp-action="Index">@Localizer["Back to List"]</a>
</p>

View file

@ -4,7 +4,7 @@
ViewData["Title"] = "Edit";
}
<h2>@SR["Edit"]</h2>
<h2>@Localizer["Edit"]</h2>
<form asp-action="Edit">
<div class="form-horizontal">
@ -78,6 +78,6 @@
</form>
<div>
<a asp-action="Index">@SR["Back to List"]</a>
<a asp-action="Index">@Localizer["Back to List"]</a>
</div>

View file

@ -2,13 +2,13 @@
@model IEnumerable<IdentityServer8.EntityFramework.Entities.Client>
@{
ViewData["Title"] = @SR["Index"];
ViewData["Title"] = @Localizer["Index"];
}
<h2>@SR["Index"]</h2>
<h2>@Localizer["Index"]</h2>
<p>
<a asp-action="Create">@SR["Create New"]</a>
<a asp-action="Create">@Localizer["Create New"]</a>
</p>
<table class="table">

View file

@ -1,5 +1,5 @@
@{
ViewData["Title"] = @SR["À propos des restrictions d'accès"];
ViewData["Title"] = @Localizer["À propos des restrictions d'accès"];
}
<h1>@ViewData["Title"]</h1>

View file

@ -1,5 +1,5 @@
@{
ViewData["Title"] = @SR["À propos de Markdown"];
ViewData["Title"] = @Localizer["À propos de Markdown"];
}
<h1>@ViewData["Title"]</h1>

View file

@ -1,5 +1,5 @@
@{
ViewData["Title"] = @SR["Page d'accueil"];
ViewData["Title"] = @Localizer["Page d'accueil"];
}
@section scripts {

View file

@ -1,5 +1,5 @@
@{
ViewData["Title"] = @SR["Dash"];
ViewData["Title"] = @Localizer["Dash"];
}
<div>

View file

@ -1,7 +1,7 @@
@model IEnumerable<Activity>
@{
ViewData["Title"] = @SR["Page d'accueil"];
ViewData["Title"] = @Localizer["Page d'accueil"];
int i=0;
bool multipleact = Model.Count()>1;
}

View file

@ -1,5 +1,5 @@
@{
ViewData["Title"] = @SR["Todo (first)"];
ViewData["Title"] = @Localizer["Todo (first)"];
}
<h1>@ViewData["Title"]</h1>
<em>Linkmuse(trox)</em>
@ -9,7 +9,7 @@ Les tags.
La librairie, les lives.
</asciidoc>
@{
ViewData["Title"] = @SR["TODO"];
ViewData["Title"] = @Localizer["TODO"];
}
<h1>@ViewData["Title"]</h1>
<em>Faster, stronger, shorter</em>

View file

@ -30,7 +30,7 @@ background-attachment: fixed;
<img src="~/images/Notifications/@(n.icon).png" style="max-height:3em; float: left; margin:1em;" />
<h2 markdown="@n.title"></h2>
<a class="close" data-dismiss="alert" aria-label="close"
onclick="notifClick(@n.Id)">@((n.click_action == null) ? SR["Fermer"] : SR[n.click_action])</a>
onclick="notifClick(@n.Id)">@((n.click_action == null) ? Localizer["Fermer"] : Localizer[n.click_action])</a>
<asciidoc>@n.body</asciidoc>
</div>
}

View file

@ -8,9 +8,9 @@
<div class="collapse navbar-collapse" id="navbar" style="background-image: @Config.SiteSetup.Banner;">
<ul class="navbar-nav me-auto" >
<li class="nav-item"><a class="nav-link active" aria-current="page" href="/">Home</a></li>
<li class="nav-item"><a asp-controller="Blogspot" asp-action="Index" class="nav-link">@SR["Blogs"]</a></li>
<li class="nav-item"><a asp-controller="Home" asp-action="Contact" class="nav-link">@SR["Contact"]</a></li>
<li class="nav-item"><a asp-controller="Home" asp-action="About" class="nav-link">@SR["About"]</a></li>
<li class="nav-item"><a asp-controller="Blogspot" asp-action="Index" class="nav-link">@Localizer["Blogs"]</a></li>
<li class="nav-item"><a asp-controller="Home" asp-action="Contact" class="nav-link">@Localizer["Contact"]</a></li>
<li class="nav-item"><a asp-controller="Home" asp-action="About" class="nav-link">@Localizer["About"]</a></li>
<partial name="_LoginPartial" />
</ul>
</div>

View file

@ -1,4 +1,5 @@
@using Yavsc
@using Microsoft.AspNetCore.Mvc.Localization
@using Yavsc
@using Yavsc.Models
@using Yavsc.Models.Musical;
@using Yavsc.Models.Drawing;
@ -36,8 +37,10 @@
@addTagHelper *, Yavsc
@inject IAuthorizationService AuthorizationService
@inject Microsoft.AspNetCore.Mvc.Localization.IHtmlLocalizer<Startup> SR
@inject Microsoft.Extensions.Options.IOptions<SiteSettings> SiteSettings
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
@inject IViewLocalizer Localizer
@inject IHtmlLocalizer<Startup> SharedLocalizer

View file

@ -9,7 +9,7 @@ namespace Yavsc;
public static class Config
{
public static string? Authority { get; set; }
public static string Authority { get; set; }
public static IConfigurationRoot? GoogleWebClientConfiguration { get; set; }
public static GoogleServiceAccount? GServiceAccount { get; set; }

View file

@ -11,16 +11,22 @@ namespace Yavsc.Models.Blog
{
public class BlogPostEditViewModel : BlogPost
{
public bool Publish { get; set; }
public BlogPostEditViewModel()
{
}
public BlogPostEditViewModel(BlogPost post, bool publish)
{
Id = post.Id;
AuthorId = post.AuthorId;
ACL = post.ACL;
Article = post.Article;
Photo = post.Photo;
Title = post.Title;
Article = post.Article;
Publish = publish;
ACL = post.ACL;
}
public bool Publish { get; set; }
}

View file

@ -14,7 +14,7 @@ namespace Yavsc.Models.Blog
public long Id { get; set; }
[YaStringLength(1024)]
public string Content { get; set; }
public string Article { get; set; }
[ForeignKeyAttribute(nameof(ReceiverId))][JsonIgnore]
public virtual BlogPost Post { get; set; }

View file

@ -4,6 +4,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UserSecretsId>53bd70e8-ff81-497a-847f-a15fd8ea7a09</UserSecretsId>
<RootNamespace>Yavsc.Server</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HigginsSoft.IdentityServer8.EntityFramework" />
@ -30,4 +31,4 @@
<ItemGroup>
<ProjectReference Include="../Abstract/Abstract.csproj" />
</ItemGroup>
</Project>
</Project>

View file

@ -59,10 +59,12 @@ namespace Yavsc.Services
msg.From.Add(new MailboxAddress(siteSettings.Owner.Name,
siteSettings.Owner.EMail));
msg.To.Add(new MailboxAddress(name, email));
msg.Body = new TextPart("html")
TextPart text;
msg.Body = text = new TextPart("html")
{
Text = htmlMessage
Text = $"<html><body>{htmlMessage}</body></html>"
};
msg.Subject = subject;
msg.MessageId = MimeKit.Utils.MimeUtils.GenerateMessageId(
siteSettings.Authority

View file

@ -4,6 +4,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>Yavsc.cli</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Razor" />
@ -18,4 +19,4 @@
<ProjectReference Include="..\Abstract\Abstract.csproj" />
<ProjectReference Include="..\Server\Server.csproj" />
</ItemGroup>
</Project>
</Project>

View file

@ -11,6 +11,4 @@ public class Services : BaseTestContext, IClassFixture<WebServerFixture>
{
}
}

View file

@ -4,6 +4,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<RootNamespace>Yavsc.Tests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" />
@ -31,4 +32,4 @@
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
</Project>
</Project>