瀏覽代碼

Removed discord id and discriminator. Fixed oauth2. Added data pending state

Marcel Baumgartner 2 年之前
父節點
當前提交
922be4443d

+ 10 - 0
.idea/.idea.Moonlight/.idea/efCoreCommonOptions.xml

@@ -1,11 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="EfCoreCommonOptions">
+    <option name="migrationsToStartupProjects">
+      <map>
+        <entry key="16141d00-a997-4ba6-b0dc-af6f4712613a" value="16141d00-a997-4ba6-b0dc-af6f4712613a" />
+      </map>
+    </option>
     <option name="solutionLevelOptions">
       <map>
         <entry key="migrationsProject" value="16141d00-a997-4ba6-b0dc-af6f4712613a" />
         <entry key="startupProject" value="16141d00-a997-4ba6-b0dc-af6f4712613a" />
       </map>
     </option>
+    <option name="startupToMigrationsProjects">
+      <map>
+        <entry key="16141d00-a997-4ba6-b0dc-af6f4712613a" value="16141d00-a997-4ba6-b0dc-af6f4712613a" />
+      </map>
+    </option>
   </component>
 </project>

+ 0 - 2
Moonlight/App/Database/Entities/User.cs

@@ -30,8 +30,6 @@ public class User
     
     // Discord
     public long DiscordId { get; set; } = -1;
-    public string DiscordUsername { get; set; } = "";
-    public string DiscordDiscriminator { get; set; } = "";
     
     // Date stuff
     public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

+ 0 - 0
Moonlight/App/Databse/Migrations/20230221183730_UpdatedSupportAndUserModel.Designer.cs → Moonlight/App/Database/Migrations/20230221183730_UpdatedSupportAndUserModel.Designer.cs


+ 0 - 0
Moonlight/App/Databse/Migrations/20230221183730_UpdatedSupportAndUserModel.cs → Moonlight/App/Database/Migrations/20230221183730_UpdatedSupportAndUserModel.cs


+ 1058 - 0
Moonlight/App/Database/Migrations/20230324164853_RemovedDiscordUsernameAndDiscriminator.Designer.cs

@@ -0,0 +1,1058 @@
+// <auto-generated />
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Moonlight.App.Database;
+
+#nullable disable
+
+namespace Moonlight.App.Database.Migrations
+{
+    [DbContext(typeof(DataContext))]
+    [Migration("20230324164853_RemovedDiscordUsernameAndDiscriminator")]
+    partial class RemovedDiscordUsernameAndDiscriminator
+    {
+        /// <inheritdoc />
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "7.0.3")
+                .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.AaPanel", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("BaseDomain")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("Key")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("Url")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("AaPanels");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Database", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<int>("AaPanelId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("InternalAaPanelId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("OwnerId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("AaPanelId");
+
+                    b.HasIndex("OwnerId");
+
+                    b.ToTable("Databases");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.DdosAttack", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreatedAt")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<long>("Data")
+                        .HasColumnType("bigint");
+
+                    b.Property<string>("Ip")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("NodeId")
+                        .HasColumnType("int");
+
+                    b.Property<bool>("Ongoing")
+                        .HasColumnType("tinyint(1)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("NodeId");
+
+                    b.ToTable("DdosAttacks");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.DockerImage", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<bool>("Default")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<int?>("ImageId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ImageId");
+
+                    b.ToTable("DockerImages");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Domain", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("OwnerId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("SharedDomainId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("OwnerId");
+
+                    b.HasIndex("SharedDomainId");
+
+                    b.ToTable("Domains");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Image", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<int>("Allocations")
+                        .HasColumnType("int");
+
+                    b.Property<string>("ConfigFiles")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("Description")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("InstallDockerImage")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("InstallEntrypoint")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("InstallScript")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("Startup")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("StartupDetection")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("StopCommand")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("TagsJson")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<Guid>("Uuid")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Images");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.ImageTag", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ImageTags");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.ImageVariable", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("DefaultValue")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int?>("ImageId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Key")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ImageId");
+
+                    b.ToTable("ImageVariables");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.LoadingMessage", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Message")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("LoadingMessages");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.LogsEntries.AuditLogEntry", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreatedAt")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<string>("Ip")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("JsonData")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<bool>("System")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("AuditLog");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.LogsEntries.ErrorLogEntry", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Class")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<DateTime>("CreatedAt")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<string>("Ip")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("JsonData")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("Stacktrace")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<bool>("System")
+                        .HasColumnType("tinyint(1)");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("ErrorLog");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.LogsEntries.SecurityLogEntry", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<DateTime>("CreatedAt")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<string>("Ip")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("JsonData")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<bool>("System")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("SecurityLog");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Node", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Fqdn")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("HttpPort")
+                        .HasColumnType("int");
+
+                    b.Property<int>("MoonlightDaemonPort")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("SftpPort")
+                        .HasColumnType("int");
+
+                    b.Property<bool>("Ssl")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<string>("Token")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("TokenId")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Nodes");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.NodeAllocation", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<int?>("NodeId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("Port")
+                        .HasColumnType("int");
+
+                    b.Property<int?>("ServerId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("NodeId");
+
+                    b.HasIndex("ServerId");
+
+                    b.ToTable("NodeAllocations");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Notification.NotificationAction", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Action")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("NotificationClientId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("NotificationClientId");
+
+                    b.ToTable("NotificationActions");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Notification.NotificationClient", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<int>("UserId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("UserId");
+
+                    b.ToTable("NotificationClients");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Revoke", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Identifier")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Revokes");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<int>("Cpu")
+                        .HasColumnType("int");
+
+                    b.Property<long>("Disk")
+                        .HasColumnType("bigint");
+
+                    b.Property<int>("DockerImageIndex")
+                        .HasColumnType("int");
+
+                    b.Property<int>("ImageId")
+                        .HasColumnType("int");
+
+                    b.Property<bool>("Installing")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<int>("MainAllocationId")
+                        .HasColumnType("int");
+
+                    b.Property<long>("Memory")
+                        .HasColumnType("bigint");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("NodeId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("OverrideStartup")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("OwnerId")
+                        .HasColumnType("int");
+
+                    b.Property<bool>("Suspended")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<Guid>("Uuid")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ImageId");
+
+                    b.HasIndex("MainAllocationId");
+
+                    b.HasIndex("NodeId");
+
+                    b.HasIndex("OwnerId");
+
+                    b.ToTable("Servers");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.ServerBackup", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<long>("Bytes")
+                        .HasColumnType("bigint");
+
+                    b.Property<bool>("Created")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<DateTime>("CreatedAt")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int?>("ServerId")
+                        .HasColumnType("int");
+
+                    b.Property<Guid>("Uuid")
+                        .HasColumnType("char(36)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ServerId");
+
+                    b.ToTable("ServerBackups");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.ServerVariable", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Key")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int?>("ServerId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Value")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ServerId");
+
+                    b.ToTable("ServerVariables");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.SharedDomain", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("CloudflareId")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("SharedDomains");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Subscription", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Description")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("Duration")
+                        .HasColumnType("int");
+
+                    b.Property<string>("Name")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("SellPassId")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Subscriptions");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.SubscriptionLimit", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<int>("Amount")
+                        .HasColumnType("int");
+
+                    b.Property<int>("Cpu")
+                        .HasColumnType("int");
+
+                    b.Property<int>("Disk")
+                        .HasColumnType("int");
+
+                    b.Property<int>("ImageId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("Memory")
+                        .HasColumnType("int");
+
+                    b.Property<int?>("SubscriptionId")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("ImageId");
+
+                    b.HasIndex("SubscriptionId");
+
+                    b.ToTable("SubscriptionLimits");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.SupportMessage", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Answer")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<DateTime>("CreatedAt")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<bool>("IsQuestion")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<bool>("IsSupport")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<bool>("IsSystem")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<string>("Message")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int?>("RecipientId")
+                        .HasColumnType("int");
+
+                    b.Property<int?>("SenderId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("Type")
+                        .HasColumnType("int");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("RecipientId");
+
+                    b.HasIndex("SenderId");
+
+                    b.ToTable("SupportMessages");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.User", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Address")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<bool>("Admin")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<string>("City")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("Country")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<DateTime>("CreatedAt")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<long>("DiscordId")
+                        .HasColumnType("bigint");
+
+                    b.Property<string>("Email")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("FirstName")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("LastName")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("Password")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("State")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("Status")
+                        .HasColumnType("int");
+
+                    b.Property<int>("SubscriptionDuration")
+                        .HasColumnType("int");
+
+                    b.Property<int?>("SubscriptionId")
+                        .HasColumnType("int");
+
+                    b.Property<DateTime?>("SubscriptionSince")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<bool>("SupportPending")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<DateTime>("TokenValidTime")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<bool>("TotpEnabled")
+                        .HasColumnType("tinyint(1)");
+
+                    b.Property<string>("TotpSecret")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<DateTime>("UpdatedAt")
+                        .HasColumnType("datetime(6)");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("SubscriptionId");
+
+                    b.ToTable("Users");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Website", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<int>("AaPanelId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("DomainName")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("FtpPassword")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<string>("FtpUsername")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.Property<int>("InternalAaPanelId")
+                        .HasColumnType("int");
+
+                    b.Property<int>("OwnerId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("PhpVersion")
+                        .IsRequired()
+                        .HasColumnType("longtext");
+
+                    b.HasKey("Id");
+
+                    b.HasIndex("AaPanelId");
+
+                    b.HasIndex("OwnerId");
+
+                    b.ToTable("Websites");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Database", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.AaPanel", "AaPanel")
+                        .WithMany()
+                        .HasForeignKey("AaPanelId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Moonlight.App.Database.Entities.User", "Owner")
+                        .WithMany()
+                        .HasForeignKey("OwnerId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("AaPanel");
+
+                    b.Navigation("Owner");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.DdosAttack", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.Node", "Node")
+                        .WithMany()
+                        .HasForeignKey("NodeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Node");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.DockerImage", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.Image", null)
+                        .WithMany("DockerImages")
+                        .HasForeignKey("ImageId");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Domain", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.User", "Owner")
+                        .WithMany()
+                        .HasForeignKey("OwnerId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Moonlight.App.Database.Entities.SharedDomain", "SharedDomain")
+                        .WithMany()
+                        .HasForeignKey("SharedDomainId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Owner");
+
+                    b.Navigation("SharedDomain");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.ImageVariable", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.Image", null)
+                        .WithMany("Variables")
+                        .HasForeignKey("ImageId");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.NodeAllocation", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.Node", null)
+                        .WithMany("Allocations")
+                        .HasForeignKey("NodeId");
+
+                    b.HasOne("Moonlight.App.Database.Entities.Server", null)
+                        .WithMany("Allocations")
+                        .HasForeignKey("ServerId");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Notification.NotificationAction", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.Notification.NotificationClient", "NotificationClient")
+                        .WithMany()
+                        .HasForeignKey("NotificationClientId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("NotificationClient");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Notification.NotificationClient", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.User", "User")
+                        .WithMany()
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("User");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.Image", "Image")
+                        .WithMany()
+                        .HasForeignKey("ImageId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Moonlight.App.Database.Entities.NodeAllocation", "MainAllocation")
+                        .WithMany()
+                        .HasForeignKey("MainAllocationId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Moonlight.App.Database.Entities.Node", "Node")
+                        .WithMany()
+                        .HasForeignKey("NodeId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Moonlight.App.Database.Entities.User", "Owner")
+                        .WithMany()
+                        .HasForeignKey("OwnerId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("Image");
+
+                    b.Navigation("MainAllocation");
+
+                    b.Navigation("Node");
+
+                    b.Navigation("Owner");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.ServerBackup", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.Server", null)
+                        .WithMany("Backups")
+                        .HasForeignKey("ServerId");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.ServerVariable", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.Server", null)
+                        .WithMany("Variables")
+                        .HasForeignKey("ServerId");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.SubscriptionLimit", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.Image", "Image")
+                        .WithMany()
+                        .HasForeignKey("ImageId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Moonlight.App.Database.Entities.Subscription", null)
+                        .WithMany("Limits")
+                        .HasForeignKey("SubscriptionId");
+
+                    b.Navigation("Image");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.SupportMessage", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.User", "Recipient")
+                        .WithMany()
+                        .HasForeignKey("RecipientId");
+
+                    b.HasOne("Moonlight.App.Database.Entities.User", "Sender")
+                        .WithMany()
+                        .HasForeignKey("SenderId");
+
+                    b.Navigation("Recipient");
+
+                    b.Navigation("Sender");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.User", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.Subscription", "Subscription")
+                        .WithMany()
+                        .HasForeignKey("SubscriptionId");
+
+                    b.Navigation("Subscription");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Website", b =>
+                {
+                    b.HasOne("Moonlight.App.Database.Entities.AaPanel", "AaPanel")
+                        .WithMany()
+                        .HasForeignKey("AaPanelId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.HasOne("Moonlight.App.Database.Entities.User", "Owner")
+                        .WithMany()
+                        .HasForeignKey("OwnerId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+
+                    b.Navigation("AaPanel");
+
+                    b.Navigation("Owner");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Image", b =>
+                {
+                    b.Navigation("DockerImages");
+
+                    b.Navigation("Variables");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Node", b =>
+                {
+                    b.Navigation("Allocations");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+                {
+                    b.Navigation("Allocations");
+
+                    b.Navigation("Backups");
+
+                    b.Navigation("Variables");
+                });
+
+            modelBuilder.Entity("Moonlight.App.Database.Entities.Subscription", b =>
+                {
+                    b.Navigation("Limits");
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 40 - 0
Moonlight/App/Database/Migrations/20230324164853_RemovedDiscordUsernameAndDiscriminator.cs

@@ -0,0 +1,40 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Moonlight.App.Database.Migrations
+{
+    /// <inheritdoc />
+    public partial class RemovedDiscordUsernameAndDiscriminator : Migration
+    {
+        /// <inheritdoc />
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropColumn(
+                name: "DiscordDiscriminator",
+                table: "Users");
+
+            migrationBuilder.DropColumn(
+                name: "DiscordUsername",
+                table: "Users");
+        }
+
+        /// <inheritdoc />
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.AddColumn<string>(
+                name: "DiscordDiscriminator",
+                table: "Users",
+                type: "longtext",
+                nullable: false)
+                .Annotation("MySql:CharSet", "utf8mb4");
+
+            migrationBuilder.AddColumn<string>(
+                name: "DiscordUsername",
+                table: "Users",
+                type: "longtext",
+                nullable: false)
+                .Annotation("MySql:CharSet", "utf8mb4");
+        }
+    }
+}

+ 0 - 8
Moonlight/App/Database/Migrations/DataContextModelSnapshot.cs

@@ -723,17 +723,9 @@ namespace Moonlight.App.Database.Migrations
                     b.Property<DateTime>("CreatedAt")
                         .HasColumnType("datetime(6)");
 
-                    b.Property<string>("DiscordDiscriminator")
-                        .IsRequired()
-                        .HasColumnType("longtext");
-
                     b.Property<long>("DiscordId")
                         .HasColumnType("bigint");
 
-                    b.Property<string>("DiscordUsername")
-                        .IsRequired()
-                        .HasColumnType("longtext");
-
                     b.Property<string>("Email")
                         .IsRequired()
                         .HasColumnType("longtext");

+ 9 - 0
Moonlight/App/Http/Controllers/Api/Moonlight/OAuth2Controller.cs

@@ -2,6 +2,7 @@
 using Microsoft.AspNetCore.Mvc;
 using Moonlight.App.Exceptions;
 using Moonlight.App.Helpers;
+using Moonlight.App.Models.Misc;
 using Moonlight.App.Repositories;
 using Moonlight.App.Services;
 using Moonlight.App.Services.OAuth2;
@@ -104,6 +105,14 @@ public class OAuth2Controller : Controller
                         userData.FirstName,
                         userData.LastName
                     );
+
+                    var newUser = UserRepository
+                        .Get()
+                        .First(x => x.Email == userData.Email);
+
+                    newUser.Status = UserStatus.DataPending;
+                    
+                    UserRepository.Update(newUser);
                 }
                 else
                 {

+ 2 - 1
Moonlight/App/Models/Misc/UserStatus.cs

@@ -8,5 +8,6 @@ public enum UserStatus
     VerifyFailed,
     Warned,
     Banned,
-    Disabled
+    Disabled,
+    DataPending
 }

+ 5 - 2
Moonlight/App/Services/OAuth2/DiscordOAuth2Service.cs

@@ -3,6 +3,7 @@ using Logging.Net;
 using Moonlight.App.Database.Entities;
 using Moonlight.App.Exceptions;
 using Moonlight.App.Models.Google.Requests;
+using Moonlight.App.Models.Misc;
 using RestSharp;
 
 namespace Moonlight.App.Services.OAuth2;
@@ -112,8 +113,10 @@ public class DiscordOAuth2Service
         return new User()
         {
             Email = getData.GetValue<string>("email"),
-            FirstName = getData.GetValue<string>("username"),
-            LastName = getData.GetValue<string>("discriminator")
+            FirstName = "User",
+            LastName = "User",
+            DiscordId = getData.GetValue<long>("id"),
+            Status = UserStatus.DataPending
         };
     }
 

+ 0 - 2
Moonlight/App/Services/UserService.cs

@@ -69,9 +69,7 @@ public class UserService
             State = "",
             Status = UserStatus.Unverified,
             CreatedAt = DateTime.UtcNow,
-            DiscordDiscriminator = "",
             DiscordId = -1,
-            DiscordUsername = "",
             TotpEnabled = false,
             TotpSecret = "",
             UpdatedAt = DateTime.UtcNow,

+ 0 - 12
Moonlight/Shared/Views/Admin/Users/Edit.razor

@@ -134,18 +134,6 @@
                             </label>
                             <input @bind="User.DiscordId" type="number" class="form-control">
                         </div>
-                        <div class="mb-10">
-                            <label class="form-label">
-                                <TL>Discord username</TL>
-                            </label>
-                            <input @bind="User.DiscordUsername" type="text" class="form-control">
-                        </div>
-                        <div class="mb-10">
-                            <label class="form-label">
-                                <TL>Discord discriminator</TL>
-                            </label>
-                            <input @bind="User.DiscordDiscriminator" type="text" class="form-control">
-                        </div>
                     </div>
                 </div>
             </div>

+ 1 - 1
Moonlight/Shared/Views/Admin/Users/View.razor

@@ -186,7 +186,7 @@ else
                             <TL>Discord</TL>
                         </label>
                         <div class="col-lg-8">
-                            <span class="fw-bold fs-6 text-gray-800">@(User.DiscordUsername)#@(User.DiscordDiscriminator)</span>
+                            <span class="fw-bold fs-6 text-gray-800">@* TODO: Implement discord fetching here *@</span>
                         </div>
                     </div>
                     <div class="separator my-4"></div>