diff --git a/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor b/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor
index e029402..a865461 100644
--- a/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor
+++ b/ImageBoardServerApp/Shared/Components/Forms/CommentForm.razor
@@ -1,6 +1,7 @@
@using System.ComponentModel.DataAnnotations
@using ImageBoardServerApp.Auth
@using ImageBoardServerApp.Data.Repository
+@using ImageBoardServerApp.Util
@inject NavigationManager navigationManager
@inject IWebHostEnvironment env
@inject AuthenticationStateProvider authStateProvider
@@ -110,6 +111,12 @@
postErr = "You are not logged in.";
return;
}
+ if (!foundusr.ConfirmedEmail)
+ {
+ hasErr = true;
+ postErr = "You cannot post without an verified email.";
+ return;
+ }
int userID = foundusr.UserID;
if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - foundusr.TimeBanned < 0)
{
@@ -118,9 +125,9 @@
if (foundusr.TimeBanned != -1)
{
+ var dt = TheManager.ConvertToDateTime(foundusr.TimeBanned);
hasErr = true;
- postErr = "You are banned and may not comment.";
- //Maybe redirect to /banned?
+ postErr = "You are banned for " + foundusr.BanReason + " and may not comment until " + dt.Year + "." + dt.Month + "." + dt.Day + " " + dt.Hour + ":" + dt.Minute + "::" + dt.Second;
return;
}
foundusr.lastActionTimeStamp = DateTimeOffset.Now.ToUnixTimeMilliseconds();
diff --git a/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor b/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor
index 625ab18..af80dea 100644
--- a/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor
+++ b/ImageBoardServerApp/Shared/Components/Forms/PostForm.razor
@@ -117,6 +117,12 @@
postErr = "You are not logged in.";
return;
}
+ if (!foundusr.ConfirmedEmail)
+ {
+ hasErr = true;
+ postErr = "You cannot post without an verified email.";
+ return;
+ }
int userID = foundusr.UserID;
if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - foundusr.TimeBanned < 0)
{
@@ -125,9 +131,9 @@
if (foundusr.TimeBanned != -1)
{
+ var dt = TheManager.ConvertToDateTime(foundusr.TimeBanned);
hasErr = true;
- postErr = "You are banned and may not post.";
- //Maybe redirect to /banned?
+ postErr = "You are banned for " + foundusr.BanReason + " and may not post until " + dt.Year + "." + dt.Month + "." + dt.Day + " " + dt.Hour + ":" + dt.Minute + "::" + dt.Second;
return;
}
diff --git a/ImageBoardServerApp/Shared/Components/UserEntry.razor b/ImageBoardServerApp/Shared/Components/UserEntry.razor
index 5cd9c03..a02e9be 100644
--- a/ImageBoardServerApp/Shared/Components/UserEntry.razor
+++ b/ImageBoardServerApp/Shared/Components/UserEntry.razor
@@ -12,8 +12,9 @@
Update Role
-
+
Unban (if banned)
+
@user.Role
diff --git a/ImageBoardServerApp/Util/TheManager.cs b/ImageBoardServerApp/Util/TheManager.cs
index bd08ad6..b2d8b9a 100644
--- a/ImageBoardServerApp/Util/TheManager.cs
+++ b/ImageBoardServerApp/Util/TheManager.cs
@@ -106,4 +106,11 @@ public class TheManager
return BitConverter.ToString(bytes).Replace("-", "").ToLower();
}
+
+ public static DateTime ConvertToDateTime(long timestamp)
+ {
+ DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+ DateTime date = unixEpoch.AddSeconds(timestamp);
+ return date;
+ }
}
\ No newline at end of file