Registration gates: proof-of-work CAPTCHA and training-notice consent receipt (#54)

This commit is contained in:
Heimdall 2026-11-11 10:15:46 +00:00
commit 33be966b7d
28 changed files with 1253 additions and 56 deletions

View file

@ -0,0 +1,40 @@
using System;
using Bifrost.Web.Data;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bifrost.Web.Data.Migrations
{
// Hand-written like AddMindKeys: no dotnet-ef on the authoring host; the snapshot was edited to match.
[DbContext(typeof(BifrostDbContext))]
[Migration("20261111090000_AddConsentReceipts")]
public partial class AddConsentReceipts : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ConsentReceipts",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
UserAccountId = table.Column<Guid>(type: "uuid", nullable: false),
NoticeVersion = table.Column<int>(type: "integer", nullable: false),
AcceptedAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
WithdrawnAtUtc = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ConsentReceipts", x => x.Id);
table.ForeignKey("FK_ConsentReceipts_UserAccounts_UserAccountId", x => x.UserAccountId, "UserAccounts", "Id", onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(name: "IX_ConsentReceipts_UserAccountId_NoticeVersion", table: "ConsentReceipts", columns: new[] { "UserAccountId", "NoticeVersion" }, unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "ConsentReceipts");
}
}
}

View file

@ -1440,6 +1440,32 @@ namespace Bifrost.Web.Data.Migrations
b.ToTable("VolunteerClaims");
});
modelBuilder.Entity("Bifrost.Web.Domain.ConsentReceipt", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("AcceptedAtUtc")
.HasColumnType("timestamp with time zone");
b.Property<int>("NoticeVersion")
.HasColumnType("integer");
b.Property<Guid>("UserAccountId")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("WithdrawnAtUtc")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("UserAccountId", "NoticeVersion")
.IsUnique();
b.ToTable("ConsentReceipts");
});
modelBuilder.Entity("Bifrost.Web.Domain.MindKey", b =>
{
b.Property<Guid>("Id")
@ -2142,6 +2168,17 @@ namespace Bifrost.Web.Data.Migrations
b.Navigation("WorkItem");
});
modelBuilder.Entity("Bifrost.Web.Domain.ConsentReceipt", b =>
{
b.HasOne("Bifrost.Web.Domain.UserAccount", "UserAccount")
.WithMany()
.HasForeignKey("UserAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("UserAccount");
});
modelBuilder.Entity("Bifrost.Web.Domain.MemberProfile", b =>
{
b.HasOne("Bifrost.Web.Domain.UserAccount", "UserAccount")